GithubHelp home page GithubHelp logo

sui-amm-swap's People

Contributors

gguoss avatar icodezjb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sui-amm-swap's Issues

Cannot build the test_coins package

  • My trouble: after building and publishing the swap package successed, I replace the swap address in the test_coins package before building it
    Here is the error message after I ran sui move build

Failed to build Move modules: Unable to resolve packages for package 'test-coins'

Caused by:
0: Unable to resolve named address 'swap' in package 'test-coins' when resolving dependencies
1: Attempted to assign a different value '0x772151a95c203eada2d01329df5fa8a15875d670' to an a already-assigned named address '0x0'.

  • My machine:
    • Ubuntu 20.04
    • Sui version: devnet-19.0

TypeMismatch

I'm trying to call add_liquidity from swap package using Suiet SDK
Here is my error:

executeMoveCall failed Error: [WalletError] Transaction failed with the following error. Encountered error when calling RpcTxnDataSerialize for a moveCall transaction for address 37a1a8b0850cdf198a080055493fa9389b71f39b for transaction {
  "data": {
    "arguments": [
      "0xa662762f8ebca9088dffc8d126a44dbd80fbd599",
      "0xbd73e71a648e1d2f50053b44bb9f7af754e6bebd",
      "1",
      "0x9e642c2f781029b641b9556fac5e12e22b6f3bbd",
      "1"
    ],
    "function": "add_liquidity",
    "gasBudget": 10000,
    "module": "interface",
    "packageObjectId": "0xa860e91b9b57aa432f20b144474f0a15a5623d98",
    "typeArguments": [
      "0x2::sui::SUI",
      "0xa860e91b9b57aa432f20b144474f0a15a5623d98::coins::USDT"
    ]
  },
  "kind": "moveCall"
}: Error: RPC Error: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: EntryArgumentError(EntryArgumentError { argument_idx: 3, kind: TypeMismatch }), source: Some("Expected argument of type 0x2::coin::Coin<T1>, but found type 0x2::coin::Coin<0x95900dee7fcb5f139601998e2f5741928a0fd8bc::coins::USDT>") } }
    at Ws.signAndExecuteTransaction (index.js?eb37:10816:1)
    at async Object.eval [as signAndExecuteTransaction] (index.js?eb37:11139:66)
    at async handleAddLiquidity (VM325 App.tsx:121:29)

Here is my handleAddLiquidity method:

const handleAddLiquidity = async () => {
    const swapPackageObjectId = '0xa860e91b9b57aa432f20b144474f0a15a5623d98';
    const swapGlobalObjectId = '0xa662762f8ebca9088dffc8d126a44dbd80fbd599';
    const USDT_TYPE = `${swapPackageObjectId}::coins::USDT`;
    const SUI_TYPE = '0x2::sui::SUI';
    const suiCoinObjectId = '0xbd73e71a648e1d2f50053b44bb9f7af754e6bebd';
    const usdtCoinObjectId = '0x9e642c2f781029b641b9556fac5e12e22b6f3bbd';

    try {
      const data = {
        packageObjectId: swapPackageObjectId,
        module: 'interface',
        function: 'add_liquidity',
        typeArguments: [SUI_TYPE, USDT_TYPE],
        arguments: [
          swapGlobalObjectId,
          suiCoinObjectId,
          "1",
          usdtCoinObjectId,
          "1",
        ],
        gasBudget: 10000,
      };
      const resData = await wallet.signAndExecuteTransaction({
        transaction: {
          kind: 'moveCall',
          data,
        },
      });
      console.log('handleAddLiquidity success', resData);
      alert('handleAddLiquidity succeeded (see response in the console)');
    } catch (e) {
      console.error('executeMoveCall failed', e);
      alert('handleAddLiquidity failed (see response in the console)');
    }
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.