From 24b077d3baa298419041e62a1699ef4a2761e0bf Mon Sep 17 00:00:00 2001 From: Aaron Cook Date: Wed, 30 Oct 2024 08:04:09 +0100 Subject: [PATCH 1/3] Add EIP-5792 support to Safe Apps Provider --- .changeset/wicked-coins-suffer.md | 5 ++ packages/safe-apps-provider/dist/provider.js | 53 ++++++++++++++- .../safe-apps-provider/dist/provider.js.map | 2 +- packages/safe-apps-provider/dist/utils.d.ts | 1 + packages/safe-apps-provider/dist/utils.js | 6 +- packages/safe-apps-provider/dist/utils.js.map | 2 +- packages/safe-apps-provider/src/provider.ts | 68 ++++++++++++++++++- packages/safe-apps-provider/src/utils.ts | 4 ++ 8 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 .changeset/wicked-coins-suffer.md diff --git a/.changeset/wicked-coins-suffer.md b/.changeset/wicked-coins-suffer.md new file mode 100644 index 00000000..07f62fd0 --- /dev/null +++ b/.changeset/wicked-coins-suffer.md @@ -0,0 +1,5 @@ +--- +'@safe-global/safe-apps-provider': patch +--- + +Add EIP-5792 support diff --git a/packages/safe-apps-provider/dist/provider.js b/packages/safe-apps-provider/dist/provider.js index 1b17d96c..2fc31e92 100644 --- a/packages/safe-apps-provider/dist/provider.js +++ b/packages/safe-apps-provider/dist/provider.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SafeAppProvider = void 0; +const safe_apps_sdk_1 = require("@safe-global/safe-apps-sdk"); const events_1 = require("events"); const utils_1 = require("./utils"); // The API is based on Ethereum JavaScript API Provider Standard. Link: https://eips.ethereum.org/EIPS/eip-1193 @@ -29,7 +30,7 @@ class SafeAppProvider extends events_1.EventEmitter { return [this.safe.safeAddress]; case 'net_version': case 'eth_chainId': - return `0x${this.chainId.toString(16)}`; + return (0, utils_1.numberToHex)(this.chainId); case 'personal_sign': { const [message, address] = params; if (this.safe.safeAddress.toLowerCase() !== address.toLowerCase()) { @@ -155,6 +156,56 @@ class SafeAppProvider extends events_1.EventEmitter { return this.sdk.wallet.requestPermissions(params[0]); case 'safe_setSettings': return this.sdk.eth.setSafeSettings([params[0]]); + case 'wallet_getCallsStatus': { + const CallStatus = { + [safe_apps_sdk_1.TransactionStatus.AWAITING_CONFIRMATIONS]: 'PENDING', + [safe_apps_sdk_1.TransactionStatus.AWAITING_EXECUTION]: 'PENDING', + [safe_apps_sdk_1.TransactionStatus.CANCELLED]: 'CONFIRMED', + [safe_apps_sdk_1.TransactionStatus.FAILED]: 'CONFIRMED', + [safe_apps_sdk_1.TransactionStatus.SUCCESS]: 'CONFIRMED', + }; + const tx = await this.sdk.txs.getBySafeTxHash(params[0]).catch(() => null); + if (!tx?.txHash) { + throw new Error('Transaction not found'); + } + const receipt = await this.sdk.eth.getTransactionReceipt([tx.txHash]).catch(() => null); + if (!receipt) { + throw new Error('Transaction receipt not found'); + } + const calls = tx.txData?.dataDecoded?.method !== 'multiSend' + ? 1 + : // Number of batched transactions + tx.txData.dataDecoded.parameters?.[0].valueDecoded?.length ?? 1; + // Typed as number; is hex + const blockNumber = Number(receipt.blockNumber); + const gasUsed = Number(receipt.gasUsed); + const receipts = Array(calls).fill({ + success: (0, utils_1.numberToHex)(tx.txStatus === safe_apps_sdk_1.TransactionStatus.SUCCESS ? 1 : 0), + blockHash: receipt.blockHash, + blockNumber: (0, utils_1.numberToHex)(blockNumber), + blockTimestamp: (0, utils_1.numberToHex)(tx.executedAt ?? 0), + gasUsed: (0, utils_1.numberToHex)(gasUsed), + transactionHash: tx.txHash, + logs: receipt.logs, + }); + return { + status: CallStatus[tx.txStatus], + receipts, + }; + } + case 'wallet_showCallsStatus': { + // Cannot open transaction details page via SDK + throw new Error(`"${request.method}" not supported`); + } + case 'wallet_getCapabilities': { + return { + [(0, utils_1.numberToHex)(this.chainId)]: { + atomicBatch: { + supported: true, + }, + }, + }; + } default: throw Error(`"${request.method}" not implemented`); } diff --git a/packages/safe-apps-provider/dist/provider.js.map b/packages/safe-apps-provider/dist/provider.js.map index 75bfe5e9..721af9f5 100644 --- a/packages/safe-apps-provider/dist/provider.js.map +++ b/packages/safe-apps-provider/dist/provider.js.map @@ -1 +1 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":";;;AACA,mCAAsC;AAEtC,mCAAuC;AAEvC,+GAA+G;AAC/G,MAAa,eAAgB,SAAQ,qBAAY;IAK/C,YAAY,IAAc,EAAE,GAAgB;QAC1C,KAAK,EAAE,CAAC;QAHF,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO;IACT,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,OAAO,CAAC,OAA2C;QACvD,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAExC,QAAQ,MAAM,EAAE;YACd,KAAK,cAAc;gBACjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEjC,KAAK,aAAa,CAAC;YACnB,KAAK,aAAa;gBAChB,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YAE1C,KAAK,eAAe,CAAC,CAAC;gBACpB,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;gBAElC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,EAAE;oBACjE,MAAM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C,IAAI,OAAO,CAAC,MAAM,iBAAiB,CAAC,CAAC;aACtD;YAED,KAAK,wBAAwB,CAAC,CAAC;gBAC7B,OAAO;oBACL,CAAC,IAAA,mBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;wBAC3B,WAAW,EAAE;4BACX,SAAS,EAAE,IAAI;yBAChB;qBACF;iBACF,CAAC;aACH;YAED;gBACE,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,mBAAmB,CAAC,CAAC;SACtD;IACH,CAAC;IAED,sCAAsC;IACtC,iIAAiI;IACjI,IAAI,CAAC,OAAY,EAAE,QAA8C;QAC/D,IAAI,CAAC,OAAO;YAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;aAClB,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;aAC5E,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AA1QD,0CA0QC"} \ No newline at end of file diff --git a/packages/safe-apps-provider/dist/utils.d.ts b/packages/safe-apps-provider/dist/utils.d.ts index c60dd7a8..30b30a96 100644 --- a/packages/safe-apps-provider/dist/utils.d.ts +++ b/packages/safe-apps-provider/dist/utils.d.ts @@ -1 +1,2 @@ export declare function getLowerCase(value: string): string; +export declare function numberToHex(value: number): `0x${string}`; diff --git a/packages/safe-apps-provider/dist/utils.js b/packages/safe-apps-provider/dist/utils.js index 422ad96b..9ea2f13d 100644 --- a/packages/safe-apps-provider/dist/utils.js +++ b/packages/safe-apps-provider/dist/utils.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getLowerCase = void 0; +exports.numberToHex = exports.getLowerCase = void 0; function getLowerCase(value) { if (value) { return value.toLowerCase(); @@ -8,4 +8,8 @@ function getLowerCase(value) { return value; } exports.getLowerCase = getLowerCase; +function numberToHex(value) { + return `0x${value.toString(16)}`; +} +exports.numberToHex = numberToHex; //# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/packages/safe-apps-provider/dist/utils.js.map b/packages/safe-apps-provider/dist/utils.js.map index 0e21bec9..30d8fa03 100644 --- a/packages/safe-apps-provider/dist/utils.js.map +++ b/packages/safe-apps-provider/dist/utils.js.map @@ -1 +1 @@ -{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,KAAa;IACxC,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;KAC5B;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oCAKC"} \ No newline at end of file +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,KAAa;IACxC,IAAI,KAAK,EAAE;QACT,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC;KAC5B;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oCAKC;AAED,SAAgB,WAAW,CAAC,KAAa;IACvC,OAAO,KAAK,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AACnC,CAAC;AAFD,kCAEC"} \ No newline at end of file diff --git a/packages/safe-apps-provider/src/provider.ts b/packages/safe-apps-provider/src/provider.ts index 01cee58e..72ccdc39 100644 --- a/packages/safe-apps-provider/src/provider.ts +++ b/packages/safe-apps-provider/src/provider.ts @@ -1,7 +1,7 @@ -import SafeAppsSDK, { SafeInfo, Web3TransactionObject } from '@safe-global/safe-apps-sdk'; +import SafeAppsSDK, { SafeInfo, TransactionStatus, Web3TransactionObject } from '@safe-global/safe-apps-sdk'; import { EventEmitter } from 'events'; import { EIP1193Provider } from './types'; -import { getLowerCase } from './utils'; +import { getLowerCase, numberToHex } from './utils'; // The API is based on Ethereum JavaScript API Provider Standard. Link: https://eips.ethereum.org/EIPS/eip-1193 export class SafeAppProvider extends EventEmitter implements EIP1193Provider { @@ -38,7 +38,7 @@ export class SafeAppProvider extends EventEmitter implements EIP1193Provider { case 'net_version': case 'eth_chainId': - return `0x${this.chainId.toString(16)}`; + return numberToHex(this.chainId); case 'personal_sign': { const [message, address] = params; @@ -195,6 +195,68 @@ export class SafeAppProvider extends EventEmitter implements EIP1193Provider { case 'safe_setSettings': return this.sdk.eth.setSafeSettings([params[0]]); + case 'wallet_getCallsStatus': { + const CallStatus: { + [key in TransactionStatus]: 'PENDING' | 'CONFIRMED'; + } = { + [TransactionStatus.AWAITING_CONFIRMATIONS]: 'PENDING', + [TransactionStatus.AWAITING_EXECUTION]: 'PENDING', + [TransactionStatus.CANCELLED]: 'CONFIRMED', + [TransactionStatus.FAILED]: 'CONFIRMED', + [TransactionStatus.SUCCESS]: 'CONFIRMED', + }; + + const tx = await this.sdk.txs.getBySafeTxHash(params[0]).catch(() => null); + if (!tx?.txHash) { + throw new Error('Transaction not found'); + } + + const receipt = await this.sdk.eth.getTransactionReceipt([tx.txHash]).catch(() => null); + if (!receipt) { + throw new Error('Transaction receipt not found'); + } + + const calls = + tx.txData?.dataDecoded?.method !== 'multiSend' + ? 1 + : // Number of batched transactions + tx.txData.dataDecoded.parameters?.[0].valueDecoded?.length ?? 1; + + // Typed as number; is hex + const blockNumber = Number(receipt.blockNumber); + const gasUsed = Number(receipt.gasUsed); + + const receipts = Array(calls).fill({ + success: numberToHex(tx.txStatus === TransactionStatus.SUCCESS ? 1 : 0), + blockHash: receipt.blockHash, + blockNumber: numberToHex(blockNumber), + blockTimestamp: numberToHex(tx.executedAt ?? 0), + gasUsed: numberToHex(gasUsed), + transactionHash: tx.txHash, + logs: receipt.logs, + }); + + return { + status: CallStatus[tx.txStatus], + receipts, + }; + } + + case 'wallet_showCallsStatus': { + // Cannot open transaction details page via SDK + throw new Error(`"${request.method}" not supported`); + } + + case 'wallet_getCapabilities': { + return { + [numberToHex(this.chainId)]: { + atomicBatch: { + supported: true, + }, + }, + }; + } + default: throw Error(`"${request.method}" not implemented`); } diff --git a/packages/safe-apps-provider/src/utils.ts b/packages/safe-apps-provider/src/utils.ts index b1bdc24a..956f2bf4 100644 --- a/packages/safe-apps-provider/src/utils.ts +++ b/packages/safe-apps-provider/src/utils.ts @@ -4,3 +4,7 @@ export function getLowerCase(value: string): string { } return value; } + +export function numberToHex(value: number): `0x${string}` { + return `0x${value.toString(16)}`; +} From f21870d94ffd06e8a121777550c2360f680cee94 Mon Sep 17 00:00:00 2001 From: Aaron Cook Date: Wed, 30 Oct 2024 13:08:24 +0100 Subject: [PATCH 2/3] Add `wallet_sendCalls` support --- packages/safe-apps-provider/dist/provider.js | 17 ++++++++++++++ .../safe-apps-provider/dist/provider.js.map | 2 +- packages/safe-apps-provider/src/provider.ts | 22 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/packages/safe-apps-provider/dist/provider.js b/packages/safe-apps-provider/dist/provider.js index 2fc31e92..a9d48eed 100644 --- a/packages/safe-apps-provider/dist/provider.js +++ b/packages/safe-apps-provider/dist/provider.js @@ -156,6 +156,23 @@ class SafeAppProvider extends events_1.EventEmitter { return this.sdk.wallet.requestPermissions(params[0]); case 'safe_setSettings': return this.sdk.eth.setSafeSettings([params[0]]); + case 'wallet_sendCalls': { + if (params[0].from !== this.safe.safeAddress) { + throw Error('Invalid from address'); + } + const txs = params[0].calls.map((call) => { + if (call.chainId !== (0, utils_1.numberToHex)(this.chainId) || !call.to) { + throw new Error('Invalid call'); + } + return { + to: call.to, + data: call.data ?? '0x', + value: call.value ?? (0, utils_1.numberToHex)(0), + }; + }); + const { safeTxHash } = await this.sdk.txs.send({ txs }); + return safeTxHash; + } case 'wallet_getCallsStatus': { const CallStatus = { [safe_apps_sdk_1.TransactionStatus.AWAITING_CONFIRMATIONS]: 'PENDING', diff --git a/packages/safe-apps-provider/dist/provider.js.map b/packages/safe-apps-provider/dist/provider.js.map index 721af9f5..f7cfc909 100644 --- a/packages/safe-apps-provider/dist/provider.js.map +++ b/packages/safe-apps-provider/dist/provider.js.map @@ -1 +1 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":";;;AAAA,8DAA6G;AAC7G,mCAAsC;AAEtC,mCAAoD;AAEpD,+GAA+G;AAC/G,MAAa,eAAgB,SAAQ,qBAAY;IAK/C,YAAY,IAAc,EAAE,GAAgB;QAC1C,KAAK,EAAE,CAAC;QAHF,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO;IACT,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,OAAO,CAAC,OAA2C;QACvD,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;QAExC,QAAQ,MAAM,EAAE;YACd,KAAK,cAAc;gBACjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAEjC,KAAK,aAAa,CAAC;YACnB,KAAK,aAAa;gBAChB,OAAO,IAAA,mBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEnC,KAAK,eAAe,CAAC,CAAC;gBACpB,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC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AI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;aAC5E,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAhSD,0CAgSC"} \ No newline at end of file diff --git a/packages/safe-apps-provider/src/provider.ts b/packages/safe-apps-provider/src/provider.ts index 72ccdc39..10b9dfe7 100644 --- a/packages/safe-apps-provider/src/provider.ts +++ b/packages/safe-apps-provider/src/provider.ts @@ -195,6 +195,28 @@ export class SafeAppProvider extends EventEmitter implements EIP1193Provider { case 'safe_setSettings': return this.sdk.eth.setSafeSettings([params[0]]); + case 'wallet_sendCalls': { + if (params[0].from !== this.safe.safeAddress) { + throw Error('Invalid from address'); + } + + const txs = params[0].calls.map( + (call: { to?: `0x${string}`; data?: `0x${string}`; value?: `0x${string}`; chainId?: `0x${string}` }) => { + if (call.chainId !== numberToHex(this.chainId) || !call.to) { + throw new Error('Invalid call'); + } + return { + to: call.to, + data: call.data ?? '0x', + value: call.value ?? numberToHex(0), + }; + }, + ); + + const { safeTxHash } = await this.sdk.txs.send({ txs }); + return safeTxHash; + } + case 'wallet_getCallsStatus': { const CallStatus: { [key in TransactionStatus]: 'PENDING' | 'CONFIRMED'; From c3ab8181e8a18c52b1f5fbaa13f78e1e5ec0b292 Mon Sep 17 00:00:00 2001 From: Aaron Cook Date: Wed, 30 Oct 2024 19:13:59 +0100 Subject: [PATCH 3/3] Improve error messages --- packages/safe-apps-provider/dist/provider.js | 9 ++++++--- packages/safe-apps-provider/dist/provider.js.map | 2 +- packages/safe-apps-provider/src/provider.ts | 12 +++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/safe-apps-provider/dist/provider.js b/packages/safe-apps-provider/dist/provider.js index a9d48eed..198eacfd 100644 --- a/packages/safe-apps-provider/dist/provider.js +++ b/packages/safe-apps-provider/dist/provider.js @@ -160,9 +160,12 @@ class SafeAppProvider extends events_1.EventEmitter { if (params[0].from !== this.safe.safeAddress) { throw Error('Invalid from address'); } - const txs = params[0].calls.map((call) => { - if (call.chainId !== (0, utils_1.numberToHex)(this.chainId) || !call.to) { - throw new Error('Invalid call'); + const txs = params[0].calls.map((call, i) => { + if (call.chainId !== (0, utils_1.numberToHex)(this.chainId)) { + throw new Error(`Invalid call #${i}: Safe is not on chain ${call.chainId}`); + } + if (!call.to) { + throw new Error(`Invalid call #${i}: missing "to" field`); } return { to: call.to, diff --git a/packages/safe-apps-provider/dist/provider.js.map b/packages/safe-apps-provider/dist/provider.js.map index f7cfc909..7388760a 100644 --- a/packages/safe-apps-provider/dist/provider.js.map +++ b/packages/safe-apps-provider/dist/provider.js.map @@ -1 +1 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":";;;AAAA,8DAA6G;AAC7G,mCAAsC;AAEtC,mCAAoD;AAEpD,+GAA+G;AAC/G,MAAa,eAAgB,SAAQ,qBAAY;IAK/C,YAAY,IAAc,EAAE,GAAgB;QAC1C,KAAK,EAAE,CAAC;QAHF,iBAAY,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI9D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO;IACT,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3B,CAAC;IAED,8DAA8D;IAC9D,KAAK,CAAC,OAAO,CAAC,OAA2C;QACvD,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EA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AAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;aAC5E,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAtSD,0CAsSC"} \ No newline at end of file diff --git a/packages/safe-apps-provider/src/provider.ts b/packages/safe-apps-provider/src/provider.ts index 10b9dfe7..4cb3baf4 100644 --- a/packages/safe-apps-provider/src/provider.ts +++ b/packages/safe-apps-provider/src/provider.ts @@ -201,9 +201,15 @@ export class SafeAppProvider extends EventEmitter implements EIP1193Provider { } const txs = params[0].calls.map( - (call: { to?: `0x${string}`; data?: `0x${string}`; value?: `0x${string}`; chainId?: `0x${string}` }) => { - if (call.chainId !== numberToHex(this.chainId) || !call.to) { - throw new Error('Invalid call'); + ( + call: { to?: `0x${string}`; data?: `0x${string}`; value?: `0x${string}`; chainId?: `0x${string}` }, + i: number, + ) => { + if (call.chainId !== numberToHex(this.chainId)) { + throw new Error(`Invalid call #${i}: Safe is not on chain ${call.chainId}`); + } + if (!call.to) { + throw new Error(`Invalid call #${i}: missing "to" field`); } return { to: call.to,