Interaction with the XRP Ledger
Last updated
const res = await provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:xrpl-snap',
request: {
method: 'xrpl_request',
params: {
command: 'account_info',
account: 'rYourXRPAccountHere',
},
},
},
})
console.log(res.account_data.Balance);
console.log(res.account_data.OwnerCount);
provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:xrpl-snap',
request: {
method: 'xrpl_signAndSubmit',
params: {
TransactionType: 'Payment',
Account: 'rYourXRPAccountHere', // The Snap's XRP account
Destination: 'rRecipientXRPAccountHere',
Amount: '1000000', // 1 XRP in drops
},
},
},
})provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:xrpl-snap',
request: {
method: 'xrpl_signAndSubmit',
params: {
TransactionType: 'TrustSet',
Account: 'rYourXRPAccountHere',
LimitAmount: {
currency: 'TOKEN', // Add the currency of the Token fe. USD
issuer: 'rIssuerAccountHere',
value: '1000', // Maximum amount of the token you can hold
},
},
},
},
})provider.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:xrpl-snap',
request: {
method: 'xrpl_signAndSubmit',
params: {
TransactionType: 'Payment',
Account: 'rYourXRPAccountHere',
Destination: 'rRecipientXRPAccountHere',
Amount: {
currency: 'TOKEN',
value: '10', // Number of tokens to send
issuer: 'rIssuerAccountHere',
},
},
},
},
})