omnibtc / sui-amm-swap Goto Github PK
View Code? Open in Web Editor NEWThe first open source AMM swap on the Sui. @mystenLabs
License: Apache License 2.0
The first open source AMM swap on the Sui. @mystenLabs
License: Apache License 2.0
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'.
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)');
}
}
The calculation of LP token minted is incorrect. The issue will bring severe security bugs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.