Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implements transaction builder #22

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

jinoosss
Copy link
Member

What type of PR is this?

  • feature

What this PR does:

Supports Transaction Builder for Tx data generation.

Supports utility functions for generating transaction messages.

  • makeAddPackageMessage
  • makeMsgCallMessage
  • makeMsgSendMessage
  • makeMsgRunMessage

Use cases for TransactionBuilder.

// Initialize
const sdk = new AdenaSDK(new AdenaWalletProvider());

await sdk.addEstablish({ siteName: 'Adena' });

// Create Transaction
const tx = TransactionBuilder.create()
    .messages(  
        makeMsgSendMessage({
            from_address: 'from_address',
            to_address: 'to_address',
            amount: '1ugnot',
        }),
        makeMsgSendMessage({  // Multiple messages can be created
            from_address: 'from_address',
            to_address: 'to_address',
            amount: '2ugnot',
        })
    )
    .gasWanted(2000000)
    .fee(1000, 'ugnot')
    .memo('memo')
    .build();

// Broadcast Trnasction
await sdk.broadcastTransaction({
    tx: tx,
    broadcastType: BroadcastType.SYNC,
});

...

@jinoosss jinoosss requested review from a team, onlyhyde and dongwon8247 and removed request for a team January 21, 2025 19:03
@jinoosss jinoosss merged commit 0334ccc into main Jan 22, 2025
3 checks passed
@jinoosss jinoosss deleted the feat/implements-transaction-builder branch January 22, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant