From 746f2470190c3e9769bf97b6244b8f299f708970 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:03:56 +0200 Subject: [PATCH] Version Packages (#581) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Docs: fix regex syntax in SDK examples (#579) * Feat extended safe info (#580) api-kit’s getSafeInfo endpoint returns way more information than our communicator’s getInfo endpoint. This causes some dapps to use the getInfo endpoint for just the readOnly flag (when running in an iframe) and then to do api-kit getSafeInfo for the nonce and other props. By returning nearly the same information from the getInfo endpoint we make developers live easier. * Version Packages --------- Co-authored-by: katspaugh <381895+katspaugh@users.noreply.github.com> Co-authored-by: Daniel Dimitrov Co-authored-by: github-actions[bot] --- packages/safe-apps-sdk/CHANGELOG.md | 6 + packages/safe-apps-sdk/README.md | 2 +- .../safe-apps-sdk/dist/cjs/safe/index.d.ts | 4 +- .../safe-apps-sdk/dist/cjs/types/sdk.d.ts | 8 + .../safe-apps-sdk/dist/cjs/types/sdk.js.map | 2 +- .../safe-apps-sdk/dist/esm/safe/index.d.ts | 4 +- .../safe-apps-sdk/dist/esm/safe/index.js.map | 2 +- .../safe-apps-sdk/dist/esm/types/sdk.d.ts | 8 + .../safe-apps-sdk/dist/esm/types/sdk.js.map | 2 +- .../safe-apps-sdk/dist/types/safe/index.d.ts | 4 +- .../dist/types/safe/index.d.ts.map | 2 +- .../safe-apps-sdk/dist/types/types/sdk.d.ts | 8 + .../dist/types/types/sdk.d.ts.map | 2 +- packages/safe-apps-sdk/package.json | 2 +- packages/safe-apps-sdk/src/safe/index.ts | 6 +- packages/safe-apps-sdk/src/safe/safe.test.ts | 148 ++++-------------- packages/safe-apps-sdk/src/txs/txs.test.ts | 14 +- packages/safe-apps-sdk/src/types/sdk.ts | 9 ++ packages/safe-apps-web3modal/CHANGELOG.md | 7 + packages/safe-apps-web3modal/package.json | 6 +- yarn.lock | 6 +- 21 files changed, 98 insertions(+), 154 deletions(-) diff --git a/packages/safe-apps-sdk/CHANGELOG.md b/packages/safe-apps-sdk/CHANGELOG.md index fab7c636..ea6338d5 100644 --- a/packages/safe-apps-sdk/CHANGELOG.md +++ b/packages/safe-apps-sdk/CHANGELOG.md @@ -1,5 +1,11 @@ # @safe-global/safe-apps-sdk +## 9.1.0 + +### Minor Changes + +- a811ac6: safe.getInfo() endpoint should return extended safe information similar to api-kit's getSafeInfo endpoint + ## 9.0.0 ### Major Changes diff --git a/packages/safe-apps-sdk/README.md b/packages/safe-apps-sdk/README.md index f836efc1..e1864660 100644 --- a/packages/safe-apps-sdk/README.md +++ b/packages/safe-apps-sdk/README.md @@ -54,7 +54,7 @@ type Opts = { }; const opts: Opts = { - allowedDomains: [/app.safe.global$/], + allowedDomains: [/^app\.safe\.global$/], debug: false, }; diff --git a/packages/safe-apps-sdk/dist/cjs/safe/index.d.ts b/packages/safe-apps-sdk/dist/cjs/safe/index.d.ts index af277f40..1c9bfea0 100644 --- a/packages/safe-apps-sdk/dist/cjs/safe/index.d.ts +++ b/packages/safe-apps-sdk/dist/cjs/safe/index.d.ts @@ -1,9 +1,9 @@ -import { Communicator, SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData } from '../types/index.js'; +import { Communicator, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData, SafeInfoExtended } from '../types/index.js'; declare class Safe { private readonly communicator; constructor(communicator: Communicator); getChainInfo(): Promise; - getInfo(): Promise; + getInfo(): Promise; experimental_getBalances({ currency }?: GetBalanceParams): Promise; private check1271Signature; private check1271SignatureBytes; diff --git a/packages/safe-apps-sdk/dist/cjs/types/sdk.d.ts b/packages/safe-apps-sdk/dist/cjs/types/sdk.d.ts index af4aa765..4d602805 100644 --- a/packages/safe-apps-sdk/dist/cjs/types/sdk.d.ts +++ b/packages/safe-apps-sdk/dist/cjs/types/sdk.d.ts @@ -61,6 +61,14 @@ export type SafeInfo = { owners: string[]; isReadOnly: boolean; }; +export type SafeInfoExtended = SafeInfo & { + nonce: number; + implementation: string; + modules: string[] | null; + fallbackHandler: string | null; + guard: string | null; + version: string | null; +}; export type EnvironmentInfo = { origin: string; }; diff --git a/packages/safe-apps-sdk/dist/cjs/types/sdk.js.map b/packages/safe-apps-sdk/dist/cjs/types/sdk.js.map index e3310d04..64992f56 100644 --- a/packages/safe-apps-sdk/dist/cjs/types/sdk.js.map +++ b/packages/safe-apps-sdk/dist/cjs/types/sdk.js.map @@ -1 +1 @@ -{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":";;;AA4FO,MAAM,uBAAuB,GAAG,CAAC,GAAa,EAA0B,EAAE;IAC/E,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AACzG,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC"} \ No newline at end of file +{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":";;;AAqGO,MAAM,uBAAuB,GAAG,CAAC,GAAa,EAA0B,EAAE;IAC/E,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AACzG,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC"} \ No newline at end of file diff --git a/packages/safe-apps-sdk/dist/esm/safe/index.d.ts b/packages/safe-apps-sdk/dist/esm/safe/index.d.ts index af277f40..1c9bfea0 100644 --- a/packages/safe-apps-sdk/dist/esm/safe/index.d.ts +++ b/packages/safe-apps-sdk/dist/esm/safe/index.d.ts @@ -1,9 +1,9 @@ -import { Communicator, SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData } from '../types/index.js'; +import { Communicator, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData, SafeInfoExtended } from '../types/index.js'; declare class Safe { private readonly communicator; constructor(communicator: Communicator); getChainInfo(): Promise; - getInfo(): Promise; + getInfo(): Promise; experimental_getBalances({ currency }?: GetBalanceParams): Promise; private check1271Signature; private check1271SignatureBytes; diff --git a/packages/safe-apps-sdk/dist/esm/safe/index.js.map b/packages/safe-apps-sdk/dist/esm/safe/index.js.map index a177e43f..77fad3dd 100644 --- a/packages/safe-apps-sdk/dist/esm/safe/index.js.map +++ b/packages/safe-apps-sdk/dist/esm/safe/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/safe/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAW,WAAW,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAUL,uBAAuB,GAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,MAAM,qCAAqC,CAAC;AAEpE,MAAM,IAAI;IAGR,YAAY,YAA0B;QACpC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAC3C,OAAO,CAAC,YAAY,EACpB,SAAS,CACV,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAC3C,O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,KAAK,CAAC,kBAAkB;QACtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAC3C,OAAO,CAAC,kBAAkB,EAC1B,SAAS,CACV,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AARO;IADL,iBAAiB,EAAE;8CAQnB;AAGH,OAAO,EAAE,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/safe-apps-sdk/dist/esm/types/sdk.d.ts b/packages/safe-apps-sdk/dist/esm/types/sdk.d.ts index af4aa765..4d602805 100644 --- a/packages/safe-apps-sdk/dist/esm/types/sdk.d.ts +++ b/packages/safe-apps-sdk/dist/esm/types/sdk.d.ts @@ -61,6 +61,14 @@ export type SafeInfo = { owners: string[]; isReadOnly: boolean; }; +export type SafeInfoExtended = SafeInfo & { + nonce: number; + implementation: string; + modules: string[] | null; + fallbackHandler: string | null; + guard: string | null; + version: string | null; +}; export type EnvironmentInfo = { origin: string; }; diff --git a/packages/safe-apps-sdk/dist/esm/types/sdk.js.map b/packages/safe-apps-sdk/dist/esm/types/sdk.js.map index 4913ead4..f1fdbb38 100644 --- a/packages/safe-apps-sdk/dist/esm/types/sdk.js.map +++ b/packages/safe-apps-sdk/dist/esm/types/sdk.js.map @@ -1 +1 @@ -{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":"AA4FA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAa,EAA0B,EAAE;IAC/E,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AACzG,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":"AAqGA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAa,EAA0B,EAAE;IAC/E,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,IAAI,IAAI,QAAQ,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC;AACzG,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/safe-apps-sdk/dist/types/safe/index.d.ts b/packages/safe-apps-sdk/dist/types/safe/index.d.ts index efe730ea..83b170ef 100644 --- a/packages/safe-apps-sdk/dist/types/safe/index.d.ts +++ b/packages/safe-apps-sdk/dist/types/safe/index.d.ts @@ -1,9 +1,9 @@ -import { Communicator, SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData } from '../types/index.js'; +import { Communicator, ChainInfo, SafeBalances, GetBalanceParams, EnvironmentInfo, AddressBookItem, EIP712TypedData, SafeInfoExtended } from '../types/index.js'; declare class Safe { private readonly communicator; constructor(communicator: Communicator); getChainInfo(): Promise; - getInfo(): Promise; + getInfo(): Promise; experimental_getBalances({ currency }?: GetBalanceParams): Promise; private check1271Signature; private check1271SignatureBytes; diff --git a/packages/safe-apps-sdk/dist/types/safe/index.d.ts.map b/packages/safe-apps-sdk/dist/types/safe/index.d.ts.map index 28b90751..51ded4b4 100644 --- a/packages/safe-apps-sdk/dist/types/safe/index.d.ts.map +++ b/packages/safe-apps-sdk/dist/types/safe/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/safe/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,gBAAgB,EAGhB,eAAe,EACf,eAAe,EAEf,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAG3B,cAAM,IAAI;IACR,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;gBAEhC,YAAY,EAAE,YAAY;IAIhC,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IASlC,OAAO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AC,YAAY,EAAE,eAAe,GAAG,MAAM;IA8B1D,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS1D,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,SAAS,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA0BtF,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,SAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAa5E,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAU9C,kBAAkB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;CAQvD;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/safe-apps-sdk/dist/types/types/sdk.d.ts b/packages/safe-apps-sdk/dist/types/types/sdk.d.ts index 77ff948d..0264d654 100644 --- a/packages/safe-apps-sdk/dist/types/types/sdk.d.ts +++ b/packages/safe-apps-sdk/dist/types/types/sdk.d.ts @@ -61,6 +61,14 @@ export type SafeInfo = { owners: string[]; isReadOnly: boolean; }; +export type SafeInfoExtended = SafeInfo & { + nonce: number; + implementation: string; + modules: string[] | null; + fallbackHandler: string | null; + guard: string | null; + version: string | null; +}; export type EnvironmentInfo = { origin: string; }; diff --git a/packages/safe-apps-sdk/dist/types/types/sdk.d.ts.map b/packages/safe-apps-sdk/dist/types/types/sdk.d.ts.map index 9dcae3ac..67c60746 100644 --- a/packages/safe-apps-sdk/dist/types/types/sdk.d.ts.map +++ b/packages/safe-apps-sdk/dist/types/types/sdk.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/types/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEnF,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,UAAU,EACV,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,0BA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,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,GAAG,2BAA2B,CAAC;AAEzF,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,uBAAuB,SAAU,OAAO,2BAEpD,CAAC"} \ No newline at end of file diff --git a/packages/safe-apps-sdk/package.json b/packages/safe-apps-sdk/package.json index 2ac75fa7..5f0a7ac7 100644 --- a/packages/safe-apps-sdk/package.json +++ b/packages/safe-apps-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@safe-global/safe-apps-sdk", - "version": "9.0.0", + "version": "9.1.0", "description": "SDK developed to integrate third-party apps with Safe app.", "type": "module", "main": "dist/cjs/index.js", diff --git a/packages/safe-apps-sdk/src/safe/index.ts b/packages/safe-apps-sdk/src/safe/index.ts index dad67a37..11df45e2 100644 --- a/packages/safe-apps-sdk/src/safe/index.ts +++ b/packages/safe-apps-sdk/src/safe/index.ts @@ -4,7 +4,6 @@ import { Methods } from '../communication/methods.js'; import { RPC_CALLS } from '../eth/constants.js'; import { Communicator, - SafeInfo, ChainInfo, SafeBalances, GetBalanceParams, @@ -14,6 +13,7 @@ import { AddressBookItem, isObjectEIP712TypedData, EIP712TypedData, + SafeInfoExtended, } from '../types/index.js'; import requirePermission from '../decorators/requirePermissions.js'; @@ -33,8 +33,8 @@ class Safe { return response.data; } - async getInfo(): Promise { - const response = await this.communicator.send( + async getInfo(): Promise { + const response = await this.communicator.send( Methods.getSafeInfo, undefined, ); diff --git a/packages/safe-apps-sdk/src/safe/safe.test.ts b/packages/safe-apps-sdk/src/safe/safe.test.ts index daf4513f..ce4a0d76 100644 --- a/packages/safe-apps-sdk/src/safe/safe.test.ts +++ b/packages/safe-apps-sdk/src/safe/safe.test.ts @@ -1,5 +1,5 @@ import SDK from '../sdk.js'; -import { SafeInfo } from '../types/index.js'; +import { SafeInfoExtended } from '../types/index.js'; import { Methods } from '../communication/methods.js'; import { PostMessageOptions } from '../types/index.js'; import { PermissionsError } from '../types/permissions.js'; @@ -7,6 +7,20 @@ import { Wallet } from '../wallet/index.js'; const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +export const ExtendedSafeInfo: SafeInfoExtended = { + chainId: 4, + safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', + nonce: 1, + implementation: '0x3E5c63644E683549055b9Be8653de26E0B4CD36E', + modules: null, + fallbackHandler: null, + version: '1.3.0', + guard: null, + owners: [], + threshold: 1, + isReadOnly: false, +}; + describe('Safe Apps SDK safe methods', () => { const sdkInstance = new SDK(); let postMessageSpy: jest.SpyInstance; @@ -33,16 +47,7 @@ describe('Safe Apps SDK safe methods', () => { describe('SDK.safe.calculateMessageHash', () => { test('Should generate correct EIP-191 message hash', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); // to test message/hash I signed a test message on rinkeby // https://dashboard.tenderly.co/tx/rinkeby/0x9308fb61d9f4282080334e3f35b357fc689e06808b8ad2817536813948e3720d const message = 'approve rugpull'; @@ -56,16 +61,7 @@ describe('Safe Apps SDK safe methods', () => { describe('SDK.safe.calculateTypedMessageHash', () => { test('Should generate correct EIP-712 message hash', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); const typedMessage = { domain: { @@ -107,16 +103,7 @@ describe('Safe Apps SDK safe methods', () => { describe('SDK.safe.check1271Signature', () => { test('Should send a valid message to the interface', async () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); const message = '0x617070726f76652072756770756c6c0000000000000000000000000000000000'; // stringToHex('approve rugpull', { size: 32 }) // @ts-expect-error method is private but we are testing it sdkInstance.safe.check1271Signature(message); @@ -143,16 +130,7 @@ describe('Safe Apps SDK safe methods', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); // @ts-expect-error method is private but we are testing it const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); rpcCallSpy.mockImplementationOnce(() => Promise.resolve({ id: '1', @@ -170,16 +148,7 @@ describe('Safe Apps SDK safe methods', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); // @ts-expect-error method is private but we are testing it const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); rpcCallSpy.mockImplementationOnce(() => Promise.reject(new Error('Hash not approved'))); const message = '0x68616c6c6f000000000000000000000000000000000000000000000000000000'; // stringToHex('hallo') @@ -191,16 +160,7 @@ describe('Safe Apps SDK safe methods', () => { describe('SDK.safe.check1271SignatureBytes', () => { test('Should send a valid message to the interface', async () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); const message = '0x617070726f76652072756770756c6c0000000000000000000000000000000000'; // stringToHex('approve rugpull', { size: 32 }) // @ts-expect-error method is private but we are testing it sdkInstance.safe.check1271SignatureBytes(message); @@ -227,16 +187,7 @@ describe('Safe Apps SDK safe methods', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); // @ts-expect-error method is private but we are testing it const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); rpcCallSpy.mockImplementationOnce(() => Promise.resolve({ id: '1', @@ -254,16 +205,7 @@ describe('Safe Apps SDK safe methods', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); // @ts-expect-error method is private but we are testing it const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); rpcCallSpy.mockImplementationOnce(() => Promise.reject(new Error('Hash not approved'))); const message = '0x68616c6c6f000000000000000000000000000000000000000000000000000000'; // stringToHex('hallo') @@ -288,16 +230,7 @@ describe('Safe Apps SDK safe methods', () => { describe('SDK.safe.isMessageHashSigned', () => { test('Should send call messages to check the message the interface', async () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); - safeInfoSpy.mockImplementation( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); const message = '0x617070726f76652072756770756c6c0000000000000000000000000000000000'; // stringToHex('approve rugpull', { size: 32 }) @@ -326,16 +259,7 @@ describe('Safe Apps SDK safe methods', () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); // @ts-expect-error method is private but we are testing it const check1271SignatureSpy = jest.spyOn(sdkInstance.safe, 'check1271Signature'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); // @ts-expect-error ts fails to infer the return type because of a private method check1271SignatureSpy.mockImplementationOnce(() => Promise.resolve(true)); @@ -354,16 +278,7 @@ describe('Safe Apps SDK safe methods', () => { const check1271SignatureSpy = jest.spyOn(sdkInstance.safe, 'check1271Signature'); // @ts-expect-error method is private but we are testing it const check1271SignatureBytesSpy = jest.spyOn(sdkInstance.safe, 'check1271SignatureBytes'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); // @ts-expect-error ts fails to infer the return type because of a private method check1271SignatureSpy.mockImplementationOnce(() => Promise.resolve(false)); // @ts-expect-error ts fails to infer the return type because of a private method @@ -384,16 +299,7 @@ describe('Safe Apps SDK safe methods', () => { const check1271SignatureSpy = jest.spyOn(sdkInstance.safe, 'check1271Signature'); // @ts-expect-error method is private but we are testing it const check1271SignatureBytesSpy = jest.spyOn(sdkInstance.safe, 'check1271SignatureBytes'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); // @ts-expect-error ts fails to infer the return type because of a private method check1271SignatureSpy.mockImplementationOnce(() => Promise.resolve(false)); // @ts-expect-error ts fails to infer the return type because of a private method diff --git a/packages/safe-apps-sdk/src/txs/txs.test.ts b/packages/safe-apps-sdk/src/txs/txs.test.ts index 5eaa4f6b..72dabd2e 100644 --- a/packages/safe-apps-sdk/src/txs/txs.test.ts +++ b/packages/safe-apps-sdk/src/txs/txs.test.ts @@ -1,6 +1,7 @@ -import SDK, { SafeInfo } from '../index.js'; +import SDK, { SafeInfoExtended } from '../index.js'; import { Methods } from '../communication/methods.js'; import { PostMessageOptions } from '../types/index.js'; +import { ExtendedSafeInfo } from '../safe/safe.test'; describe('Safe Apps SDK transaction methods', () => { const sdkInstance = new SDK(); @@ -70,16 +71,7 @@ describe('Safe Apps SDK transaction methods', () => { test('Should include params with non-hashed message to the typed message body', async () => { const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); - safeInfoSpy.mockImplementationOnce( - (): Promise => - Promise.resolve({ - chainId: 4, - safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', - owners: [], - threshold: 1, - isReadOnly: false, - }), - ); + safeInfoSpy.mockImplementationOnce((): Promise => Promise.resolve(ExtendedSafeInfo)); const domain = { name: 'Ether Mail', diff --git a/packages/safe-apps-sdk/src/types/sdk.ts b/packages/safe-apps-sdk/src/types/sdk.ts index f8571c11..67cc42a5 100644 --- a/packages/safe-apps-sdk/src/types/sdk.ts +++ b/packages/safe-apps-sdk/src/types/sdk.ts @@ -76,6 +76,15 @@ export type SafeInfo = { isReadOnly: boolean; }; +export type SafeInfoExtended = SafeInfo & { + nonce: number; + implementation: string; + modules: string[] | null; + fallbackHandler: string | null; + guard: string | null; + version: string | null; +}; + export type EnvironmentInfo = { origin: string; }; diff --git a/packages/safe-apps-web3modal/CHANGELOG.md b/packages/safe-apps-web3modal/CHANGELOG.md index 05cfe7a3..1efde9d3 100644 --- a/packages/safe-apps-web3modal/CHANGELOG.md +++ b/packages/safe-apps-web3modal/CHANGELOG.md @@ -1,5 +1,12 @@ # @safe-global/safe-apps-web3modal +## 23.0.0 + +### Patch Changes + +- Updated dependencies [a811ac6] + - @safe-global/safe-apps-sdk@9.1.0 + ## 22.0.0 ### Patch Changes diff --git a/packages/safe-apps-web3modal/package.json b/packages/safe-apps-web3modal/package.json index 9d6032c5..eade52f9 100644 --- a/packages/safe-apps-web3modal/package.json +++ b/packages/safe-apps-web3modal/package.json @@ -1,6 +1,6 @@ { "name": "@safe-global/safe-apps-web3modal", - "version": "22.0.0", + "version": "23.0.0", "description": "A web3modal wrapper for Safe App support", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -25,11 +25,11 @@ }, "homepage": "https://github.com/safe-global/safe-apps-sdk#readme", "devDependencies": { - "@safe-global/safe-apps-sdk": "^9.0.0", + "@safe-global/safe-apps-sdk": "^9.1.0", "web3modal": "^1.9.9" }, "peerDependencies": { - "@safe-global/safe-apps-sdk": "^9.0.0", + "@safe-global/safe-apps-sdk": "^9.1.0", "web3modal": "^1.9.9" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index a56d7a2e..ba87bf07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4756,9 +4756,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001407: - version "1.0.30001425" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001425.tgz#52917791a453eb3265143d2cd08d80629e82c735" - integrity sha512-/pzFv0OmNG6W0ym80P3NtapU0QEiDS3VuYAZMGoLLqiC7f6FJFe1MjpQDREGApeenD9wloeytmVDj+JLXPC6qw== + version "1.0.30001632" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz" + integrity sha512-udx3o7yHJfUxMLkGohMlVHCvFvWmirKh9JAH/d7WOLPetlH+LTL5cocMZ0t7oZx/mdlOWXti97xLZWc8uURRHg== case-sensitive-paths-webpack-plugin@^2.4.0: version "2.4.0"