0xsquid / squid-sdk Goto Github PK
View Code? Open in Web Editor NEWExamples to interact with the Squid API
Examples to interact with the Squid API
We don't allow to check for approval using the SDK function if the user doesn't have enough funds in their account. This seems incorrect, we should return true or false, even if they don't have enough funds.
Error: Insufficient funds for account: 0x7dBd0F75aA91c757ae6564d41dd59669023D57a4 on chain 43114
at EvmHandler.validateTokenBalance (/Users/fig/code/squid/examples/V2/sdk/swapAvalancheUsdcToMoonbeam/node_modules/@0xsquid/sdk/src/handlers/evm/utils.ts:45:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async EvmHandler.validateBalance (/Users/fig/code/squid/examples/V2/sdk/swapAvalancheUsdcToMoonbeam/node_modules/@0xsquid/sdk/src/handlers/evm/index.ts:85:14)
at async EvmHandler.isRouteApproved (/Users/fig/code/squid/examples/V2/sdk/swapAvalancheUsdcToMoonbeam/node_modules/@0xsquid/sdk/src/handlers/evm/index.ts:194:20)
at async Squid.isRouteApproved (/Users/fig/code/squid/examples/V2/sdk/swapAvalancheUsdcToMoonbeam/node_modules/@0xsquid/sdk/src/index.ts:183:16)
Waiting for the debugger to disconnect...
error Command failed with exit code 1.
Add new test case in scripts for send only transaction
Continuation of this task https://docs.google.com/document/d/1eM_tP0Ct_DjhSTf9Rdq5_r8fwj0JfRhiSNCknab495Y/edit
Expose a method on the sdk called getAllBalances({ chainIds?: string[], cosmosAddress?: string, evmAddress?: string })
getAllCosmosBalances
not a stringWhich internally decides based on the argument passed if it's going to call to getAlllEvmBalances
or getAllCosmosBalances
The main idea of chainIds
argument is to allow only fetch balances given a chain, like by a single RPC I can get all token balances on ethereum
chainIds
is provided, then only get balances for the chainIds provided.chainIds
is not provided, get balance for all chains compatible with the addresses givenSending trades using the integration test framework does
not trigger a relay event using the axelar:local environment
this is a common problem for devs using our SDK. Partners are not used to developing cross chain and a simple error message to show this would save a lot of dev time.
Add a function to the SDK which checks if a signer is on the correct chain for a route, returning (isCorrectChainId: Boolean, message String)
const signerChainId = parseInt(await provider.send("eth_chainId", []), 16).toString();
if (signerChainId !== route.params.fromChain) {
// throw error "signer is on the wrong chain ID (${signerChainId}). Please use a signer on chain ID ${route.params.fromChain.chainId}"
}
The CHANGELOG.md
has duplicate entries and misordered commits. Some commits are incorrectly categorized under the wrong version.
CHANGELOG.md
accurately reflects git history, without duplicates, and with commits correctly categorized by version.Refer to CHANGELOG.md
.
A SDK user should be able to provide a partner tracking ID which is passed as header to the backend
for route and status requests
X-Squid-Partner-ID: your-unique-identifier
Frontend integration require the option to pass in a signer.
The current type definition require a wallet rather a signer.
modify the type to access both and handle the difference in accessing the address.
I have been integrating squid sdk swap into my react app... All are okay until executing route.
const { route } = await squid.getRoute({
toAddress: signer.address.toString(),
fromChain: fromToken.chainId.toString(),
fromToken: fromToken.address.toString(),
fromAmount: '10000000000000000',
toChain: toToken.chainId.toString(),
toToken: toToken.address.toString(),
slippage: 0.5,
});
// customContractCalls: [],
// enableExpress: false, // default is true on all chains except Ethereum
// receiveGasOnDestination: true,
// const _gasLimit = ethers.toBigInt(route.transactionRequest.gasLimit);
route.transactionRequest.gasLimit = parseInt(route.transactionRequest.gasLimit);
// console.log('gas', route.transactionRequest);
console.log('gas limit', typeof route.transactionRequest.gasLimit, route.transactionRequest.gasLimit);
console.log('Gonna execute', route);
try {
const executionSettings = {
setGasPrice: true,
};
const tx = await squid.executeRoute({
signer,
route,
executionSettings,
});
console.log('waiting tx');
const txReceipt = await tx.wait();
} catch (e) {
console.error('errror', e.message);
console.log(e);
}
Even tried converting the gasLimit into Number, BigInt, String manually.
TypeError: invalid BigNumberish value (argument="request.gasLimit", value={ "hex": "0x055b58", "type": "BigNumber" }, code=INVALID_ARGUMENT, version=6.7.0)
makeError errors.ts:678
assert errors.ts:702
assertArgument errors.ts:714
getBigInt maths.ts:113
copyRequest provider.ts:338
populate abstract-signer.ts:32
populateTransaction abstract-signer.ts:98
sendTransaction abstract-signer.ts:232
executeRoute index.ts:339
I was on a react (cra) v4 version which I migrated to V5 so that it was compatible with version 2.8.9 of @0xsquid/sdk.
Once react migration from v4 to "react-scripts": "5.0.1"
However I get this error after making all the changes advised in the documentation for the migration from V1 to V2 : Docs.
I initialize squid like this:
const squid = new Squid({ baseUrl: 'https://v2.api.squidrouter.com', integratorId: "My-key" });
With "ethers": "^5.7.2",
tokenList.jsx:38 Uncaught TypeError: 0xsquid_sdk_dist_types__WEBPACK_IMPORTED_MODULE_3_.Squid is not a constructor
Then when i change the version of "ethers" to "^6.7.1" like mention on the documentation i got those errors :
Uncaught Error: Cannot find module 'ethers/lib/utils.js'
at webpackMissingModule
Need help and more clarification on this error please.
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.