aacoimbra

updated transaction

Dec 29th, 2023
1,550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. const fcl = require("@onflow/fcl");
  2. const misc = require('./utils/misc');
  3. const templates = require('./utils/flow_templates');
  4. const t = require("@onflow/types");
  5.  
  6. import { promises as fsPromises } from 'fs';
  7.  
  8. misc.configFcl('emulator');
  9.  
  10. export default async function main() {
  11.  
  12.     const accounts = JSON.parse(
  13.         await fsPromises.readFile('accounts.json', 'utf8'),
  14.     );
  15.  
  16.     await fcl.config().put('system.contracts.BBCollectables', accounts.admin.address)  
  17.  
  18.  
  19.     const admin = {
  20.         address: accounts.admin.address,
  21.         publicKey: accounts.admin.keys.public,
  22.         privateKey: accounts.admin.keys.private,
  23.         keyIndex: 0,
  24.     };
  25.  
  26.     const user = {
  27.         address: accounts.userAccount1.address,
  28.         publicKey: accounts.userAccount1.keys.public,
  29.         privateKey: accounts.userAccount1.keys.private,
  30.         keyIndex: 0,
  31.     };
  32.  
  33.     const args: any = [
  34.         fcl.arg("1", t.UInt32),
  35.         fcl.arg("1", t.UInt32),
  36.     ];
  37.  
  38.     const txId = await templates.simpleTransactionBuilder(admin, [admin, user], admin, 'mint_card', args);
  39.  
  40.     const viralatTransaction = await fcl.tx(txId).onceExecuted();
  41.  
  42.     // console.log(viralatTransaction)
  43. };
  44.  
  45. main()
  46.     .then((text) => console.log(text))
  47.     .catch((error) => console.log(error));
  48.  
Advertisement
Add Comment
Please, Sign In to add comment