@safe-global/safe-apps-sdk
Advanced tools
Comparing version 9.0.0 to 9.1.0
# @safe-global/safe-apps-sdk | ||
## 9.1.0 | ||
### Minor Changes | ||
- e0710be: safe.getInfo() endpoint should return extended safe information similar to api-kit's getSafeInfo endpoint | ||
### Patch Changes | ||
- 55342f0: chore: bump dependencies | ||
- 2cc8919: upgraded viem and wagmi to v2 | ||
## 9.0.0 | ||
@@ -4,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
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 { | ||
@@ -6,3 +6,3 @@ private readonly communicator; | ||
getChainInfo(): Promise<ChainInfo>; | ||
getInfo(): Promise<SafeInfo>; | ||
getInfo(): Promise<SafeInfoExtended>; | ||
experimental_getBalances({ currency }?: GetBalanceParams): Promise<SafeBalances>; | ||
@@ -9,0 +9,0 @@ private check1271Signature; |
@@ -64,2 +64,10 @@ import { ChainInfo as _ChainInfo } from '@safe-global/safe-gateway-typescript-sdk'; | ||
}; | ||
export type SafeInfoExtended = SafeInfo & { | ||
nonce: number; | ||
implementation: string; | ||
modules: string[] | null; | ||
fallbackHandler: string | null; | ||
guard: string | null; | ||
version: string | null; | ||
}; | ||
export type EnvironmentInfo = { | ||
@@ -66,0 +74,0 @@ origin: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSDKVersion = void 0; | ||
const getSDKVersion = () => '9.0.0'; | ||
const getSDKVersion = () => '9.1.0'; | ||
exports.getSDKVersion = getSDKVersion; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
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 { | ||
@@ -6,3 +6,3 @@ private readonly communicator; | ||
getChainInfo(): Promise<ChainInfo>; | ||
getInfo(): Promise<SafeInfo>; | ||
getInfo(): Promise<SafeInfoExtended>; | ||
experimental_getBalances({ currency }?: GetBalanceParams): Promise<SafeBalances>; | ||
@@ -9,0 +9,0 @@ private check1271Signature; |
@@ -64,2 +64,10 @@ import { ChainInfo as _ChainInfo } from '@safe-global/safe-gateway-typescript-sdk'; | ||
}; | ||
export type SafeInfoExtended = SafeInfo & { | ||
nonce: number; | ||
implementation: string; | ||
modules: string[] | null; | ||
fallbackHandler: string | null; | ||
guard: string | null; | ||
version: string | null; | ||
}; | ||
export type EnvironmentInfo = { | ||
@@ -66,0 +74,0 @@ origin: string; |
@@ -1,2 +0,2 @@ | ||
export const getSDKVersion = () => '9.0.0'; | ||
export const getSDKVersion = () => '9.1.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,2 +0,2 @@ | ||
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 { | ||
@@ -6,3 +6,3 @@ private readonly communicator; | ||
getChainInfo(): Promise<ChainInfo>; | ||
getInfo(): Promise<SafeInfo>; | ||
getInfo(): Promise<SafeInfoExtended>; | ||
experimental_getBalances({ currency }?: GetBalanceParams): Promise<SafeBalances>; | ||
@@ -9,0 +9,0 @@ private check1271Signature; |
@@ -64,2 +64,10 @@ import { ChainInfo as _ChainInfo } from '@safe-global/safe-gateway-typescript-sdk'; | ||
}; | ||
export type SafeInfoExtended = SafeInfo & { | ||
nonce: number; | ||
implementation: string; | ||
modules: string[] | null; | ||
fallbackHandler: string | null; | ||
guard: string | null; | ||
version: string | null; | ||
}; | ||
export type EnvironmentInfo = { | ||
@@ -66,0 +74,0 @@ origin: string; |
{ | ||
"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.", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
"@safe-global/safe-gateway-typescript-sdk": "^3.5.3", | ||
"viem": "^1.6.0" | ||
"viem": "^2.1.1" | ||
}, | ||
@@ -43,0 +43,0 @@ "repository": { |
@@ -57,3 +57,3 @@ # Safe Apps SDK | ||
const opts: Opts = { | ||
allowedDomains: [/app.safe.global$/], | ||
allowedDomains: [/^app\.safe\.global$/], | ||
debug: false, | ||
@@ -60,0 +60,0 @@ }; |
@@ -7,3 +7,2 @@ import { encodeFunctionData, Address, hashMessage, hashTypedData } from 'viem'; | ||
Communicator, | ||
SafeInfo, | ||
ChainInfo, | ||
@@ -18,2 +17,3 @@ SafeBalances, | ||
EIP712TypedData, | ||
SafeInfoExtended, | ||
} from '../types/index.js'; | ||
@@ -38,4 +38,4 @@ import requirePermission from '../decorators/requirePermissions.js'; | ||
async getInfo(): Promise<SafeInfo> { | ||
const response = await this.communicator.send<Methods.getSafeInfo, undefined, SafeInfo>( | ||
async getInfo(): Promise<SafeInfoExtended> { | ||
const response = await this.communicator.send<Methods.getSafeInfo, undefined, SafeInfoExtended>( | ||
Methods.getSafeInfo, | ||
@@ -42,0 +42,0 @@ undefined, |
import SDK from '../sdk.js'; | ||
import { SafeInfo } from '../types/index.js'; | ||
import { SafeInfoExtended } from '../types/index.js'; | ||
import { Methods } from '../communication/methods.js'; | ||
@@ -10,2 +10,16 @@ import { PostMessageOptions } from '../types/index.js'; | ||
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', () => { | ||
@@ -37,12 +51,3 @@ const sdkInstance = new SDK(); | ||
const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
// to test message/hash I signed a test message on rinkeby | ||
@@ -61,12 +66,3 @@ // https://dashboard.tenderly.co/tx/rinkeby/0x9308fb61d9f4282080334e3f35b357fc689e06808b8ad2817536813948e3720d | ||
const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
@@ -113,12 +109,3 @@ const typedMessage = { | ||
const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
const message = '0x617070726f76652072756770756c6c0000000000000000000000000000000000'; // stringToHex('approve rugpull', { size: 32 }) | ||
@@ -150,12 +137,3 @@ // @ts-expect-error method is private but we are testing it | ||
const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
rpcCallSpy.mockImplementationOnce(() => | ||
@@ -178,12 +156,3 @@ Promise.resolve({ | ||
const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
rpcCallSpy.mockImplementationOnce(() => Promise.reject(new Error('Hash not approved'))); | ||
@@ -200,12 +169,3 @@ | ||
const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
const message = '0x617070726f76652072756770756c6c0000000000000000000000000000000000'; // stringToHex('approve rugpull', { size: 32 }) | ||
@@ -237,12 +197,3 @@ // @ts-expect-error method is private but we are testing it | ||
const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
rpcCallSpy.mockImplementationOnce(() => | ||
@@ -265,12 +216,3 @@ Promise.resolve({ | ||
const rpcCallSpy = jest.spyOn(sdkInstance.safe.communicator, 'send'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
rpcCallSpy.mockImplementationOnce(() => Promise.reject(new Error('Hash not approved'))); | ||
@@ -300,12 +242,3 @@ | ||
const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); | ||
safeInfoSpy.mockImplementation( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
@@ -339,12 +272,3 @@ const message = '0x617070726f76652072756770756c6c0000000000000000000000000000000000'; // stringToHex('approve rugpull', { size: 32 }) | ||
const check1271SignatureSpy = jest.spyOn(sdkInstance.safe, 'check1271Signature'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
// @ts-expect-error ts fails to infer the return type because of a private method | ||
@@ -368,12 +292,3 @@ check1271SignatureSpy.mockImplementationOnce(() => Promise.resolve(true)); | ||
const check1271SignatureBytesSpy = jest.spyOn(sdkInstance.safe, 'check1271SignatureBytes'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
// @ts-expect-error ts fails to infer the return type because of a private method | ||
@@ -399,12 +314,3 @@ check1271SignatureSpy.mockImplementationOnce(() => Promise.resolve(false)); | ||
const check1271SignatureBytesSpy = jest.spyOn(sdkInstance.safe, 'check1271SignatureBytes'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
// @ts-expect-error ts fails to infer the return type because of a private method | ||
@@ -411,0 +317,0 @@ check1271SignatureSpy.mockImplementationOnce(() => Promise.resolve(false)); |
@@ -1,4 +0,5 @@ | ||
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'; | ||
@@ -73,12 +74,3 @@ describe('Safe Apps SDK transaction methods', () => { | ||
const safeInfoSpy = jest.spyOn(sdkInstance.safe, 'getInfo'); | ||
safeInfoSpy.mockImplementationOnce( | ||
(): Promise<SafeInfo> => | ||
Promise.resolve({ | ||
chainId: 4, | ||
safeAddress: '0x9C6FEA0B2eAc5b6D8bBB6C30401D42aA95398190', | ||
owners: [], | ||
threshold: 1, | ||
isReadOnly: false, | ||
}), | ||
); | ||
safeInfoSpy.mockImplementationOnce((): Promise<SafeInfoExtended> => Promise.resolve(ExtendedSafeInfo)); | ||
@@ -85,0 +77,0 @@ const domain = { |
@@ -79,2 +79,11 @@ import { ChainInfo as _ChainInfo } from '@safe-global/safe-gateway-typescript-sdk'; | ||
export type SafeInfoExtended = SafeInfo & { | ||
nonce: number; | ||
implementation: string; | ||
modules: string[] | null; | ||
fallbackHandler: string | null; | ||
guard: string | null; | ||
version: string | null; | ||
}; | ||
export type EnvironmentInfo = { | ||
@@ -81,0 +90,0 @@ origin: string; |
@@ -1,1 +0,1 @@ | ||
export const getSDKVersion = () => '9.0.0'; | ||
export const getSDKVersion = () => '9.1.0'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
247011
4335
+ Added@noble/curves@1.4.0(transitive)
+ Added@noble/hashes@1.4.01.5.0(transitive)
+ Added@scure/bip32@1.4.0(transitive)
+ Added@scure/bip39@1.4.0(transitive)
+ Addedabitype@1.0.5(transitive)
+ Addedisows@1.0.4(transitive)
+ Addedviem@2.21.6(transitive)
+ Addedwebauthn-p256@0.0.5(transitive)
+ Addedws@8.17.1(transitive)
- Removed@noble/curves@1.2.0(transitive)
- Removed@noble/hashes@1.3.2(transitive)
- Removed@scure/bip32@1.3.2(transitive)
- Removed@scure/bip39@1.2.1(transitive)
- Removedabitype@0.9.8(transitive)
- Removedisows@1.0.3(transitive)
- Removedviem@1.21.4(transitive)
- Removedws@8.13.0(transitive)
Updatedviem@^2.1.1