@manifoldxyz/client-sdk 0.5.0-beta.0 → 0.5.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-jURQ4Jhn.cjs → ccip-B0gW2JrT.cjs} +2 -2
- package/dist/{ccip-jURQ4Jhn.cjs.map → ccip-B0gW2JrT.cjs.map} +1 -1
- package/dist/{ccip-5-UmS5Nc.js → ccip-MpHEV30S.js} +2 -2
- package/dist/{ccip-5-UmS5Nc.js.map → ccip-MpHEV30S.js.map} +1 -1
- package/dist/{index-BKAojZ8h.cjs → index-B_YusVFv.cjs} +147 -131
- package/dist/index-B_YusVFv.cjs.map +1 -0
- package/dist/{index-BYdwpw4H.js → index-BbztLoge.js} +147 -131
- package/dist/index-BbztLoge.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +17 -12
- package/dist/index-BKAojZ8h.cjs.map +0 -1
- package/dist/index-BYdwpw4H.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-B_YusVFv.cjs");
|
|
4
4
|
class OffchainLookupError extends index.BaseError {
|
|
5
5
|
constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
|
|
6
6
|
super(cause.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
@@ -158,4 +158,4 @@ exports.ccipRequest = ccipRequest;
|
|
|
158
158
|
exports.offchainLookup = offchainLookup;
|
|
159
159
|
exports.offchainLookupAbiItem = offchainLookupAbiItem;
|
|
160
160
|
exports.offchainLookupSignature = offchainLookupSignature;
|
|
161
|
-
//# sourceMappingURL=ccip-
|
|
161
|
+
//# sourceMappingURL=ccip-B0gW2JrT.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ccip-jURQ4Jhn.cjs","sources":["../../../node_modules/.pnpm/viem@2.38.5_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_esm/errors/ccip.js","../../../node_modules/.pnpm/viem@2.38.5_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_esm/utils/ccip.js"],"sourcesContent":["import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { localBatchGatewayRequest, localBatchGatewayUrl, } from './ens/localBatchGatewayRequest.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({\n data: callData,\n ccipRequest: ccipRequest_,\n })\n : await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map"],"names":["BaseError","getUrl","stringify","decodeErrorResult","isAddressEqual","localBatchGatewayUrl","localBatchGatewayRequest","call","concat","encodeAbiParameters","HttpRequestError","isHex"],"mappings":";;;AAGO,MAAM,4BAA4BA,MAAAA,UAAU;AAAA,EAC/C,YAAY,EAAE,kBAAkB,OAAO,MAAM,WAAW,QAAQ,QAAS;AACrE,UAAM,MAAM,gBACR,4DAA4D;AAAA,MAC5D;AAAA,MACA,cAAc;AAAA,QACV,GAAI,MAAM,gBAAgB;QAC1B,MAAM,cAAc,SAAS,KAAK,CAAA;AAAA,QAClC;AAAA,QACA,QAAQ;AAAA,UACJ;AAAA,UACA,GAAG,KAAK,IAAI,CAAC,QAAQ,OAAOC,MAAAA,OAAO,GAAG,CAAC,EAAE;AAAA,QAC7D;AAAA,QACgB,aAAa,MAAM;AAAA,QACnB,WAAW,IAAI;AAAA,QACf,wBAAwB,gBAAgB;AAAA,QACxC,iBAAiB,SAAS;AAAA,MAC1C,EAAc,KAAI;AAAA,MACN,MAAM;AAAA,IAClB,CAAS;AAAA,EACL;AACJ;AACO,MAAM,6CAA6CD,MAAAA,UAAU;AAAA,EAChE,YAAY,EAAE,QAAQ,OAAO;AACzB,UAAM,8EAA8E;AAAA,MAChF,cAAc;AAAA,QACV,gBAAgBC,MAAAA,OAAO,GAAG,CAAC;AAAA,QAC3B,aAA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IAAI;AACd,gBAAQ,IAAIC,MAAAA,iBAAiB;AAAA,UACzB;AAAA,UACA,SAAS,QAAQ,QACXR,MAAAA,UAAU,OAAO,KAAK,IACtB,SAAS;AAAA,UACf,SAAS,SAAS;AAAA,UAClB,QAAQ,SAAS;AAAA,UACjB;AAAA,QACpB,CAAiB;AACD;AAAA,MACJ;AACA,UAAI,CAACS,MAAAA,MAAM,MAAM,GAAG;AAChB,gBAAQ,IAAI,qCAAqC;AAAA,UAC7C;AAAA,UACA;AAAA,QACpB,CAAiB;AACD;AAAA,MACJ;AACA,aAAO;AAAA,IACX,SACO,KAAK;AACR,cAAQ,IAAID,MAAAA,iBAAiB;AAAA,QACzB;AAAA,QACA,SAAS,IAAI;AAAA,QACb;AAAA,MAChB,CAAa;AAAA,IACL;AAAA,EACJ;AACA,QAAM;AACV;;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"ccip-B0gW2JrT.cjs","sources":["../../../node_modules/.pnpm/viem@2.38.5_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_esm/errors/ccip.js","../../../node_modules/.pnpm/viem@2.38.5_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_esm/utils/ccip.js"],"sourcesContent":["import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { localBatchGatewayRequest, localBatchGatewayUrl, } from './ens/localBatchGatewayRequest.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({\n data: callData,\n ccipRequest: ccipRequest_,\n })\n : await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map"],"names":["BaseError","getUrl","stringify","decodeErrorResult","isAddressEqual","localBatchGatewayUrl","localBatchGatewayRequest","call","concat","encodeAbiParameters","HttpRequestError","isHex"],"mappings":";;;AAGO,MAAM,4BAA4BA,MAAAA,UAAU;AAAA,EAC/C,YAAY,EAAE,kBAAkB,OAAO,MAAM,WAAW,QAAQ,QAAS;AACrE,UAAM,MAAM,gBACR,4DAA4D;AA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QAAQ,KAAK;AAClC,UAAM,MAAM,KAAK,CAAC;AAClB,UAAM,SAAS,IAAI,SAAS,QAAQ,IAAI,QAAQ;AAChD,UAAM,OAAO,WAAW,SAAS,EAAE,MAAM,OAAM,IAAK;AACpD,UAAM,UAAU,WAAW,SAAS,EAAE,gBAAgB,mBAAkB,IAAK,CAAA;AAC7E,QAAI;AACA,YAAM,WAAW,MAAM,MAAM,IAAI,QAAQ,YAAY,OAAO,YAAW,CAAE,EAAE,QAAQ,UAAU,IAAI,GAAG;AAAA,QAChG,MAAM,KAAK,UAAU,IAAI;AAAA,QACzB;AAAA,QACA;AAAA,MAChB,CAAa;AACD,UAAI;AACJ,UAAI,SAAS,QAAQ,IAAI,cAAc,GAAG,WAAW,kBAAkB,GAAG;AACtE,kBAAU,MAAM,SAAS,KAAI,GAAI;AAAA,MACrC,OACK;AACD,iBAAU,MAAM,SAAS;MAC7B;AACA,UAAI,CAAC,SAAS,IAAI;AACd,gBAAQ,IAAIC,MAAAA,iBAAiB;AAAA,UACzB;AAAA,UACA,SAAS,QAAQ,QACXR,MAAAA,UAAU,OAAO,KAAK,IACtB,SAAS;AAAA,UACf,SAAS,SAAS;AAAA,UAClB,QAAQ,SAAS;AAAA,UACjB;AAAA,QACpB,CAAiB;AACD;AAAA,MACJ;AACA,UAAI,CAACS,MAAAA,MAAM,MAAM,GAAG;AAChB,gBAAQ,IAAI,qCAAqC;AAAA,UAC7C;AAAA,UACA;AAAA,QACpB,CAAiB;AACD;AAAA,MACJ;AACA,aAAO;AAAA,IACX,SACO,KAAK;AACR,cAAQ,IAAID,MAAAA,iBAAiB;AAAA,QACzB;AAAA,QACA,SAAS,IAAI;AAAA,QACb;AAAA,MAChB,CAAa;AAAA,IACL;AAAA,EACJ;AACA,QAAM;AACV;;;;;","x_google_ignoreList":[0,1]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseError, g as getUrl, s as stringify, d as decodeErrorResult, i as isAddressEqual, l as localBatchGatewayUrl, a as localBatchGatewayRequest, c as call, b as concat, e as encodeAbiParameters, H as HttpRequestError, f as isHex } from "./index-
|
|
1
|
+
import { B as BaseError, g as getUrl, s as stringify, d as decodeErrorResult, i as isAddressEqual, l as localBatchGatewayUrl, a as localBatchGatewayRequest, c as call, b as concat, e as encodeAbiParameters, H as HttpRequestError, f as isHex } from "./index-BbztLoge.js";
|
|
2
2
|
class OffchainLookupError extends BaseError {
|
|
3
3
|
constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
|
|
4
4
|
super(cause.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
@@ -158,4 +158,4 @@ export {
|
|
|
158
158
|
offchainLookupAbiItem,
|
|
159
159
|
offchainLookupSignature
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=ccip-
|
|
161
|
+
//# sourceMappingURL=ccip-MpHEV30S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ccip-
|
|
1
|
+
{"version":3,"file":"ccip-MpHEV30S.js","sources":["../../../node_modules/.pnpm/viem@2.38.5_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_esm/errors/ccip.js","../../../node_modules/.pnpm/viem@2.38.5_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_esm/utils/ccip.js"],"sourcesContent":["import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { localBatchGatewayRequest, localBatchGatewayUrl, } from './ens/localBatchGatewayRequest.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({\n data: callData,\n ccipRequest: ccipRequest_,\n })\n : await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map"],"names":[],"mappings":";AAGO,MAAM,4BAA4B,UAAU;AAAA,EAC/C,YAAY,EAAE,kBAAkB,OAAO,MAAM,WAAW,QAAQ,QAAS;AACrE,UAAM,MAAM,gBACR,4DAA4D;AAAA,MAC5D;AAAA,MACA,cAAc;AAAA,QACV,GAAI,MAAM,gBAAgB;QAC1B,MAAM,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AM,UAAU,WAAW,SAAS,EAAE,gBAAgB,mBAAkB,IAAK,CAAA;AAC7E,QAAI;AACA,YAAM,WAAW,MAAM,MAAM,IAAI,QAAQ,YAAY,OAAO,YAAW,CAAE,EAAE,QAAQ,UAAU,IAAI,GAAG;AAAA,QAChG,MAAM,KAAK,UAAU,IAAI;AAAA,QACzB;AAAA,QACA;AAAA,MAChB,CAAa;AACD,UAAI;AACJ,UAAI,SAAS,QAAQ,IAAI,cAAc,GAAG,WAAW,kBAAkB,GAAG;AACtE,kBAAU,MAAM,SAAS,KAAI,GAAI;AAAA,MACrC,OACK;AACD,iBAAU,MAAM,SAAS;MAC7B;AACA,UAAI,CAAC,SAAS,IAAI;AACd,gBAAQ,IAAI,iBAAiB;AAAA,UACzB;AAAA,UACA,SAAS,QAAQ,QACX,UAAU,OAAO,KAAK,IACtB,SAAS;AAAA,UACf,SAAS,SAAS;AAAA,UAClB,QAAQ,SAAS;AAAA,UACjB;AAAA,QACpB,CAAiB;AACD;AAAA,MACJ;AACA,UAAI,CAAC,MAAM,MAAM,GAAG;AAChB,gBAAQ,IAAI,qCAAqC;AAAA,UAC7C;AAAA,UACA;AAAA,QACpB,CAAiB;AACD;AAAA,MACJ;AACA,aAAO;AAAA,IACX,SACO,KAAK;AACR,cAAQ,IAAI,iBAAiB;AAAA,QACzB;AAAA,QACA,SAAS,IAAI;AAAA,QACb;AAAA,MAChB,CAAa;AAAA,IACL;AAAA,EACJ;AACA,QAAM;AACV;","x_google_ignoreList":[0,1]}
|
|
@@ -13026,6 +13026,7 @@ class BlindMintProduct {
|
|
|
13026
13026
|
const mintCost = {};
|
|
13027
13027
|
if (nativeCost) mintCost.native = nativeCost;
|
|
13028
13028
|
if (erc20Costs.length > 0) mintCost.erc20s = erc20Costs;
|
|
13029
|
+
const hasPendingApprovals = steps.some((s2) => s2.type === "approve");
|
|
13029
13030
|
const gasEstimate = await estimateGas$1({
|
|
13030
13031
|
publicProvider: this._publicProvider,
|
|
13031
13032
|
contractAddress: this._extensionAddress,
|
|
@@ -13034,7 +13035,8 @@ class BlindMintProduct {
|
|
|
13034
13035
|
args: [this._creatorContract, this.id, quantity],
|
|
13035
13036
|
from: user,
|
|
13036
13037
|
networkId,
|
|
13037
|
-
value: nativePaymentValue
|
|
13038
|
+
value: nativePaymentValue,
|
|
13039
|
+
fallbackGas: hasPendingApprovals ? 300000n : void 0
|
|
13038
13040
|
});
|
|
13039
13041
|
const mintStep = {
|
|
13040
13042
|
id: "mint",
|
|
@@ -13668,7 +13670,7 @@ class EditionProduct {
|
|
|
13668
13670
|
const gasLimit = this._applyGasBuffer(gasEstimate3, params.gasBuffer).toString();
|
|
13669
13671
|
const txRequest = {
|
|
13670
13672
|
to: tokenAddress,
|
|
13671
|
-
data: this._buildApprovalData(this._extensionAddress, totalCost.
|
|
13673
|
+
data: this._buildApprovalData(this._extensionAddress, totalCost.value.toString()),
|
|
13672
13674
|
gasLimit,
|
|
13673
13675
|
chainId: networkId
|
|
13674
13676
|
};
|
|
@@ -13730,6 +13732,7 @@ class EditionProduct {
|
|
|
13730
13732
|
if (nativeCost) mintCost.native = nativeCost;
|
|
13731
13733
|
if (erc20Costs.length > 0) mintCost.erc20s = erc20Costs;
|
|
13732
13734
|
const { mintIndices, merkleProofs } = await this._generateMintProofs(recipient, quantity);
|
|
13735
|
+
const hasPendingApprovals = steps.some((s2) => s2.type === "approve");
|
|
13733
13736
|
const gasEstimate = await estimateGas$1({
|
|
13734
13737
|
publicProvider: this._publicProvider,
|
|
13735
13738
|
contractAddress: this._extensionAddress,
|
|
@@ -13738,7 +13741,8 @@ class EditionProduct {
|
|
|
13738
13741
|
args: [this._creatorContract, this.id, quantity, mintIndices, merkleProofs, recipient],
|
|
13739
13742
|
from: user,
|
|
13740
13743
|
networkId,
|
|
13741
|
-
value: nativePaymentValue
|
|
13744
|
+
value: nativePaymentValue,
|
|
13745
|
+
fallbackGas: hasPendingApprovals ? 300000n : void 0
|
|
13742
13746
|
});
|
|
13743
13747
|
const mintData = this._buildMintData(
|
|
13744
13748
|
this._creatorContract,
|
|
@@ -20404,7 +20408,7 @@ async function call(client, args) {
|
|
|
20404
20408
|
return { data: response };
|
|
20405
20409
|
} catch (err) {
|
|
20406
20410
|
const data2 = getRevertErrorData(err);
|
|
20407
|
-
const { offchainLookup, offchainLookupSignature } = await Promise.resolve().then(() => require("./ccip-
|
|
20411
|
+
const { offchainLookup, offchainLookupSignature } = await Promise.resolve().then(() => require("./ccip-B0gW2JrT.cjs"));
|
|
20408
20412
|
if (client.ccipRead !== false && data2?.slice(0, 10) === offchainLookupSignature && to2)
|
|
20409
20413
|
return { data: await offchainLookup(client, { data: data2, to: to2 }) };
|
|
20410
20414
|
if (deploylessCall && data2?.slice(0, 10) === "0x101bb98d")
|
|
@@ -28505,129 +28509,6 @@ class ViemAccount {
|
|
|
28505
28509
|
return response;
|
|
28506
28510
|
}
|
|
28507
28511
|
}
|
|
28508
|
-
class ViemPublicProvider {
|
|
28509
|
-
/**
|
|
28510
|
-
* Initialize the public client with viem public client(s).
|
|
28511
|
-
*
|
|
28512
|
-
* @param publicClients - Map of network IDs to public clients (or arrays for fallback support)
|
|
28513
|
-
*/
|
|
28514
|
-
constructor(publicClients) {
|
|
28515
|
-
this.publicClients = new Map(
|
|
28516
|
-
Object.entries(publicClients).map(([networkId, client]) => [
|
|
28517
|
-
Number(networkId),
|
|
28518
|
-
Array.isArray(client) ? client : [client]
|
|
28519
|
-
])
|
|
28520
|
-
);
|
|
28521
|
-
}
|
|
28522
|
-
async executeWithFallback(networkId, operation) {
|
|
28523
|
-
const clientList = this.publicClients.get(networkId) || [];
|
|
28524
|
-
return executeWithProviderFallback({
|
|
28525
|
-
networkId,
|
|
28526
|
-
providers: clientList,
|
|
28527
|
-
getChainId: async (client) => {
|
|
28528
|
-
return await client.getChainId();
|
|
28529
|
-
},
|
|
28530
|
-
// Viem clients don't support network switching
|
|
28531
|
-
switchNetwork: void 0,
|
|
28532
|
-
operation
|
|
28533
|
-
});
|
|
28534
|
-
}
|
|
28535
|
-
/**
|
|
28536
|
-
* Get the balance of an address (native token or ERC20).
|
|
28537
|
-
*/
|
|
28538
|
-
async getBalance(params) {
|
|
28539
|
-
const { address, tokenAddress } = params;
|
|
28540
|
-
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28541
|
-
if (!tokenAddress || tokenAddress === "0x0000000000000000000000000000000000000000") {
|
|
28542
|
-
const balance = await getBalance$1(client, {
|
|
28543
|
-
address
|
|
28544
|
-
});
|
|
28545
|
-
return balance;
|
|
28546
|
-
} else {
|
|
28547
|
-
const balance = await readContract$1(client, {
|
|
28548
|
-
address: tokenAddress,
|
|
28549
|
-
abi: ERC20ABI,
|
|
28550
|
-
functionName: "balanceOf",
|
|
28551
|
-
args: [address]
|
|
28552
|
-
});
|
|
28553
|
-
return balance;
|
|
28554
|
-
}
|
|
28555
|
-
});
|
|
28556
|
-
}
|
|
28557
|
-
/**
|
|
28558
|
-
* Estimate gas for a contract function call.
|
|
28559
|
-
*/
|
|
28560
|
-
async estimateContractGas(params) {
|
|
28561
|
-
const { contractAddress, abi: abi2, functionName, args = [], from: from2, value } = params;
|
|
28562
|
-
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28563
|
-
const gasEstimate = await client.estimateContractGas({
|
|
28564
|
-
address: contractAddress,
|
|
28565
|
-
abi: abi2,
|
|
28566
|
-
functionName,
|
|
28567
|
-
args,
|
|
28568
|
-
account: from2,
|
|
28569
|
-
value
|
|
28570
|
-
});
|
|
28571
|
-
return gasEstimate;
|
|
28572
|
-
});
|
|
28573
|
-
}
|
|
28574
|
-
async subscribeToContractEvents(params) {
|
|
28575
|
-
const { contractAddress, abi: abi2, topics, callback } = params;
|
|
28576
|
-
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28577
|
-
const unwatch = client.watchContractEvent({
|
|
28578
|
-
address: contractAddress,
|
|
28579
|
-
abi: abi2,
|
|
28580
|
-
onLogs: (logs) => {
|
|
28581
|
-
for (const log of logs) {
|
|
28582
|
-
if (log.topics.length < topics.length) continue;
|
|
28583
|
-
let matches = true;
|
|
28584
|
-
for (let i = 0; i < topics.length; i++) {
|
|
28585
|
-
if (log.topics[i] !== topics[i]) {
|
|
28586
|
-
matches = false;
|
|
28587
|
-
break;
|
|
28588
|
-
}
|
|
28589
|
-
}
|
|
28590
|
-
if (matches) {
|
|
28591
|
-
callback(log);
|
|
28592
|
-
}
|
|
28593
|
-
}
|
|
28594
|
-
}
|
|
28595
|
-
});
|
|
28596
|
-
return unwatch;
|
|
28597
|
-
});
|
|
28598
|
-
}
|
|
28599
|
-
/**
|
|
28600
|
-
* Read data from a contract (call a view/pure function).
|
|
28601
|
-
*/
|
|
28602
|
-
async readContract(params) {
|
|
28603
|
-
const { contractAddress, abi: abi2, functionName, args = [] } = params;
|
|
28604
|
-
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28605
|
-
const result = await readContract$1(client, {
|
|
28606
|
-
address: contractAddress,
|
|
28607
|
-
abi: abi2,
|
|
28608
|
-
functionName,
|
|
28609
|
-
args
|
|
28610
|
-
});
|
|
28611
|
-
return result;
|
|
28612
|
-
});
|
|
28613
|
-
}
|
|
28614
|
-
}
|
|
28615
|
-
function createAccount(provider) {
|
|
28616
|
-
return new ViemAccount(provider);
|
|
28617
|
-
}
|
|
28618
|
-
const viemAdapter = createAccount;
|
|
28619
|
-
function createPublicProvider$1(config) {
|
|
28620
|
-
return new ViemPublicProvider(config);
|
|
28621
|
-
}
|
|
28622
|
-
function getAction(client, actionFn, name) {
|
|
28623
|
-
const action_implicit = client[actionFn.name];
|
|
28624
|
-
if (typeof action_implicit === "function")
|
|
28625
|
-
return action_implicit;
|
|
28626
|
-
const action_explicit = client[name];
|
|
28627
|
-
if (typeof action_explicit === "function")
|
|
28628
|
-
return action_explicit;
|
|
28629
|
-
return (params) => actionFn(client, params);
|
|
28630
|
-
}
|
|
28631
28512
|
function parseSiweMessage(message) {
|
|
28632
28513
|
const { scheme, statement, ...prefix } = message.match(prefixRegex)?.groups ?? {};
|
|
28633
28514
|
const { chainId, expirationTime, issuedAt, notBefore, requestId, ...suffix } = message.match(suffixRegex)?.groups ?? {};
|
|
@@ -28754,6 +28635,141 @@ function publicActions(client) {
|
|
|
28754
28635
|
watchPendingTransactions: (args) => watchPendingTransactions(client, args)
|
|
28755
28636
|
};
|
|
28756
28637
|
}
|
|
28638
|
+
function normalizeAbi(abi2) {
|
|
28639
|
+
return abi2.map((item) => {
|
|
28640
|
+
if (typeof item === "string") {
|
|
28641
|
+
try {
|
|
28642
|
+
return parseAbiItem(item);
|
|
28643
|
+
} catch {
|
|
28644
|
+
return item;
|
|
28645
|
+
}
|
|
28646
|
+
}
|
|
28647
|
+
return item;
|
|
28648
|
+
});
|
|
28649
|
+
}
|
|
28650
|
+
class ViemPublicProvider {
|
|
28651
|
+
/**
|
|
28652
|
+
* Initialize the public client with viem public client(s).
|
|
28653
|
+
*
|
|
28654
|
+
* @param publicClients - Map of network IDs to public clients (or arrays for fallback support)
|
|
28655
|
+
*/
|
|
28656
|
+
constructor(publicClients) {
|
|
28657
|
+
this.publicClients = new Map(
|
|
28658
|
+
Object.entries(publicClients).map(([networkId, client]) => [
|
|
28659
|
+
Number(networkId),
|
|
28660
|
+
Array.isArray(client) ? client : [client]
|
|
28661
|
+
])
|
|
28662
|
+
);
|
|
28663
|
+
}
|
|
28664
|
+
async executeWithFallback(networkId, operation) {
|
|
28665
|
+
const clientList = this.publicClients.get(networkId) || [];
|
|
28666
|
+
return executeWithProviderFallback({
|
|
28667
|
+
networkId,
|
|
28668
|
+
providers: clientList,
|
|
28669
|
+
getChainId: async (client) => {
|
|
28670
|
+
return await client.getChainId();
|
|
28671
|
+
},
|
|
28672
|
+
// Viem clients don't support network switching
|
|
28673
|
+
switchNetwork: void 0,
|
|
28674
|
+
operation
|
|
28675
|
+
});
|
|
28676
|
+
}
|
|
28677
|
+
/**
|
|
28678
|
+
* Get the balance of an address (native token or ERC20).
|
|
28679
|
+
*/
|
|
28680
|
+
async getBalance(params) {
|
|
28681
|
+
const { address, tokenAddress } = params;
|
|
28682
|
+
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28683
|
+
if (!tokenAddress || tokenAddress === "0x0000000000000000000000000000000000000000") {
|
|
28684
|
+
const balance = await getBalance$1(client, {
|
|
28685
|
+
address
|
|
28686
|
+
});
|
|
28687
|
+
return balance;
|
|
28688
|
+
} else {
|
|
28689
|
+
const balance = await readContract$1(client, {
|
|
28690
|
+
address: tokenAddress,
|
|
28691
|
+
abi: ERC20ABI,
|
|
28692
|
+
functionName: "balanceOf",
|
|
28693
|
+
args: [address]
|
|
28694
|
+
});
|
|
28695
|
+
return balance;
|
|
28696
|
+
}
|
|
28697
|
+
});
|
|
28698
|
+
}
|
|
28699
|
+
/**
|
|
28700
|
+
* Estimate gas for a contract function call.
|
|
28701
|
+
*/
|
|
28702
|
+
async estimateContractGas(params) {
|
|
28703
|
+
const { contractAddress, abi: abi2, functionName, args = [], from: from2, value } = params;
|
|
28704
|
+
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28705
|
+
const gasEstimate = await client.estimateContractGas({
|
|
28706
|
+
address: contractAddress,
|
|
28707
|
+
abi: normalizeAbi(abi2),
|
|
28708
|
+
functionName,
|
|
28709
|
+
args,
|
|
28710
|
+
account: from2,
|
|
28711
|
+
value
|
|
28712
|
+
});
|
|
28713
|
+
return gasEstimate;
|
|
28714
|
+
});
|
|
28715
|
+
}
|
|
28716
|
+
async subscribeToContractEvents(params) {
|
|
28717
|
+
const { contractAddress, abi: abi2, topics, callback } = params;
|
|
28718
|
+
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28719
|
+
const unwatch = client.watchContractEvent({
|
|
28720
|
+
address: contractAddress,
|
|
28721
|
+
abi: normalizeAbi(abi2),
|
|
28722
|
+
onLogs: (logs) => {
|
|
28723
|
+
for (const log of logs) {
|
|
28724
|
+
if (log.topics.length < topics.length) continue;
|
|
28725
|
+
let matches = true;
|
|
28726
|
+
for (let i = 0; i < topics.length; i++) {
|
|
28727
|
+
if (log.topics[i] !== topics[i]) {
|
|
28728
|
+
matches = false;
|
|
28729
|
+
break;
|
|
28730
|
+
}
|
|
28731
|
+
}
|
|
28732
|
+
if (matches) {
|
|
28733
|
+
callback(log);
|
|
28734
|
+
}
|
|
28735
|
+
}
|
|
28736
|
+
}
|
|
28737
|
+
});
|
|
28738
|
+
return unwatch;
|
|
28739
|
+
});
|
|
28740
|
+
}
|
|
28741
|
+
/**
|
|
28742
|
+
* Read data from a contract (call a view/pure function).
|
|
28743
|
+
*/
|
|
28744
|
+
async readContract(params) {
|
|
28745
|
+
const { contractAddress, abi: abi2, functionName, args = [] } = params;
|
|
28746
|
+
return this.executeWithFallback(params.networkId, async (client) => {
|
|
28747
|
+
const result = await readContract$1(client, {
|
|
28748
|
+
address: contractAddress,
|
|
28749
|
+
abi: normalizeAbi(abi2),
|
|
28750
|
+
functionName,
|
|
28751
|
+
args
|
|
28752
|
+
});
|
|
28753
|
+
return result;
|
|
28754
|
+
});
|
|
28755
|
+
}
|
|
28756
|
+
}
|
|
28757
|
+
function createAccount(provider) {
|
|
28758
|
+
return new ViemAccount(provider);
|
|
28759
|
+
}
|
|
28760
|
+
const viemAdapter = createAccount;
|
|
28761
|
+
function createPublicProvider$1(config) {
|
|
28762
|
+
return new ViemPublicProvider(config);
|
|
28763
|
+
}
|
|
28764
|
+
function getAction(client, actionFn, name) {
|
|
28765
|
+
const action_implicit = client[actionFn.name];
|
|
28766
|
+
if (typeof action_implicit === "function")
|
|
28767
|
+
return action_implicit;
|
|
28768
|
+
const action_explicit = client[name];
|
|
28769
|
+
if (typeof action_explicit === "function")
|
|
28770
|
+
return action_explicit;
|
|
28771
|
+
return (params) => actionFn(client, params);
|
|
28772
|
+
}
|
|
28757
28773
|
function getUnit(unit) {
|
|
28758
28774
|
if (typeof unit === "number")
|
|
28759
28775
|
return unit;
|
|
@@ -28988,7 +29004,7 @@ class WagmiPublicProvider {
|
|
|
28988
29004
|
}
|
|
28989
29005
|
const gasEstimate = await client.estimateContractGas({
|
|
28990
29006
|
address: contractAddress,
|
|
28991
|
-
abi: abi2,
|
|
29007
|
+
abi: normalizeAbi(abi2),
|
|
28992
29008
|
functionName,
|
|
28993
29009
|
args,
|
|
28994
29010
|
account: from2,
|
|
@@ -29010,7 +29026,7 @@ class WagmiPublicProvider {
|
|
|
29010
29026
|
try {
|
|
29011
29027
|
const result = await readContract(this.config, {
|
|
29012
29028
|
address: contractAddress,
|
|
29013
|
-
abi: abi2,
|
|
29029
|
+
abi: normalizeAbi(abi2),
|
|
29014
29030
|
functionName,
|
|
29015
29031
|
args,
|
|
29016
29032
|
chainId: networkId
|
|
@@ -29032,7 +29048,7 @@ class WagmiPublicProvider {
|
|
|
29032
29048
|
}
|
|
29033
29049
|
const unwatch = watchContractEvent(this.config, {
|
|
29034
29050
|
address: contractAddress,
|
|
29035
|
-
abi: abi2,
|
|
29051
|
+
abi: normalizeAbi(abi2),
|
|
29036
29052
|
onLogs: (logs) => {
|
|
29037
29053
|
for (const log of logs) {
|
|
29038
29054
|
if (log.topics.length < topics.length) continue;
|
|
@@ -29112,4 +29128,4 @@ exports.localBatchGatewayRequest = localBatchGatewayRequest;
|
|
|
29112
29128
|
exports.localBatchGatewayUrl = localBatchGatewayUrl;
|
|
29113
29129
|
exports.stringify = stringify$1;
|
|
29114
29130
|
exports.viemAdapter = viemAdapter;
|
|
29115
|
-
//# sourceMappingURL=index-
|
|
29131
|
+
//# sourceMappingURL=index-B_YusVFv.cjs.map
|