import * as nearAPI from 'near-api-js'
import { contractName, networkId, keyPair, sender } from '../src/config'
import { signTransaction, sendTransaction, initRequirements } from '../src/modules';
const provider = new nearAPI.providers.JsonRpcProvider({
url: `https://rpc.${networkId}.near.org`
});
(async () => {
const { nonce, recentBlockHash } = await initRequirements({ provider, sender, publicKey: keyPair.getPublicKey() });
const actions = [nearAPI.transactions.functionCall('set_greeting', Buffer.from(JSON.stringify({text: 'hello from webview'})), 10000000000000, 0];
const signedTransaction = signTransaction({
actions,
nonce,
recentBlockHash,
sender,
contractName,
keyPair
})
const transaction = await sendTransaction(provider, signedTransaction);
console.log('transaction', transaction)
})()
-
Notifications
You must be signed in to change notification settings - Fork 1
tinwritescode/near-easy-transactions
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Make it easy to create and sign transactions.
Resources
Stars
Watchers
Forks
Packages 0
No packages published