@onflow/six-transfer-tokens-with-paths

0.2.1 • Public • Published

@onflow/six-transfer-tokens-with-paths

Stored Interaction for transferring tokens between accounts on Flow.

Status

  • Last Updated: April 9 2024
  • Stable: No
  • Risk of Breaking Change: Very High

Known Upcoming Changes:

  • Potential changes to all aspects of Stored Interactions

Install

npm install @onflow/six-transfer-tokens-with-paths

Configuration

To use this Stored Interaction, you must configure FCL with certain account addresses which contain contracts imported by this Stored Interaction.

Dependencies Mainnet Testnet
0xFUNGIBLETOKENADDRESS 0xf233dcee88fe0abe 0x9a0766d93b6608b7
0xFUNGIBLETOKENMETADATAVIEWS 0xf233dcee88fe0abe 0x9a0766d93b6608b7

Example (for mainnet):

fcl.config()
  .put("0xFUNGIBLETOKENMETADATAVIEWS", "0xf233dcee88fe0abe")
  .put("0xFUNGIBLETOKENADDRESS", "0xf233dcee88fe0abe")

Example (for testnet):

fcl.config()
  .put("0xFUNGIBLETOKENMETADATAVIEWS", "0x9a0766d93b6608b7")
  .put("0xFUNGIBLETOKENADDRESS", "0x9a0766d93b6608b7")

Usage:

import * as fcl from "@onflow/fcl"
import { template as transferTokens } from "@onflow/six-transfer-tokens-with-paths"

fcl.config().put("accessNode", "http://localhost:8080");

const response = await fcl.send([
    transferTokens({
        proposer: fcl.currentUser().authorization,
        authorization: fcl.currentUser().authorization,     
        payer: fcl.currentUser().authorization,             
        amount: "123.456",                                    // Amount as a String representing a Cadence UFix64
        to: "0xABC123DEF456"                                  // The Address of the Account to transfer tokens to.
        senderPathIdentifier: "path/to/vault",                // The storage path to the fungible token vault
        receiverPathIdentifier: "path/to/vault",              // The storage path to destination account's fungible token vault
    })
])

Hashing

Hashing Code:

    console.log(crypto.createHash('sha256').update(CODE, 'utf8').digest('hex'))

Dependents (0)

Package Sidebar

Install

npm i @onflow/six-transfer-tokens-with-paths

Homepage

onflow.org

Weekly Downloads

0

Version

0.2.1

License

Apache-2.0

Unpacked Size

153 kB

Total Files

16

Last publish

Collaborators

  • sisyphussmiling
  • bthaile
  • jribbink
  • nialexsan
  • han210
  • gregorggg
  • chasefleming
  • dapperj
  • gregsantos
  • dapper_labs
  • jeffreydoyle
  • harry.eth
  • turbolent_flow