Skip to content

Commit

Permalink
updates of invalid transactions also getting success message in ONFT …
Browse files Browse the repository at this point in the history
…module

- added providers for streamsend and actions getting issue in duration
  • Loading branch information
vinay-maggidi committed Feb 6, 2025
1 parent 3e1d396 commit 1d7c1a4
Show file tree
Hide file tree
Showing 11 changed files with 560 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import { ActionExample } from "@elizaos/core";

const examples: ActionExample[][] = [
[
{
role: "user",
content: "Send a stream of 100 FLIX to omniflix1xyz... for 1 hour"
},
{
role: "assistant",
content: `I'll help you send a stream payment of 100 FLIX that will last for 1 hour.
\`\`\`json
{
"recipientAddress": "omniflix1xyz...",
"amount": {
"denom": "uflix",
"amount": "100000000"
},
"duration": {
"seconds": 3600,
"nanos": 0
},
"streamType": 0,
"cancellable": true,
"paymentFee": {
"denom": "uflix",
"amount": "1000"
}
}
\`\`\`
`
}
],
[
{
role: "user",
content: "Create a non-cancellable stream of 50 FLIX to omniflix1abc... that lasts for 24 hours"
},
{
role: "assistant",
content: `I'll help you set up a non-cancellable stream payment of 50 FLIX for 24 hours.
\`\`\`json
{
"recipientAddress": "omniflix1abc...",
"amount": {
"denom": "uflix",
"amount": "50000000"
},
"duration": {
"seconds": 86400,
"nanos": 0
},
"streamType": 0,
"cancellable": false,
"paymentFee": {
"denom": "uflix",
"amount": "1000"
}
}
\`\`\`
`
}
],
[
{
role: "user",
content: "Start a stream payment of 1000 FLIX to omniflix1def... for 1 week with a payment fee of 10 FLIX"
},
{
role: "assistant",
content: `I'll help you create a stream payment of 1000 FLIX lasting one week with a custom payment fee.
\`\`\`json
{
"recipientAddress": "omniflix1def...",
"amount": {
"denom": "uflix",
"amount": "1000000000"
},
"duration": {
"seconds": 604800,
"nanos": 0
},
"streamType": 0,
"cancellable": true,
"paymentFee": {
"denom": "uflix",
"amount": "10000000"
}
}
\`\`\`
`
}
],
[
{
role: "user",
content: "Send 75 FLIX to omniflix1ghi... over 12 hours with periods"
},
{
role: "assistant",
content: `I'll help you create a stream payment with multiple periods.
\`\`\`json
{
"recipientAddress": "omniflix1ghi...",
"amount": {
"denom": "uflix",
"amount": "75000000"
},
"duration": {
"seconds": 43200,
"nanos": 0
},
"streamType": 0,
"periods": [
{
"amount": {
"denom": "uflix",
"amount": "25000000"
},
"duration": {
"seconds": 14400,
"nanos": 0
}
}
],
"cancellable": true,
"paymentFee": {
"denom": "uflix",
"amount": "1000"
}
}
\`\`\`
`
}
],
[
{
role: "user",
content: "Create a stream to send 200 FLIX to omniflix1jkl... over 48 hours with a different stream type"
},
{
role: "assistant",
content: `I'll help you create a stream with a different stream type.
\`\`\`json
{
"recipientAddress": "omniflix1jkl...",
"amount": {
"denom": "uflix",
"amount": "200000000"
},
"duration": {
"seconds": 172800,
"nanos": 0
},
"streamType": 1,
"cancellable": true,
"paymentFee": {
"denom": "uflix",
"amount": "1000"
}
}
\`\`\`
`
}
]
];

export default examples;
4 changes: 3 additions & 1 deletion packages/plugin-omniflix/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { stakingActions } from "./staking";
import { govActions } from "./gov";
import { onftActions } from "./omniflix/onft";
import { marketPlaceActions } from "./omniflix/market_place";
import { streampayActions } from "./omniflix/streampay";

export const actions = [
...bankActions,
...stakingActions,
...govActions,
...onftActions,
...marketPlaceActions
...marketPlaceActions,
...streampayActions
];

export default actions;
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ export class burnNFTAction {
params.id,
params.denomId
);

if (response.code !== 0) {
throw new Error(`${response.rawLog}`);
}
return response.transactionHash;
} catch (error) {
throw new Error(`Transfer failed: ${error.message}`);
throw new Error(`NFT Burn failed: ${error.message}`);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ export class createDenomAction {
params.uriHash || '',
params.data || '',
);
if (response.code !== 0) {
throw new Error(`${response.rawLog}`);
}

return response.transactionHash;
} catch (error) {
throw new Error(`Transfer failed: ${error.message}`);
throw new Error(`Create Denom failed: ${error.message}`);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export class mintONFTAction {
params.royaltyShare || "10000000000000000",
params.recipient
);
console.log('response', response);
if (response.code !== 0) {
throw new Error(`${response.rawLog}`);
}
return response.transactionHash;
} catch (error) {
throw new Error(`Mint failed: ${error.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export class transferDenomAction {
params.id,
params.recipient
);
if (response.code !== 0) {
throw new Error(`${response.rawLog}`);
}

return response.transactionHash;
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,12 @@ export class transferNFTAction {
params.denomId,
params.recipient
);
if (response.code !== 0) {
throw new Error(`${response.rawLog}`);
}
return response.transactionHash;
} catch (error) {
throw new Error(`Transfer failed: ${error.message}`);
throw new Error(`NFT Transfer failed: ${error.message}`);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export class updateDenomAction {
params.previewUri || '',
params.royaltyReceivers || []
);
if (response.code !== 0) {
throw new Error(`${response.rawLog}`);
}

return response.transactionHash;
} catch (error) {
Expand Down
11 changes: 11 additions & 0 deletions packages/plugin-omniflix/src/actions/omniflix/streampay/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { type Action } from "@elizaos/core";
import streamSend from "./stream_send.ts";
// import stopStream from "./stop_stream.ts";
// import claimStreamedAmount from "./claim_streamed_amount.ts";

export const streampayActions: Action[] = [
streamSend,
// stopStream,
// claimStreamedAmount,
];
export default streampayActions;
Loading

0 comments on commit 1d7c1a4

Please sign in to comment.