Fireblocks XRPL Raw Signing scripts for the following scenarios:
-
Set "Require tag" and "Domain" configurations on your XRP wallet
-
Set TrustLine in XRP
-
Set Authorization required for trustline
-
Approve trustline request (only relevant after setting authorization)
-
Move IOU tokens out of your Fireblocks vault
-
Mint a new Non-fungible Token (NFToken)
-
Clone the repository:
git clone https://github.com/fireblocks/xrp-tools/ cd xrp_tools
-
Install Node dependencies:
yarn install
Or
npm i
-
Rename
.env.example
to.env
and set environment variables used across each tool:FIREBLOCKS_API_KEY= # Fireblocks API key FIREBLOCKS_PATH_TO_API_SECRET_KEY= # Path to Fireblocks API secret key (RSA) FIREBLOCKS_VAULT_ACCOUNT_ID= # Fireblocks Vault Account ID for the XRP source address ASSET_ID=XRP # Fireblocks XRPL asset ID RIPPLE_RPC_URL=wss://xrplcluster.com # XRPL RPC URL. See https://xrpl.org/public-servers.html
-
Modify variables in code depending on the script you want to run.
After running a script, sign the raw signing operation in your Fireblocks Mobile app or an API Co-signer. Make sure the console output includes:
Explorer: https://livenet.xrpl.org/transactions/<some_hash>
Result: {
resultCode: 'tesSUCCESS',
resultMessage: 'The transaction was applied. Only final in a validated ledger.',
tx_json: {
hash: '<some_hash>'
}
}
Check the transaction's hash in the XRP block explorer, and make sure that the transaction was executed successfully.
Edit scripts/setDestTag.ts
:
DOMAIN: The domain name that owns this account
Run:
yarn setDestTag
Run:
yarn trustline
Or
npm run trustline
Run:
yarn setAuthTrustline
Or
npm run setAuthTrustline
Run:
yarn approveTrustLine
Or
npm run approveTrustLine
Edit scripts/transferTokens.ts
:
DESTINATION: Destination address. Make sure that the Trust Line is set on the destination address
AMOUNT: Amount you wish to move (string) OR null for the entire balance
Note: When moving the entire balance of the token, there might be a chance of an insignificant token leftover in the wallet.
Run:
yarn transferTokens
Or
npm run transferTokens
Edit scripts/nftMint.ts
:
URI: The URI of the NFT
Run:
yarn nftMint
Or
npm run nftMint
Since XRP transactions require LastLedgerSequence
as a part of the transaction's body, when using Raw Signing it is limited for a quite short period of time (up to 2 mins), which means that the transaction should be submitted immediately after signing. Waiting for longer signing time will result in unsuccessful transaction broadcasting.