Skip to content

Commit

Permalink
upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Jul 6, 2024
1 parent a8e4cfb commit cfa85c4
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 53 deletions.
20 changes: 10 additions & 10 deletions dist/esm/index.bundle.js

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -29386,7 +29386,7 @@ const getConfiguration$1 = () =>{
function _optionalChain$3$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
const BATCH_INTERVAL$1$1 = 10;
const CHUNK_SIZE$1$1 = 99;
const MAX_RETRY$1 = 3;
const MAX_RETRY$1$1 = 3;

class StaticJsonRpcBatchProvider$1 extends ethers.providers.JsonRpcProvider {

Expand Down Expand Up @@ -29426,7 +29426,7 @@ class StaticJsonRpcBatchProvider$1 extends ethers.providers.JsonRpcProvider {
}
});
}).catch((error) => {
if(attempt < MAX_RETRY$1 && error && error.code == 'SERVER_ERROR') {
if(attempt < MAX_RETRY$1$1 && error && error.code == 'SERVER_ERROR') {
const index = this._endpoints.indexOf(this._endpoint)+1;
this._failover();
this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index];
Expand Down Expand Up @@ -33405,6 +33405,7 @@ const getPrice = async ({
// This method is cached and is only to be used to generally existing pools every 24h
// Do not use for price calulations, fetch accounts for pools individually in order to calculate price
let getAccounts = async (base, quote) => {
if(quote === Blockchains.solana.wrapped.address) { return [] } // WSOL is base not QUOTE!
let accounts = await request(`solana://whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc/getProgramAccounts`, {
params: { filters: [
{ dataSize: WHIRLPOOL_LAYOUT.span },
Expand Down Expand Up @@ -35327,12 +35328,22 @@ const getBestPool = async ({ blockchain, exchange, path, amountIn, amountOut, bl
let amount;
if(amountIn) {
amount = await getOutputAmount({ exchange, pool, inputAmount: amountIn });
const amountScaled = await getOutputAmount({ exchange, pool, inputAmount: amountIn.mul(ethers.BigNumber.from(10)) });
const amountScaledDown = amountScaled.div(ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.BigNumber.from(100)));
if(!enoughLiquidity) { return }
} else {
amount = await getInputAmount({ exchange, pool, outputAmount: amountOut });
const amountScaled = await getInputAmount({ exchange, pool, outputAmount: amountOut.mul(ethers.BigNumber.from(10)) });
const amountScaledDown = amountScaled.div(ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.BigNumber.from(100)));
if(!enoughLiquidity) { return }
}

return { ...pool, amountIn: amountIn || amount, amountOut: amountOut || amount }
} catch (e) {}
} catch(e) {console.log('!!!', e);}

}))).filter(Boolean);

Expand Down Expand Up @@ -36543,6 +36554,7 @@ const getConfiguration = () =>{
function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
const BATCH_INTERVAL$1 = 10;
const CHUNK_SIZE$1 = 99;
const MAX_RETRY$1 = 3;

class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {

Expand All @@ -36559,7 +36571,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
return Promise.resolve(Blockchains.findByName(this._network).id)
}

requestChunk(chunk, endpoint) {
requestChunk(chunk, endpoint, attempt) {

try {

Expand All @@ -36582,11 +36594,11 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
}
});
}).catch((error) => {
if(error && error.code == 'SERVER_ERROR') {
if(attempt < MAX_RETRY$1 && error && error.code == 'SERVER_ERROR') {
const index = this._endpoints.indexOf(this._endpoint)+1;
this._failover();
this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index];
this.requestChunk(chunk, this._endpoint);
this.requestChunk(chunk, this._endpoint, attempt+1);
} else {
chunk.forEach((inflightRequest) => {
inflightRequest.reject(error);
Expand Down Expand Up @@ -36640,7 +36652,7 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
chunks.forEach((chunk)=>{
// Get the request as an array of requests
chunk.map((inflight) => inflight.request);
return this.requestChunk(chunk, this._endpoint)
return this.requestChunk(chunk, this._endpoint, 1)
});
}, getConfiguration().batchInterval || BATCH_INTERVAL$1);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.solana.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/umd/index.bundle.js

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions dist/umd/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -29384,7 +29384,7 @@
function _optionalChain$3$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
const BATCH_INTERVAL$1$1 = 10;
const CHUNK_SIZE$1$1 = 99;
const MAX_RETRY$1 = 3;
const MAX_RETRY$1$1 = 3;

class StaticJsonRpcBatchProvider$1 extends ethers.ethers.providers.JsonRpcProvider {

Expand Down Expand Up @@ -29424,7 +29424,7 @@
}
});
}).catch((error) => {
if(attempt < MAX_RETRY$1 && error && error.code == 'SERVER_ERROR') {
if(attempt < MAX_RETRY$1$1 && error && error.code == 'SERVER_ERROR') {
const index = this._endpoints.indexOf(this._endpoint)+1;
this._failover();
this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index];
Expand Down Expand Up @@ -33403,6 +33403,7 @@
// This method is cached and is only to be used to generally existing pools every 24h
// Do not use for price calulations, fetch accounts for pools individually in order to calculate price
let getAccounts = async (base, quote) => {
if(quote === Blockchains__default['default'].solana.wrapped.address) { return [] } // WSOL is base not QUOTE!
let accounts = await request(`solana://whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc/getProgramAccounts`, {
params: { filters: [
{ dataSize: WHIRLPOOL_LAYOUT.span },
Expand Down Expand Up @@ -35325,12 +35326,22 @@
let amount;
if(amountIn) {
amount = await getOutputAmount({ exchange, pool, inputAmount: amountIn });
const amountScaled = await getOutputAmount({ exchange, pool, inputAmount: amountIn.mul(ethers.ethers.BigNumber.from(10)) });
const amountScaledDown = amountScaled.div(ethers.ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.ethers.BigNumber.from(100)));
if(!enoughLiquidity) { return }
} else {
amount = await getInputAmount({ exchange, pool, outputAmount: amountOut });
const amountScaled = await getInputAmount({ exchange, pool, outputAmount: amountOut.mul(ethers.ethers.BigNumber.from(10)) });
const amountScaledDown = amountScaled.div(ethers.ethers.BigNumber.from(10));
const difference = amountScaledDown.sub(amount).abs();
const enoughLiquidity = !difference.gt(amount.div(ethers.ethers.BigNumber.from(100)));
if(!enoughLiquidity) { return }
}

return { ...pool, amountIn: amountIn || amount, amountOut: amountOut || amount }
} catch (e) {}
} catch(e) {console.log('!!!', e);}

}))).filter(Boolean);

Expand Down Expand Up @@ -36541,6 +36552,7 @@
function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
const BATCH_INTERVAL$1 = 10;
const CHUNK_SIZE$1 = 99;
const MAX_RETRY$1 = 3;

class StaticJsonRpcBatchProvider extends ethers.ethers.providers.JsonRpcProvider {

Expand All @@ -36557,7 +36569,7 @@
return Promise.resolve(Blockchains__default['default'].findByName(this._network).id)
}

requestChunk(chunk, endpoint) {
requestChunk(chunk, endpoint, attempt) {

try {

Expand All @@ -36580,11 +36592,11 @@
}
});
}).catch((error) => {
if(error && error.code == 'SERVER_ERROR') {
if(attempt < MAX_RETRY$1 && error && error.code == 'SERVER_ERROR') {
const index = this._endpoints.indexOf(this._endpoint)+1;
this._failover();
this._endpoint = index >= this._endpoints.length ? this._endpoints[0] : this._endpoints[index];
this.requestChunk(chunk, this._endpoint);
this.requestChunk(chunk, this._endpoint, attempt+1);
} else {
chunk.forEach((inflightRequest) => {
inflightRequest.reject(error);
Expand Down Expand Up @@ -36638,7 +36650,7 @@
chunks.forEach((chunk)=>{
// Get the request as an array of requests
chunk.map((inflight) => inflight.request);
return this.requestChunk(chunk, this._endpoint)
return this.requestChunk(chunk, this._endpoint, 1)
});
}, getConfiguration().batchInterval || BATCH_INTERVAL$1);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.solana.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.evm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/widgets-evm",
"moduleName": "DePayWidgets",
"version": "12.10.10",
"version": "12.10.11",
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand Down Expand Up @@ -31,8 +31,8 @@
"@depay/web3-assets-evm": "^7.3.1",
"@depay/web3-blockchains": "^9.4.2",
"@depay/web3-client-evm": "^10.18.7",
"@depay/web3-exchanges-evm": "^13.8.1",
"@depay/web3-payments-evm": "^13.8.0",
"@depay/web3-exchanges-evm": "^13.8.3",
"@depay/web3-payments-evm": "^13.9.1",
"@depay/web3-tokens-evm": "^10.3.0",
"@depay/web3-wallets-evm": "^17.1.0",
"@tanstack/react-virtual": "^3.0.0-beta.54",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/widgets",
"moduleName": "DePayWidgets",
"version": "12.10.10",
"version": "12.10.11",
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand Down Expand Up @@ -45,8 +45,8 @@
"@depay/web3-assets": "^7.3.1",
"@depay/web3-blockchains": "^9.4.2",
"@depay/web3-client": "^10.18.7",
"@depay/web3-exchanges": "^13.8.1",
"@depay/web3-payments": "^13.8.0",
"@depay/web3-exchanges": "^13.8.3",
"@depay/web3-payments": "^13.9.1",
"@depay/web3-tokens": "^10.3.0",
"@depay/web3-wallets": "^17.1.0",
"@tanstack/react-virtual": "^3.0.0-beta.54",
Expand Down
6 changes: 3 additions & 3 deletions package.solana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@depay/widgets-solana",
"moduleName": "DePayWidgets",
"version": "12.10.10",
"version": "12.10.11",
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
"main": "./dist/umd/index.js",
"module": "./dist/esm/index.js",
Expand Down Expand Up @@ -32,8 +32,8 @@
"@depay/web3-assets-solana": "^7.3.1",
"@depay/web3-blockchains": "^9.4.2",
"@depay/web3-client-solana": "^10.18.7",
"@depay/web3-exchanges-solana": "^13.8.1",
"@depay/web3-payments-solana": "^13.8.0",
"@depay/web3-exchanges-solana": "^13.8.3",
"@depay/web3-payments-solana": "^13.9.1",
"@depay/web3-tokens-solana": "^10.3.0",
"@depay/web3-wallets-solana": "^17.1.0",
"@tanstack/react-virtual": "^3.0.0-beta.54",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1357,10 +1357,10 @@
resolved "https://registry.yarnpkg.com/@depay/web3-client/-/web3-client-10.18.7.tgz#b9131383d680c616e8485fad54c79ed8e33dbe03"
integrity sha512-5XsYPAbGZ91P7RLrRuZvSY0d2JT2NsUFIJHXf0YfzJQacy1gIuqQwUU7nMq+niL42AfvCqQ7wOAnP9tQcByXzw==

"@depay/web3-exchanges@^13.8.1":
version "13.8.1"
resolved "https://registry.yarnpkg.com/@depay/web3-exchanges/-/web3-exchanges-13.8.1.tgz#8c422320811f65fd521081759522c7862b030321"
integrity sha512-tNX/iCL45PsRKfF8pFTvBQ7WR158QiwFTfljChhC/9JL0QF9W5dkWAodoC33AvOOuiQg5ljUUf223QMsBbV1Tw==
"@depay/web3-exchanges@^13.8.3":
version "13.8.3"
resolved "https://registry.yarnpkg.com/@depay/web3-exchanges/-/web3-exchanges-13.8.3.tgz#6e62b30b5f7960d9bd70526343144162684ed792"
integrity sha512-t5XIx/uhV7eu7WuWcoBI0rx7y1qwEZMfOLjYt4gYdYzuybA+FZeBr44zCG8Fn0kDBDe3Uv7LS0d8/PMRbCyCxg==

"@depay/web3-mock@^14.17.0":
version "14.17.0"
Expand All @@ -1371,10 +1371,10 @@
"@depay/web3-blockchains" "^9.1.4"
ethers "^5.7.1"

"@depay/web3-payments@^13.8.0":
version "13.8.0"
resolved "https://registry.yarnpkg.com/@depay/web3-payments/-/web3-payments-13.8.0.tgz#4621990549f213507db26d97b055de86e6d313bc"
integrity sha512-PzouUhmVYUzrH40TjT1SlQq2HELKMHTnazryav/rr38CHkaR1UbriVHBgRAfOmnrcox1kSvQqyTooUEoi3rf0A==
"@depay/web3-payments@^13.9.1":
version "13.9.1"
resolved "https://registry.yarnpkg.com/@depay/web3-payments/-/web3-payments-13.9.1.tgz#20f7c2c75676a6aa14ef72601458a84d4c1c44cb"
integrity sha512-+Q/U86GHeUy7fYtthz5Kk9sufQoWgYJuM/PxOJJPYWCF8jnVOu9WBkjV2dQ2sbq2HNElHml74VUMhN/aqkNSCg==

"@depay/web3-tokens@^10.3.0":
version "10.3.0"
Expand Down

0 comments on commit cfa85c4

Please sign in to comment.