How to use the stellar-sdk.Operation.changeTrust function in stellar-sdk

To help you get started, we’ve selected a few stellar-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github satoshipay / solar / src / components / Dialog / ManageAssets.tsx View on Github external
const addAsset = async (asset: Asset, options: { limit?: string } = {}) => {
    try {
      const operations = [Operation.changeTrust({ asset, limit: options.limit })]
      const transaction = await createTransaction(operations, {
        accountData,
        horizon: props.horizon,
        walletAccount: props.account
      })
      props.sendTransaction(transaction)
    } catch (error) {
      trackError(error)
    }
  }
github pakokrew / stellar-portal / app / js / helpers / StellarOperations.js View on Github external
export const changeTrust = ({ asset, limit }, authData) => {
  try {
    const trustLimit = (isNumber(limit) || isString(limit)) ? AmountInstance(limit) : undefined;
    const operation = Operation.changeTrust({
      asset: AssetInstance(asset),
      limit: trustLimit,
    });

    return sendTransaction(authData, { operation });
  } catch (e) {
    return Promise.reject(e);
  }
};
github satoshipay / solar / src / components / AccountAssets / AssetDetailsActions.tsx View on Github external
const createAddAssetTransaction = async (options: { limit?: string } = {}) => {
    const operations = [Operation.changeTrust({ asset, limit: options.limit })]
    return createTransaction(operations, {
      accountData,
      horizon: props.horizon,
      walletAccount: props.account
    })
  }
github satoshipay / solar / src / components / AccountAssets / RemoveTrustline.tsx View on Github external
const removeAsset = async () => {
    try {
      const operations = [Operation.changeTrust({ asset: props.asset, limit: "0" })]
      const transaction = await createTransaction(operations, {
        accountData: props.accountData,
        horizon: props.horizon,
        walletAccount: props.account
      })
      props.sendTransaction(transaction)
    } catch (error) {
      trackError(error)
    }
  }
github satoshipay / solar / src / components / AccountAssets / AddAssetDialog.tsx View on Github external
const createAddAssetTransaction = async (asset: Asset, options: { limit?: string } = {}) => {
    const operations = [Operation.changeTrust({ asset, limit: options.limit })]
    return createTransaction(operations, {
      accountData: props.accountData,
      horizon: props.horizon,
      walletAccount: props.account
    })
  }
github satoshipay / solar / stories / TransactionReviewDialog.tsx View on Github external
const promise = (async () => {
      const account = await testnetHorizon.loadAccount("GBPBFWVBADSESGADWEGC7SGTHE3535FWK4BS6UW3WMHX26PHGIH5NF4W")
      return buildTransaction(account, [
        Operation.changeTrust({
          asset: eurt
        })
      ])
    })()