Migrate EOSJS to Whartfkit. #9
Unanswered
whattocode
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
ok, I found the document. But, how to apply blocksBehind:3 ?? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys, I'm new to EOS blockchain development. I have the following code that I initially planned to implement using EOSJS. Now, I'm considering switching to Whartfkit. How can I convert the code for transacting actions using Whartfkit? Will the process be similar?
`async function purchaseAndMintNFT(buyerAccount, nftData, price) {
try {
// Ensure we're connected to a wallet/API
if (!api) {
console.error('Not connected to the wallet/API.');
return;
}
}
`
`
//this sample code from Whartfkit, only has one action, instead of one action, can pass in {actions:[...], {
blocksBehind: 3,
expireSeconds: 30,
}} ??
async function transact() {
if (!session) {
throw new Error('Cannot transact without a session.')
}
const action = {
account: 'eosio.token',
name: 'transfer',
authorization: [session.permissionLevel],
data: {
from: session.actor,
to: 'abcabc111111',
quantity: '1.2000 EOS',
memo: 'Yay WharfKit! Thank you <3',
},
}
session.transact({ action }, { broadcast: true }).catch((e) => {
console.log('error caught in transact', e)
})
}
`
Beta Was this translation helpful? Give feedback.
All reactions