Skip to content

Commit

Permalink
v12.6.1: fix polygon rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Feb 15, 2024
1 parent 564afb5 commit abc4e14
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 113 deletions.
2 changes: 1 addition & 1 deletion dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/react-dialog-stack@8"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/react-shadow-dom@5"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/js-verify-signature-web@3"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-blockchains@9"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-blockchains@9.3.4"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-client@10"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/web3-tokens@10"></script>
<script crossorigin src="https://cdn.jsdelivr.net/npm/@depay/react-token-image@5"></script>
Expand Down
22 changes: 11 additions & 11 deletions dist/esm/index.bundle.js

Large diffs are not rendered by default.

88 changes: 49 additions & 39 deletions dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -29268,7 +29268,7 @@ const getConfiguration$1 = () =>{
return getWindow$1()._Web3ClientConfiguration
};

function _optionalChain$3$2(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; }
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;

Expand Down Expand Up @@ -29298,12 +29298,12 @@ class StaticJsonRpcBatchProvider$1 extends ethers.providers.JsonRpcProvider {
// on whether it was a success or error
chunk.forEach((inflightRequest, index) => {
const payload = result[index];
if (_optionalChain$3$2([payload, 'optionalAccess', _ => _.error])) {
if (_optionalChain$3$3([payload, 'optionalAccess', _ => _.error])) {
const error = new Error(payload.error.message);
error.code = payload.error.code;
error.data = payload.error.data;
inflightRequest.reject(error);
} else if(_optionalChain$3$2([payload, 'optionalAccess', _2 => _2.result])) {
} else if(_optionalChain$3$3([payload, 'optionalAccess', _2 => _2.result])) {
inflightRequest.resolve(payload.result);
} else {
inflightRequest.reject();
Expand Down Expand Up @@ -31091,7 +31091,7 @@ var findAccount = async ({ token, owner })=>{
return existingAccount
};

function _optionalChain$3$1(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; }
function _optionalChain$3$2(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 METADATA_ACCOUNT = 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s';

const METADATA_REPLACE = new RegExp('\u0000', 'g');
Expand Down Expand Up @@ -31120,8 +31120,8 @@ const getMetaData = async ({ blockchain, address })=> {
});

return {
name: _optionalChain$3$1([metaData, 'optionalAccess', _ => _.data, 'optionalAccess', _2 => _2.name, 'optionalAccess', _3 => _3.replace, 'call', _4 => _4(METADATA_REPLACE, '')]),
symbol: _optionalChain$3$1([metaData, 'optionalAccess', _5 => _5.data, 'optionalAccess', _6 => _6.symbol, 'optionalAccess', _7 => _7.replace, 'call', _8 => _8(METADATA_REPLACE, '')])
name: _optionalChain$3$2([metaData, 'optionalAccess', _ => _.data, 'optionalAccess', _2 => _2.name, 'optionalAccess', _3 => _3.replace, 'call', _4 => _4(METADATA_REPLACE, '')]),
symbol: _optionalChain$3$2([metaData, 'optionalAccess', _5 => _5.data, 'optionalAccess', _6 => _6.symbol, 'optionalAccess', _7 => _7.replace, 'call', _8 => _8(METADATA_REPLACE, '')])
}
};

Expand Down Expand Up @@ -33324,7 +33324,7 @@ let getBestPair = async({ tokenIn, tokenOut, amountIn, amountInMax, amountOut, a
return bestPair
};

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; }
function _optionalChain$3$1(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 blockchain$1 = Blockchains.solana;

// Replaces 11111111111111111111111111111111 with the wrapped token and implies wrapping.
Expand Down Expand Up @@ -33399,9 +33399,9 @@ let findPath$4 = async ({ tokenIn, tokenOut, amountIn, amountOut, amountInMax, a

// Add blockchain.wrapped.address to route path if things start or end with blockchain.currency.address
// because that actually reflects how things are routed in reality:
if(_optionalChain$3([path, 'optionalAccess', _ => _.length]) && path[0] == blockchain$1.currency.address) {
if(_optionalChain$3$1([path, 'optionalAccess', _ => _.length]) && path[0] == blockchain$1.currency.address) {
path.splice(1, 0, blockchain$1.wrapped.address);
} else if(_optionalChain$3([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == blockchain$1.currency.address) {
} else if(_optionalChain$3$1([path, 'optionalAccess', _2 => _2.length]) && path[path.length-1] == blockchain$1.currency.address) {
path.splice(path.length-1, 0, blockchain$1.wrapped.address);
}
return { path, exchangePath: getExchangePath$3({ path }) }
Expand Down Expand Up @@ -36394,6 +36394,7 @@ const getConfiguration = () =>{
return getWindow()._Web3ClientConfiguration
};

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;

Expand All @@ -36413,37 +36414,46 @@ class StaticJsonRpcBatchProvider extends ethers.providers.JsonRpcProvider {
}

requestChunk(chunk, endpoint) {

const request = chunk.map((inflight) => inflight.request);

return ethers.utils.fetchJson(endpoint, JSON.stringify(request))
.then((result) => {
// For each result, feed it to the correct Promise, depending
// on whether it was a success or error
chunk.forEach((inflightRequest, index) => {
const payload = result[index];
if (payload.error) {
const error = new Error(payload.error.message);
error.code = payload.error.code;
error.data = payload.error.data;
inflightRequest.reject(error);
}
else {
inflightRequest.resolve(payload.result);
}
});
}).catch((error) => {
if(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);
} else {
chunk.forEach((inflightRequest) => {
inflightRequest.reject(error);

try {

const request = chunk.map((inflight) => inflight.request);
return ethers.utils.fetchJson(endpoint, JSON.stringify(request))
.then((result) => {
// For each result, feed it to the correct Promise, depending
// on whether it was a success or error
chunk.forEach((inflightRequest, index) => {
const payload = result[index];
if (_optionalChain$3([payload, 'optionalAccess', _ => _.error])) {
const error = new Error(payload.error.message);
error.code = payload.error.code;
error.data = payload.error.data;
inflightRequest.reject(error);
} else if(_optionalChain$3([payload, 'optionalAccess', _2 => _2.result])) {
inflightRequest.resolve(payload.result);
} else {
inflightRequest.reject();
}
});
}
})
}).catch((error) => {
if(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);
} else {
chunk.forEach((inflightRequest) => {
inflightRequest.reject(error);
});
}
})

} catch (e) {

chunk.forEach((inflightRequest) => {
inflightRequest.reject();
});
}
}

send(method, params) {
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.solana.js.map

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions dist/umd/index.bundle.js

Large diffs are not rendered by default.

Loading

0 comments on commit abc4e14

Please sign in to comment.