@safe-global/protocol-kit 4.1.0 → 5.0.0
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/src/Safe.d.ts +12 -17
- package/dist/src/Safe.js +159 -112
- package/dist/src/Safe.js.map +1 -1
- package/dist/src/SafeProvider.d.ts +11 -20
- package/dist/src/SafeProvider.js +141 -90
- package/dist/src/SafeProvider.js.map +1 -1
- package/dist/src/contracts/BaseContract.d.ts +26 -6
- package/dist/src/contracts/BaseContract.js +101 -14
- package/dist/src/contracts/BaseContract.js.map +1 -1
- package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.d.ts +5 -4
- package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.js +3 -2
- package/dist/src/contracts/CompatibilityFallbackHandler/CompatibilityFallbackHandlerBaseContract.js.map +1 -1
- package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.d.ts +4 -3
- package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.js +5 -5
- package/dist/src/contracts/CompatibilityFallbackHandler/v1.3.0/CompatibilityFallbackHandlerContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.d.ts +4 -3
- package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.js +5 -5
- package/dist/src/contracts/CompatibilityFallbackHandler/v1.4.1/CompatibilityFallbackHandlerContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/CreateCall/CreateCallBaseContract.d.ts +5 -4
- package/dist/src/contracts/CreateCall/CreateCallBaseContract.js +3 -2
- package/dist/src/contracts/CreateCall/CreateCallBaseContract.js.map +1 -1
- package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.d.ts +4 -3
- package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.js +7 -9
- package/dist/src/contracts/CreateCall/v1.3.0/CreateCallContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.d.ts +4 -3
- package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.js +7 -9
- package/dist/src/contracts/CreateCall/v1.4.1/CreateCallContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/MultiSend/MultiSendBaseContract.d.ts +5 -4
- package/dist/src/contracts/MultiSend/MultiSendBaseContract.js +3 -2
- package/dist/src/contracts/MultiSend/MultiSendBaseContract.js.map +1 -1
- package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.d.ts +5 -4
- package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.js +3 -2
- package/dist/src/contracts/MultiSend/MultiSendCallOnlyBaseContract.js.map +1 -1
- package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.d.ts +4 -3
- package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.js +5 -5
- package/dist/src/contracts/MultiSend/v1.1.1/MultiSendContract_v1_1_1.js.map +1 -1
- package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.d.ts +4 -3
- package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.js +5 -5
- package/dist/src/contracts/MultiSend/v1.3.0/MultiSendCallOnlyContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.d.ts +4 -3
- package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.js +5 -5
- package/dist/src/contracts/MultiSend/v1.3.0/MultiSendContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.d.ts +4 -3
- package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.js +5 -5
- package/dist/src/contracts/MultiSend/v1.4.1/MultiSendCallOnlyContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.d.ts +4 -3
- package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.js +5 -5
- package/dist/src/contracts/MultiSend/v1.4.1/MultiSendContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/Safe/SafeBaseContract.d.ts +5 -4
- package/dist/src/contracts/Safe/SafeBaseContract.js +3 -2
- package/dist/src/contracts/Safe/SafeBaseContract.js.map +1 -1
- package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.d.ts +7 -11
- package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.js +64 -42
- package/dist/src/contracts/Safe/v1.0.0/SafeContract_v1_0_0.js.map +1 -1
- package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.d.ts +4 -9
- package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.js +61 -39
- package/dist/src/contracts/Safe/v1.1.1/SafeContract_v1_1_1.js.map +1 -1
- package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.d.ts +5 -10
- package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.js +63 -41
- package/dist/src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.js.map +1 -1
- package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.d.ts +5 -10
- package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.js +63 -41
- package/dist/src/contracts/Safe/v1.3.0/SafeContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.d.ts +5 -10
- package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.js +63 -41
- package/dist/src/contracts/Safe/v1.4.1/SafeContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.d.ts +5 -7
- package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.js +3 -2
- package/dist/src/contracts/SafeProxyFactory/SafeProxyFactoryBaseContract.js.map +1 -1
- package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.d.ts +5 -11
- package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.js +9 -38
- package/dist/src/contracts/SafeProxyFactory/v1.0.0/SafeProxyFactoryContract_v1_0_0.js.map +1 -1
- package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.d.ts +6 -12
- package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.js +12 -41
- package/dist/src/contracts/SafeProxyFactory/v1.1.1/SafeProxyFactoryContract_v1_1_1.js.map +1 -1
- package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.d.ts +5 -11
- package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.js +11 -40
- package/dist/src/contracts/SafeProxyFactory/v1.3.0/SafeProxyFactoryContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.d.ts +5 -11
- package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.js +10 -39
- package/dist/src/contracts/SafeProxyFactory/v1.4.1/SafeProxyFactoryContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.d.ts +5 -7
- package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.js +3 -2
- package/dist/src/contracts/SafeWebAuthnSharedSigner/SafeWebAuthnSharedSignerBaseContract.js.map +1 -1
- package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.d.ts +4 -3
- package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.js +9 -9
- package/dist/src/contracts/SafeWebAuthnSharedSigner/v0.2.1/SafeWebAuthnSharedSignerContract_v0_2_1.js.map +1 -1
- package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.d.ts +5 -7
- package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.js +3 -2
- package/dist/src/contracts/SafeWebAuthnSignerFactory/SafeWebAuthnSignerFactoryBaseContract.js.map +1 -1
- package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.d.ts +4 -3
- package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.js +8 -8
- package/dist/src/contracts/SafeWebAuthnSignerFactory/v0.2.1/SafeWebAuthnSignerFactoryContract_v0_2_1.js.map +1 -1
- package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.d.ts +5 -4
- package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.js +3 -2
- package/dist/src/contracts/SignMessageLib/SignMessageLibBaseContract.js.map +1 -1
- package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.d.ts +4 -3
- package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.js +7 -8
- package/dist/src/contracts/SignMessageLib/v1.3.0/SignMessageLibContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.d.ts +4 -3
- package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.js +7 -8
- package/dist/src/contracts/SignMessageLib/v1.4.1/SignMessageLibContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.d.ts +5 -4
- package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.js +3 -2
- package/dist/src/contracts/SimulateTxAccessor/SimulateTxAccessorBaseContract.js.map +1 -1
- package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.d.ts +4 -3
- package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.js +9 -7
- package/dist/src/contracts/SimulateTxAccessor/v1.3.0/SimulateTxAccessorContract_v1_3_0.js.map +1 -1
- package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.d.ts +4 -3
- package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.js +9 -7
- package/dist/src/contracts/SimulateTxAccessor/v1.4.1/SimulateTxAccessorContract_v1_4_1.js.map +1 -1
- package/dist/src/contracts/config.d.ts +8 -1
- package/dist/src/contracts/config.js +47 -16
- package/dist/src/contracts/config.js.map +1 -1
- package/dist/src/contracts/constants.d.ts +4 -3
- package/dist/src/contracts/constants.js +2 -1
- package/dist/src/contracts/constants.js.map +1 -1
- package/dist/src/contracts/contractInstances.d.ts +13 -12
- package/dist/src/contracts/contractInstances.js +34 -34
- package/dist/src/contracts/contractInstances.js.map +1 -1
- package/dist/src/contracts/safeDeploymentContracts.d.ts +6 -5
- package/dist/src/contracts/safeDeploymentContracts.js +26 -66
- package/dist/src/contracts/safeDeploymentContracts.js.map +1 -1
- package/dist/src/contracts/utils.d.ts +35 -13
- package/dist/src/contracts/utils.js +136 -55
- package/dist/src/contracts/utils.js.map +1 -1
- package/dist/src/index.d.ts +10 -6
- package/dist/src/index.js +7 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/managers/contractManager.js +12 -17
- package/dist/src/managers/contractManager.js.map +1 -1
- package/dist/src/managers/fallbackHandlerManager.js +5 -4
- package/dist/src/managers/fallbackHandlerManager.js.map +1 -1
- package/dist/src/managers/guardManager.js +5 -4
- package/dist/src/managers/guardManager.js.map +1 -1
- package/dist/src/types/contracts.d.ts +13 -13
- package/dist/src/types/index.d.ts +0 -1
- package/dist/src/types/index.js +0 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/safeConfig.d.ts +3 -1
- package/dist/src/types/safeProvider.d.ts +33 -5
- package/dist/src/types/transactions.d.ts +1 -1
- package/dist/src/utils/address.d.ts +1 -1
- package/dist/src/utils/address.js +1 -1
- package/dist/src/utils/address.js.map +1 -1
- package/dist/src/utils/block.d.ts +6 -0
- package/dist/src/utils/block.js +14 -0
- package/dist/src/utils/block.js.map +1 -0
- package/dist/src/utils/constants.d.ts +4 -3
- package/dist/src/utils/constants.js +2 -1
- package/dist/src/utils/constants.js.map +1 -1
- package/dist/src/utils/eip-3770/config.js +32 -1
- package/dist/src/utils/eip-3770/config.js.map +1 -1
- package/dist/src/utils/eip-3770/index.d.ts +1 -1
- package/dist/src/utils/eip-3770/index.js +2 -3
- package/dist/src/utils/eip-3770/index.js.map +1 -1
- package/dist/src/utils/eip-712/encode.d.ts +3 -0
- package/dist/src/utils/eip-712/encode.js +127 -0
- package/dist/src/utils/eip-712/encode.js.map +1 -0
- package/dist/src/utils/eip-712/index.d.ts +1 -1
- package/dist/src/utils/eip-712/index.js +5 -7
- package/dist/src/utils/eip-712/index.js.map +1 -1
- package/dist/src/utils/erc-20/index.d.ts +1 -1
- package/dist/src/utils/erc-20/index.js +12 -5
- package/dist/src/utils/erc-20/index.js.map +1 -1
- package/dist/src/utils/messages/SafeMessage.d.ts +1 -1
- package/dist/src/utils/passkeys/PasskeyClient.d.ts +5 -0
- package/dist/src/utils/passkeys/PasskeyClient.js +156 -0
- package/dist/src/utils/passkeys/PasskeyClient.js.map +1 -0
- package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.d.ts +2 -1
- package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.js +12 -12
- package/dist/src/utils/passkeys/createPasskeyDeploymentTransaction.js.map +1 -1
- package/dist/src/utils/passkeys/extractPasskeyData.d.ts +1 -2
- package/dist/src/utils/passkeys/extractPasskeyData.js +8 -15
- package/dist/src/utils/passkeys/extractPasskeyData.js.map +1 -1
- package/dist/src/utils/passkeys/getPasskeyOwnerAddress.js +10 -3
- package/dist/src/utils/passkeys/getPasskeyOwnerAddress.js.map +1 -1
- package/dist/src/utils/passkeys/index.d.ts +1 -1
- package/dist/src/utils/passkeys/index.js +1 -1
- package/dist/src/utils/passkeys/isSharedSigner.d.ts +2 -3
- package/dist/src/utils/passkeys/isSharedSigner.js +6 -5
- package/dist/src/utils/passkeys/isSharedSigner.js.map +1 -1
- package/dist/src/utils/provider.d.ts +3 -0
- package/dist/src/utils/provider.js +12 -0
- package/dist/src/utils/provider.js.map +1 -0
- package/dist/src/utils/safeVersions.js +2 -2
- package/dist/src/utils/safeVersions.js.map +1 -1
- package/dist/src/utils/signatures/SafeSignature.d.ts +1 -1
- package/dist/src/utils/signatures/utils.d.ts +4 -4
- package/dist/src/utils/signatures/utils.js +34 -20
- package/dist/src/utils/signatures/utils.js.map +1 -1
- package/dist/src/utils/transactions/SafeTransaction.d.ts +1 -1
- package/dist/src/utils/transactions/SafeTransaction.js.map +1 -1
- package/dist/src/utils/transactions/gas.d.ts +1 -1
- package/dist/src/utils/transactions/gas.js +37 -64
- package/dist/src/utils/transactions/gas.js.map +1 -1
- package/dist/src/utils/transactions/types.d.ts +17 -1
- package/dist/src/utils/transactions/utils.d.ts +11 -2
- package/dist/src/utils/transactions/utils.js +117 -27
- package/dist/src/utils/transactions/utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +4 -0
- package/dist/src/utils/types.js +59 -1
- package/dist/src/utils/types.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +26 -35
- package/dist/src/SafeFactory.d.ts +0 -15
- package/dist/src/SafeFactory.js +0 -136
- package/dist/src/SafeFactory.js.map +0 -1
- package/dist/src/types/safeFactory.d.ts +0 -31
- package/dist/src/types/safeFactory.js +0 -3
- package/dist/src/types/safeFactory.js.map +0 -1
- package/dist/src/utils/passkeys/PasskeySigner.d.ts +0 -63
- package/dist/src/utils/passkeys/PasskeySigner.js +0 -163
- package/dist/src/utils/passkeys/PasskeySigner.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import SafeBaseContract from '../../../contracts/Safe/SafeBaseContract';
|
|
2
2
|
import SafeProvider from '../../../SafeProvider';
|
|
3
|
-
import {
|
|
3
|
+
import { DeploymentType } from '../../../types';
|
|
4
|
+
import { SafeContract_v1_2_0_Abi, SafeContract_v1_2_0_Contract, SafeContract_v1_2_0_Function, SafeTransaction, TransactionOptions, TransactionResult } from '@safe-global/types-kit';
|
|
4
5
|
/**
|
|
5
6
|
* SafeContract_v1_2_0 is the implementation specific to the Safe contract version 1.2.0.
|
|
6
7
|
*
|
|
@@ -10,7 +11,6 @@ import { SafeVersion, SafeContract_v1_2_0_Abi, SafeContract_v1_2_0_Contract, Saf
|
|
|
10
11
|
* @implements SafeContract_v1_2_0_Contract - Implements the interface specific to Safe contract version 1.2.0.
|
|
11
12
|
*/
|
|
12
13
|
declare class SafeContract_v1_2_0 extends SafeBaseContract<SafeContract_v1_2_0_Abi> implements SafeContract_v1_2_0_Contract {
|
|
13
|
-
safeVersion: SafeVersion;
|
|
14
14
|
/**
|
|
15
15
|
* Constructs an instance of SafeContract_v1_2_0
|
|
16
16
|
*
|
|
@@ -19,8 +19,9 @@ declare class SafeContract_v1_2_0 extends SafeBaseContract<SafeContract_v1_2_0_A
|
|
|
19
19
|
* @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
|
|
20
20
|
* @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
|
|
21
21
|
* @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.2.0 is used.
|
|
22
|
+
* @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
|
|
22
23
|
*/
|
|
23
|
-
constructor(chainId: bigint, safeProvider: SafeProvider, isL1SafeSingleton?: boolean, customContractAddress?: string, customContractAbi?: SafeContract_v1_2_0_Abi);
|
|
24
|
+
constructor(chainId: bigint, safeProvider: SafeProvider, isL1SafeSingleton?: boolean, customContractAddress?: string, customContractAbi?: SafeContract_v1_2_0_Abi, deploymentType?: DeploymentType);
|
|
24
25
|
/**
|
|
25
26
|
* @returns Array[contractName]
|
|
26
27
|
*/
|
|
@@ -125,13 +126,7 @@ declare class SafeContract_v1_2_0 extends SafeBaseContract<SafeContract_v1_2_0_A
|
|
|
125
126
|
* @param options - Optional transaction options.
|
|
126
127
|
* @returns True, if the given transactions is valid.
|
|
127
128
|
*/
|
|
128
|
-
isValidTransaction(safeTransaction: SafeTransaction, options?: TransactionOptions): Promise<
|
|
129
|
-
/**
|
|
130
|
-
* returns the version of the Safe contract.
|
|
131
|
-
*
|
|
132
|
-
* @returns {Promise<SafeVersion>} A promise that resolves to the version of the Safe contract as string.
|
|
133
|
-
*/
|
|
134
|
-
getVersion(): Promise<SafeVersion>;
|
|
129
|
+
isValidTransaction(safeTransaction: SafeTransaction, options?: TransactionOptions): Promise<boolean>;
|
|
135
130
|
/**
|
|
136
131
|
* returns the nonce of the Safe contract.
|
|
137
132
|
*
|
|
@@ -3,9 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_1 = require("viem/actions");
|
|
6
7
|
const SafeBaseContract_1 = __importDefault(require("../../../contracts/Safe/SafeBaseContract"));
|
|
7
8
|
const utils_1 = require("../../../contracts/utils");
|
|
8
|
-
const
|
|
9
|
+
const types_kit_1 = require("@safe-global/types-kit");
|
|
10
|
+
const types_1 = require("../../../utils/types");
|
|
9
11
|
/**
|
|
10
12
|
* SafeContract_v1_2_0 is the implementation specific to the Safe contract version 1.2.0.
|
|
11
13
|
*
|
|
@@ -23,42 +25,43 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
23
25
|
* @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
|
|
24
26
|
* @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
|
|
25
27
|
* @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.2.0 is used.
|
|
28
|
+
* @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
|
|
26
29
|
*/
|
|
27
|
-
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi) {
|
|
30
|
+
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) {
|
|
28
31
|
const safeVersion = '1.2.0';
|
|
29
|
-
const defaultAbi =
|
|
30
|
-
super(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, customContractAddress, customContractAbi);
|
|
32
|
+
const defaultAbi = types_kit_1.safe_1_2_0_ContractArtifacts.abi;
|
|
33
|
+
super(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType);
|
|
31
34
|
/**
|
|
32
35
|
* @returns Array[contractName]
|
|
33
36
|
*/
|
|
34
37
|
this.NAME = async () => {
|
|
35
|
-
return [await this.
|
|
38
|
+
return [await this.read('NAME')];
|
|
36
39
|
};
|
|
37
40
|
/**
|
|
38
41
|
* @returns Array[safeContractVersion]
|
|
39
42
|
*/
|
|
40
43
|
this.VERSION = async () => {
|
|
41
|
-
return [await this.
|
|
44
|
+
return [await this.read('VERSION')];
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
44
47
|
* @param args - Array[owner, txHash]
|
|
45
48
|
* @returns Array[approvedHashes]
|
|
46
49
|
*/
|
|
47
50
|
this.approvedHashes = async (args) => {
|
|
48
|
-
return [await this.
|
|
51
|
+
return [await this.read('approvedHashes', args)];
|
|
49
52
|
};
|
|
50
53
|
/**
|
|
51
54
|
* @returns Array[domainSeparator]
|
|
52
55
|
*/
|
|
53
56
|
this.domainSeparator = async () => {
|
|
54
|
-
return [await this.
|
|
57
|
+
return [await this.read('domainSeparator')];
|
|
55
58
|
};
|
|
56
59
|
/**
|
|
57
60
|
* Returns array of first 10 modules.
|
|
58
61
|
* @returns Array[Array[modules]]
|
|
59
62
|
*/
|
|
60
63
|
this.getModules = async () => {
|
|
61
|
-
return [await this.
|
|
64
|
+
return [await this.read('getModules')];
|
|
62
65
|
};
|
|
63
66
|
/**
|
|
64
67
|
* Returns array of modules.
|
|
@@ -66,22 +69,22 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
66
69
|
* @returns Array[Array[modules], next]
|
|
67
70
|
*/
|
|
68
71
|
this.getModulesPaginated = async (args) => {
|
|
69
|
-
const
|
|
70
|
-
return [
|
|
72
|
+
const [array, next] = await this.read('getModulesPaginated', args);
|
|
73
|
+
return [array, next];
|
|
71
74
|
};
|
|
72
75
|
/**
|
|
73
76
|
* Returns the list of Safe owner accounts.
|
|
74
77
|
* @returns Array[Array[owners]]
|
|
75
78
|
*/
|
|
76
79
|
this.getOwners = async () => {
|
|
77
|
-
return [await this.
|
|
80
|
+
return [await this.read('getOwners')];
|
|
78
81
|
};
|
|
79
82
|
/**
|
|
80
83
|
* Returns the Safe threshold.
|
|
81
84
|
* @returns Array[threshold]
|
|
82
85
|
*/
|
|
83
86
|
this.getThreshold = async () => {
|
|
84
|
-
return [await this.
|
|
87
|
+
return [await this.read('getThreshold')];
|
|
85
88
|
};
|
|
86
89
|
/**
|
|
87
90
|
* Checks if a specific Safe module is enabled for the current Safe.
|
|
@@ -89,7 +92,7 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
89
92
|
* @returns Array[isEnabled]
|
|
90
93
|
*/
|
|
91
94
|
this.isModuleEnabled = async (args) => {
|
|
92
|
-
return [await this.
|
|
95
|
+
return [await this.read('isModuleEnabled', args)];
|
|
93
96
|
};
|
|
94
97
|
/**
|
|
95
98
|
* Checks if a specific address is an owner of the current Safe.
|
|
@@ -97,28 +100,28 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
97
100
|
* @returns Array[isOwner]
|
|
98
101
|
*/
|
|
99
102
|
this.isOwner = async (args) => {
|
|
100
|
-
return [await this.
|
|
103
|
+
return [await this.read('isOwner', args)];
|
|
101
104
|
};
|
|
102
105
|
/**
|
|
103
106
|
* Returns the Safe nonce.
|
|
104
107
|
* @returns Array[nonce]
|
|
105
108
|
*/
|
|
106
109
|
this.nonce = async () => {
|
|
107
|
-
return [await this.
|
|
110
|
+
return [await this.read('nonce')];
|
|
108
111
|
};
|
|
109
112
|
/**
|
|
110
113
|
* @param args - Array[messageHash]
|
|
111
114
|
* @returns Array[signedMessages]
|
|
112
115
|
*/
|
|
113
116
|
this.signedMessages = async (args) => {
|
|
114
|
-
return [await this.
|
|
117
|
+
return [await this.read('signedMessages', args)];
|
|
115
118
|
};
|
|
116
119
|
/**
|
|
117
120
|
* @param args - Array[message]
|
|
118
121
|
* @returns Array[messageHash]
|
|
119
122
|
*/
|
|
120
123
|
this.getMessageHash = async (args) => {
|
|
121
|
-
return [await this.
|
|
124
|
+
return [await this.read('getMessageHash', args)];
|
|
122
125
|
};
|
|
123
126
|
/**
|
|
124
127
|
* Encodes the data for a transaction to the Safe contract.
|
|
@@ -127,7 +130,7 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
127
130
|
* @returns Array[encodedData]
|
|
128
131
|
*/
|
|
129
132
|
this.encodeTransactionData = async (args) => {
|
|
130
|
-
return [await this.
|
|
133
|
+
return [await this.read('encodeTransactionData', args)];
|
|
131
134
|
};
|
|
132
135
|
/**
|
|
133
136
|
* Returns hash to be signed by owners.
|
|
@@ -136,9 +139,8 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
136
139
|
* @returns Array[transactionHash]
|
|
137
140
|
*/
|
|
138
141
|
this.getTransactionHash = async (args) => {
|
|
139
|
-
return [await this.
|
|
142
|
+
return [await this.read('getTransactionHash', args)];
|
|
140
143
|
};
|
|
141
|
-
this.safeVersion = safeVersion;
|
|
142
144
|
}
|
|
143
145
|
/**
|
|
144
146
|
* Marks a hash as approved. This can be used to validate a hash that is used by a signature.
|
|
@@ -147,9 +149,8 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
147
149
|
* @returns Transaction result.
|
|
148
150
|
*/
|
|
149
151
|
async approveHash(hash, options) {
|
|
150
|
-
const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options));
|
|
151
|
-
|
|
152
|
-
return (0, utils_1.toTxResult)(txResponse, options);
|
|
152
|
+
const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [(0, types_1.asHash)(hash)], options));
|
|
153
|
+
return (0, utils_1.toTxResult)(this.runner, await this.write('approveHash', [(0, types_1.asHash)(hash)], { ...options, gasLimit }), options);
|
|
153
154
|
}
|
|
154
155
|
/**
|
|
155
156
|
* Executes a transaction.
|
|
@@ -162,24 +163,35 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
162
163
|
(await this.estimateGas('execTransaction', [
|
|
163
164
|
safeTransaction.data.to,
|
|
164
165
|
BigInt(safeTransaction.data.value),
|
|
165
|
-
safeTransaction.data.data,
|
|
166
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
166
167
|
safeTransaction.data.operation,
|
|
167
168
|
BigInt(safeTransaction.data.safeTxGas),
|
|
168
169
|
BigInt(safeTransaction.data.baseGas),
|
|
169
170
|
BigInt(safeTransaction.data.gasPrice),
|
|
170
171
|
safeTransaction.data.gasToken,
|
|
171
172
|
safeTransaction.data.refundReceiver,
|
|
172
|
-
safeTransaction.encodedSignatures()
|
|
173
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
173
174
|
], options));
|
|
174
|
-
const
|
|
175
|
-
|
|
175
|
+
const args = [
|
|
176
|
+
safeTransaction.data.to,
|
|
177
|
+
BigInt(safeTransaction.data.value),
|
|
178
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
179
|
+
safeTransaction.data.operation,
|
|
180
|
+
BigInt(safeTransaction.data.safeTxGas),
|
|
181
|
+
BigInt(safeTransaction.data.baseGas),
|
|
182
|
+
BigInt(safeTransaction.data.gasPrice),
|
|
183
|
+
safeTransaction.data.gasToken,
|
|
184
|
+
safeTransaction.data.refundReceiver,
|
|
185
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
186
|
+
];
|
|
187
|
+
return (0, utils_1.toTxResult)(this.runner, await this.write('execTransaction', args, { ...options, gasLimit }), options);
|
|
176
188
|
}
|
|
177
189
|
/**
|
|
178
190
|
* Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract)
|
|
179
191
|
* @returns Array[chainId]
|
|
180
192
|
*/
|
|
181
193
|
async getChainId() {
|
|
182
|
-
return [await this.
|
|
194
|
+
return [await Promise.resolve(this.chainId)];
|
|
183
195
|
}
|
|
184
196
|
/**
|
|
185
197
|
* Checks whether a given Safe transaction can be executed successfully with no errors.
|
|
@@ -193,30 +205,40 @@ class SafeContract_v1_2_0 extends SafeBaseContract_1.default {
|
|
|
193
205
|
(await this.estimateGas('execTransaction', [
|
|
194
206
|
safeTransaction.data.to,
|
|
195
207
|
BigInt(safeTransaction.data.value),
|
|
196
|
-
safeTransaction.data.data,
|
|
208
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
197
209
|
safeTransaction.data.operation,
|
|
198
210
|
BigInt(safeTransaction.data.safeTxGas),
|
|
199
211
|
BigInt(safeTransaction.data.baseGas),
|
|
200
212
|
BigInt(safeTransaction.data.gasPrice),
|
|
201
213
|
safeTransaction.data.gasToken,
|
|
202
214
|
safeTransaction.data.refundReceiver,
|
|
203
|
-
safeTransaction.encodedSignatures()
|
|
215
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
204
216
|
], options));
|
|
205
|
-
|
|
217
|
+
const converted = this.convertOptions({ ...options, gasLimit });
|
|
218
|
+
const txResult = await (0, actions_1.simulateContract)(this.runner, {
|
|
219
|
+
address: this.contractAddress,
|
|
220
|
+
functionName: 'execTransaction',
|
|
221
|
+
abi: this.contractAbi,
|
|
222
|
+
args: [
|
|
223
|
+
safeTransaction.data.to,
|
|
224
|
+
BigInt(safeTransaction.data.value),
|
|
225
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
226
|
+
safeTransaction.data.operation,
|
|
227
|
+
BigInt(safeTransaction.data.safeTxGas),
|
|
228
|
+
BigInt(safeTransaction.data.baseGas),
|
|
229
|
+
BigInt(safeTransaction.data.gasPrice),
|
|
230
|
+
safeTransaction.data.gasToken,
|
|
231
|
+
safeTransaction.data.refundReceiver,
|
|
232
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
233
|
+
],
|
|
234
|
+
...converted
|
|
235
|
+
});
|
|
236
|
+
return txResult.result;
|
|
206
237
|
}
|
|
207
238
|
catch (error) {
|
|
208
239
|
return false;
|
|
209
240
|
}
|
|
210
241
|
}
|
|
211
|
-
/**
|
|
212
|
-
* returns the version of the Safe contract.
|
|
213
|
-
*
|
|
214
|
-
* @returns {Promise<SafeVersion>} A promise that resolves to the version of the Safe contract as string.
|
|
215
|
-
*/
|
|
216
|
-
async getVersion() {
|
|
217
|
-
const [safeVersion] = await this.VERSION();
|
|
218
|
-
return safeVersion;
|
|
219
|
-
}
|
|
220
242
|
/**
|
|
221
243
|
* returns the nonce of the Safe contract.
|
|
222
244
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeContract_v1_2_0.js","sourceRoot":"","sources":["../../../../../src/contracts/Safe/v1.2.0/SafeContract_v1_2_0.ts"],"names":[],"mappings":";;;;;AAAA,iHAAwF;AAExF,qEAAsE;
|
|
1
|
+
{"version":3,"file":"SafeContract_v1_2_0.js","sourceRoot":"","sources":["../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oBAC9B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC;oBACtC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC;oBACpC,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;oBACrC,eAAe,CAAC,IAAI,CAAC,QAAQ;oBAC7B,eAAe,CAAC,IAAI,CAAC,cAAc;oBACnC,IAAA,aAAK,EAAC,eAAe,CAAC,iBAAiB,EAAE,CAAC;iBAC3C;gBACD,GAAG,SAAS;aACb,CAAC,CAAA;YAEF,OAAO,QAAQ,CAAC,MAAM,CAAA;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QAClC,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,kBAAe,mBAAmB,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import SafeBaseContract from '../../../contracts/Safe/SafeBaseContract';
|
|
2
2
|
import SafeProvider from '../../../SafeProvider';
|
|
3
|
-
import {
|
|
3
|
+
import { DeploymentType } from '../../../types';
|
|
4
|
+
import { SafeContract_v1_3_0_Abi, SafeContract_v1_3_0_Contract, SafeContract_v1_3_0_Function, SafeTransaction, TransactionOptions, TransactionResult } from '@safe-global/types-kit';
|
|
4
5
|
/**
|
|
5
6
|
* SafeContract_v1_3_0 is the implementation specific to the Safe contract version 1.3.0.
|
|
6
7
|
*
|
|
@@ -10,7 +11,6 @@ import { SafeVersion, SafeContract_v1_3_0_Abi, SafeContract_v1_3_0_Contract, Saf
|
|
|
10
11
|
* @implements SafeContract_v1_3_0_Contract - Implements the interface specific to Safe contract version 1.3.0.
|
|
11
12
|
*/
|
|
12
13
|
declare class SafeContract_v1_3_0 extends SafeBaseContract<SafeContract_v1_3_0_Abi> implements SafeContract_v1_3_0_Contract {
|
|
13
|
-
safeVersion: SafeVersion;
|
|
14
14
|
/**
|
|
15
15
|
* Constructs an instance of SafeContract_v1_3_0
|
|
16
16
|
*
|
|
@@ -19,8 +19,9 @@ declare class SafeContract_v1_3_0 extends SafeBaseContract<SafeContract_v1_3_0_A
|
|
|
19
19
|
* @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
|
|
20
20
|
* @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
|
|
21
21
|
* @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used.
|
|
22
|
+
* @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
|
|
22
23
|
*/
|
|
23
|
-
constructor(chainId: bigint, safeProvider: SafeProvider, isL1SafeSingleton?: boolean, customContractAddress?: string, customContractAbi?: SafeContract_v1_3_0_Abi);
|
|
24
|
+
constructor(chainId: bigint, safeProvider: SafeProvider, isL1SafeSingleton?: boolean, customContractAddress?: string, customContractAbi?: SafeContract_v1_3_0_Abi, deploymentType?: DeploymentType);
|
|
24
25
|
/**
|
|
25
26
|
* @returns Array[safeContractVersion]
|
|
26
27
|
*/
|
|
@@ -109,7 +110,7 @@ declare class SafeContract_v1_3_0 extends SafeBaseContract<SafeContract_v1_3_0_A
|
|
|
109
110
|
* @param options - Optional transaction options.
|
|
110
111
|
* @returns True, if the given transactions is valid.
|
|
111
112
|
*/
|
|
112
|
-
isValidTransaction(safeTransaction: SafeTransaction, options?: TransactionOptions): Promise<
|
|
113
|
+
isValidTransaction(safeTransaction: SafeTransaction, options?: TransactionOptions): Promise<boolean>;
|
|
113
114
|
/**
|
|
114
115
|
* Executes a transaction.
|
|
115
116
|
* @param safeTransaction - The Safe transaction to execute.
|
|
@@ -134,12 +135,6 @@ declare class SafeContract_v1_3_0 extends SafeBaseContract<SafeContract_v1_3_0_A
|
|
|
134
135
|
* @returns Array[chainId]
|
|
135
136
|
*/
|
|
136
137
|
getChainId(): Promise<[bigint]>;
|
|
137
|
-
/**
|
|
138
|
-
* returns the version of the Safe contract.
|
|
139
|
-
*
|
|
140
|
-
* @returns {Promise<SafeVersion>} A promise that resolves to the version of the Safe contract as string.
|
|
141
|
-
*/
|
|
142
|
-
getVersion(): Promise<SafeVersion>;
|
|
143
138
|
/**
|
|
144
139
|
* returns the nonce of the Safe contract.
|
|
145
140
|
*
|
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_1 = require("viem/actions");
|
|
6
7
|
const SafeBaseContract_1 = __importDefault(require("../../../contracts/Safe/SafeBaseContract"));
|
|
7
8
|
const utils_1 = require("../../../contracts/utils");
|
|
8
9
|
const constants_1 = require("../../../utils/constants");
|
|
9
|
-
const
|
|
10
|
+
const types_kit_1 = require("@safe-global/types-kit");
|
|
11
|
+
const types_1 = require("../../../utils/types");
|
|
10
12
|
/**
|
|
11
13
|
* SafeContract_v1_3_0 is the implementation specific to the Safe contract version 1.3.0.
|
|
12
14
|
*
|
|
@@ -24,23 +26,24 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
24
26
|
* @param isL1SafeSingleton - A flag indicating if the contract is a L1 Safe Singleton.
|
|
25
27
|
* @param customContractAddress - Optional custom address for the contract. If not provided, the address is derived from the Safe deployments based on the chainId and safeVersion.
|
|
26
28
|
* @param customContractAbi - Optional custom ABI for the contract. If not provided, the default ABI for version 1.3.0 is used.
|
|
29
|
+
* @param deploymentType - Optional deployment type for the contract. If not provided, the first deployment retrieved from the safe-deployments array will be used.
|
|
27
30
|
*/
|
|
28
|
-
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi) {
|
|
31
|
+
constructor(chainId, safeProvider, isL1SafeSingleton = false, customContractAddress, customContractAbi, deploymentType) {
|
|
29
32
|
const safeVersion = '1.3.0';
|
|
30
|
-
const defaultAbi =
|
|
31
|
-
super(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, customContractAddress, customContractAbi);
|
|
33
|
+
const defaultAbi = types_kit_1.safe_1_3_0_ContractArtifacts.abi;
|
|
34
|
+
super(chainId, safeProvider, defaultAbi, safeVersion, isL1SafeSingleton, customContractAddress, customContractAbi, deploymentType);
|
|
32
35
|
/**
|
|
33
36
|
* @returns Array[safeContractVersion]
|
|
34
37
|
*/
|
|
35
38
|
this.VERSION = async () => {
|
|
36
|
-
return [await this.
|
|
39
|
+
return [await this.read('VERSION')];
|
|
37
40
|
};
|
|
38
41
|
/**
|
|
39
42
|
* @param args - Array[owner, txHash]
|
|
40
43
|
* @returns Array[approvedHashes]
|
|
41
44
|
*/
|
|
42
45
|
this.approvedHashes = async (args) => {
|
|
43
|
-
return [await this.
|
|
46
|
+
return [await this.read('approvedHashes', args)];
|
|
44
47
|
};
|
|
45
48
|
/**
|
|
46
49
|
* Checks whether the signature provided is valid for the provided data, hash and number of required signatures.
|
|
@@ -49,7 +52,7 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
49
52
|
* @returns Empty array
|
|
50
53
|
*/
|
|
51
54
|
this.checkNSignatures = async (args) => {
|
|
52
|
-
await this.
|
|
55
|
+
await this.read('checkNSignatures', args);
|
|
53
56
|
return [];
|
|
54
57
|
};
|
|
55
58
|
/**
|
|
@@ -58,14 +61,14 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
58
61
|
* @returns Empty array
|
|
59
62
|
*/
|
|
60
63
|
this.checkSignatures = async (args) => {
|
|
61
|
-
await this.
|
|
64
|
+
await this.read('checkSignatures', args);
|
|
62
65
|
return [];
|
|
63
66
|
};
|
|
64
67
|
/**
|
|
65
68
|
* @returns Array[domainSeparator]
|
|
66
69
|
*/
|
|
67
70
|
this.domainSeparator = async () => {
|
|
68
|
-
return [await this.
|
|
71
|
+
return [await this.read('domainSeparator')];
|
|
69
72
|
};
|
|
70
73
|
/**
|
|
71
74
|
* Encodes the data for a transaction to the Safe contract.
|
|
@@ -73,7 +76,7 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
73
76
|
* @returns Array[encodedData]
|
|
74
77
|
*/
|
|
75
78
|
this.encodeTransactionData = async (args) => {
|
|
76
|
-
return [await this.
|
|
79
|
+
return [await this.read('encodeTransactionData', args)];
|
|
77
80
|
};
|
|
78
81
|
/**
|
|
79
82
|
* Returns array of modules.
|
|
@@ -81,15 +84,15 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
81
84
|
* @returns Array[Array[modules], next]
|
|
82
85
|
*/
|
|
83
86
|
this.getModulesPaginated = async (args) => {
|
|
84
|
-
const
|
|
85
|
-
return [
|
|
87
|
+
const [array, next] = await this.read('getModulesPaginated', args);
|
|
88
|
+
return [array, next];
|
|
86
89
|
};
|
|
87
90
|
/**
|
|
88
91
|
* Returns the list of Safe owner accounts.
|
|
89
92
|
* @returns Array[Array[owners]]
|
|
90
93
|
*/
|
|
91
94
|
this.getOwners = async () => {
|
|
92
|
-
return [await this.
|
|
95
|
+
return [await this.read('getOwners')];
|
|
93
96
|
};
|
|
94
97
|
/**
|
|
95
98
|
* Reads `length` bytes of storage in the currents contract
|
|
@@ -97,14 +100,14 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
97
100
|
* @returns Array[storage]
|
|
98
101
|
*/
|
|
99
102
|
this.getStorageAt = async (args) => {
|
|
100
|
-
return [await this.
|
|
103
|
+
return [await this.read('getStorageAt', args)];
|
|
101
104
|
};
|
|
102
105
|
/**
|
|
103
106
|
* Returns the Safe threshold.
|
|
104
107
|
* @returns Array[threshold]
|
|
105
108
|
*/
|
|
106
109
|
this.getThreshold = async () => {
|
|
107
|
-
return [await this.
|
|
110
|
+
return [await this.read('getThreshold')];
|
|
108
111
|
};
|
|
109
112
|
/**
|
|
110
113
|
* Returns hash to be signed by owners.
|
|
@@ -112,7 +115,7 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
112
115
|
* @returns Array[transactionHash]
|
|
113
116
|
*/
|
|
114
117
|
this.getTransactionHash = async (args) => {
|
|
115
|
-
return [await this.
|
|
118
|
+
return [await this.read('getTransactionHash', args)];
|
|
116
119
|
};
|
|
117
120
|
/**
|
|
118
121
|
* Checks if a specific Safe module is enabled for the current Safe.
|
|
@@ -120,7 +123,7 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
120
123
|
* @returns Array[isEnabled]
|
|
121
124
|
*/
|
|
122
125
|
this.isModuleEnabled = async (args) => {
|
|
123
|
-
return [await this.
|
|
126
|
+
return [await this.read('isModuleEnabled', args)];
|
|
124
127
|
};
|
|
125
128
|
/**
|
|
126
129
|
* Checks if a specific address is an owner of the current Safe.
|
|
@@ -128,23 +131,22 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
128
131
|
* @returns Array[isOwner]
|
|
129
132
|
*/
|
|
130
133
|
this.isOwner = async (args) => {
|
|
131
|
-
return [await this.
|
|
134
|
+
return [await this.read('isOwner', args)];
|
|
132
135
|
};
|
|
133
136
|
/**
|
|
134
137
|
* Returns the Safe nonce.
|
|
135
138
|
* @returns Array[nonce]
|
|
136
139
|
*/
|
|
137
140
|
this.nonce = async () => {
|
|
138
|
-
return [await this.
|
|
141
|
+
return [await this.read('nonce')];
|
|
139
142
|
};
|
|
140
143
|
/**
|
|
141
144
|
* @param args - Array[messageHash]
|
|
142
145
|
* @returns Array[signedMessages]
|
|
143
146
|
*/
|
|
144
147
|
this.signedMessages = async (args) => {
|
|
145
|
-
return [await this.
|
|
148
|
+
return [await this.read('signedMessages', args)];
|
|
146
149
|
};
|
|
147
|
-
this.safeVersion = safeVersion;
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* Checks whether a given Safe transaction can be executed successfully with no errors.
|
|
@@ -158,16 +160,35 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
158
160
|
(await this.estimateGas('execTransaction', [
|
|
159
161
|
safeTransaction.data.to,
|
|
160
162
|
BigInt(safeTransaction.data.value),
|
|
161
|
-
safeTransaction.data.data,
|
|
163
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
162
164
|
safeTransaction.data.operation,
|
|
163
165
|
BigInt(safeTransaction.data.safeTxGas),
|
|
164
166
|
BigInt(safeTransaction.data.baseGas),
|
|
165
167
|
BigInt(safeTransaction.data.gasPrice),
|
|
166
168
|
safeTransaction.data.gasToken,
|
|
167
169
|
safeTransaction.data.refundReceiver,
|
|
168
|
-
safeTransaction.encodedSignatures()
|
|
170
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
169
171
|
], options));
|
|
170
|
-
|
|
172
|
+
const converted = this.convertOptions({ ...options, gasLimit });
|
|
173
|
+
const txResult = await (0, actions_1.simulateContract)(this.runner, {
|
|
174
|
+
address: this.contractAddress,
|
|
175
|
+
functionName: 'execTransaction',
|
|
176
|
+
abi: this.contractAbi,
|
|
177
|
+
args: [
|
|
178
|
+
safeTransaction.data.to,
|
|
179
|
+
BigInt(safeTransaction.data.value),
|
|
180
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
181
|
+
safeTransaction.data.operation,
|
|
182
|
+
BigInt(safeTransaction.data.safeTxGas),
|
|
183
|
+
BigInt(safeTransaction.data.baseGas),
|
|
184
|
+
BigInt(safeTransaction.data.gasPrice),
|
|
185
|
+
safeTransaction.data.gasToken,
|
|
186
|
+
safeTransaction.data.refundReceiver,
|
|
187
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
188
|
+
],
|
|
189
|
+
...converted
|
|
190
|
+
});
|
|
191
|
+
return txResult.result;
|
|
171
192
|
}
|
|
172
193
|
catch (error) {
|
|
173
194
|
return false;
|
|
@@ -184,17 +205,28 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
184
205
|
(await this.estimateGas('execTransaction', [
|
|
185
206
|
safeTransaction.data.to,
|
|
186
207
|
BigInt(safeTransaction.data.value),
|
|
187
|
-
safeTransaction.data.data,
|
|
208
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
188
209
|
safeTransaction.data.operation,
|
|
189
210
|
BigInt(safeTransaction.data.safeTxGas),
|
|
190
211
|
BigInt(safeTransaction.data.baseGas),
|
|
191
212
|
BigInt(safeTransaction.data.gasPrice),
|
|
192
213
|
safeTransaction.data.gasToken,
|
|
193
214
|
safeTransaction.data.refundReceiver,
|
|
194
|
-
safeTransaction.encodedSignatures()
|
|
215
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
195
216
|
], options));
|
|
196
|
-
const
|
|
197
|
-
|
|
217
|
+
const args = [
|
|
218
|
+
safeTransaction.data.to,
|
|
219
|
+
BigInt(safeTransaction.data.value),
|
|
220
|
+
(0, types_1.asHex)(safeTransaction.data.data),
|
|
221
|
+
safeTransaction.data.operation,
|
|
222
|
+
BigInt(safeTransaction.data.safeTxGas),
|
|
223
|
+
BigInt(safeTransaction.data.baseGas),
|
|
224
|
+
BigInt(safeTransaction.data.gasPrice),
|
|
225
|
+
safeTransaction.data.gasToken,
|
|
226
|
+
safeTransaction.data.refundReceiver,
|
|
227
|
+
(0, types_1.asHex)(safeTransaction.encodedSignatures())
|
|
228
|
+
];
|
|
229
|
+
return (0, utils_1.toTxResult)(this.runner, await this.write('execTransaction', args, { ...options, gasLimit }), options);
|
|
198
230
|
}
|
|
199
231
|
/**
|
|
200
232
|
* Returns array of first 10 modules.
|
|
@@ -211,25 +243,15 @@ class SafeContract_v1_3_0 extends SafeBaseContract_1.default {
|
|
|
211
243
|
* @returns Transaction result.
|
|
212
244
|
*/
|
|
213
245
|
async approveHash(hash, options) {
|
|
214
|
-
const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [hash], options));
|
|
215
|
-
|
|
216
|
-
return (0, utils_1.toTxResult)(txResponse, options);
|
|
246
|
+
const gasLimit = options?.gasLimit || (await this.estimateGas('approveHash', [(0, types_1.asHash)(hash)], options));
|
|
247
|
+
return (0, utils_1.toTxResult)(this.runner, await this.write('approveHash', [(0, types_1.asHash)(hash)], { ...options, gasLimit }), options);
|
|
217
248
|
}
|
|
218
249
|
/**
|
|
219
250
|
* Returns the chain id of the Safe contract. (Custom method - not defined in the Safe Contract)
|
|
220
251
|
* @returns Array[chainId]
|
|
221
252
|
*/
|
|
222
253
|
async getChainId() {
|
|
223
|
-
return [await this.
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* returns the version of the Safe contract.
|
|
227
|
-
*
|
|
228
|
-
* @returns {Promise<SafeVersion>} A promise that resolves to the version of the Safe contract as string.
|
|
229
|
-
*/
|
|
230
|
-
async getVersion() {
|
|
231
|
-
const [safeVersion] = await this.VERSION();
|
|
232
|
-
return safeVersion;
|
|
254
|
+
return [await Promise.resolve(this.chainId)];
|
|
233
255
|
}
|
|
234
256
|
/**
|
|
235
257
|
* returns the nonce of the Safe contract.
|