@0xsequence/account 2.3.18 → 2.3.20

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.
@@ -0,0 +1,178 @@
1
+ import { commons } from '@0xsequence/core';
2
+ import { migrator } from '@0xsequence/migration';
3
+ import { ChainId, NetworkConfig } from '@0xsequence/network';
4
+ import { type FeeOption, type FeeQuote, type Relayer } from '@0xsequence/relayer';
5
+ import type { tracker } from '@0xsequence/sessions';
6
+ import type { SignatureOrchestrator } from '@0xsequence/signhub';
7
+ import { Wallet } from '@0xsequence/wallet';
8
+ import { ethers } from 'ethers';
9
+ import { AccountSigner, AccountSignerOptions } from "./signer.js";
10
+ export type AccountStatus = {
11
+ original: {
12
+ version: number;
13
+ imageHash: string;
14
+ context: commons.context.WalletContext;
15
+ };
16
+ onChain: {
17
+ imageHash: string;
18
+ config: commons.config.Config;
19
+ version: number;
20
+ deployed: boolean;
21
+ };
22
+ fullyMigrated: boolean;
23
+ signedMigrations: migrator.SignedMigration[];
24
+ version: number;
25
+ presignedConfigurations: tracker.PresignedConfigLink[];
26
+ imageHash: string;
27
+ config: commons.config.Config;
28
+ checkpoint: ethers.BigNumberish;
29
+ canOnchainValidate: boolean;
30
+ };
31
+ export type AccountOptions = {
32
+ address: string;
33
+ tracker: tracker.ConfigTracker & migrator.PresignedMigrationTracker;
34
+ contexts: commons.context.VersionedContext;
35
+ migrations?: migrator.Migrations;
36
+ orchestrator: SignatureOrchestrator;
37
+ networks: NetworkConfig[];
38
+ jwt?: string;
39
+ projectAccessKey?: string;
40
+ };
41
+ export interface PreparedTransactions {
42
+ transactions: commons.transaction.SimulatedTransaction[];
43
+ flatDecorated: commons.transaction.Transaction[];
44
+ feeOptions: FeeOption[];
45
+ feeQuote?: FeeQuote;
46
+ }
47
+ export declare class Account {
48
+ readonly address: string;
49
+ readonly networks: NetworkConfig[];
50
+ readonly tracker: tracker.ConfigTracker & migrator.PresignedMigrationTracker;
51
+ readonly contexts: commons.context.VersionedContext;
52
+ readonly migrator: migrator.Migrator;
53
+ readonly migrations: migrator.Migrations;
54
+ private orchestrator;
55
+ private jwt?;
56
+ private projectAccessKey?;
57
+ constructor(options: AccountOptions);
58
+ getSigner(chainId: ChainId, options?: AccountSignerOptions): AccountSigner;
59
+ static new(options: {
60
+ config: commons.config.SimpleConfig;
61
+ tracker: tracker.ConfigTracker & migrator.PresignedMigrationTracker;
62
+ contexts: commons.context.VersionedContext;
63
+ orchestrator: SignatureOrchestrator;
64
+ networks: NetworkConfig[];
65
+ migrations?: migrator.Migrations;
66
+ projectAccessKey?: string;
67
+ }): Promise<Account>;
68
+ getAddress(): Promise<string>;
69
+ get version(): number;
70
+ get coders(): {
71
+ signature: commons.signature.SignatureCoder;
72
+ config: commons.config.ConfigCoder;
73
+ };
74
+ network(chainId: ethers.BigNumberish): NetworkConfig;
75
+ providerFor(chainId: ethers.BigNumberish): ethers.Provider;
76
+ reader(chainId: ethers.BigNumberish): commons.reader.Reader;
77
+ relayer(chainId: ethers.BigNumberish): Relayer;
78
+ setOrchestrator(orchestrator: SignatureOrchestrator): void;
79
+ setJwt(jwt: string): void;
80
+ contextFor(version: number): commons.context.WalletContext;
81
+ walletForStatus(chainId: ethers.BigNumberish, status: Pick<AccountStatus, 'version'> & Pick<AccountStatus, 'config'>): Wallet;
82
+ walletFor(chainId: ethers.BigNumberish, context: commons.context.WalletContext, config: commons.config.Config, coders: typeof this.coders): Wallet;
83
+ status(chainId: ethers.BigNumberish, longestPath?: boolean): Promise<AccountStatus>;
84
+ private mustBeFullyMigrated;
85
+ predecorateSignedTransactions(status: AccountStatus, chainId: ethers.BigNumberish): Promise<commons.transaction.SignedTransactionBundle[]>;
86
+ predecorateTransactions(txs: commons.transaction.Transactionish, status: AccountStatus, chainId: ethers.BigNumberish): Promise<commons.transaction.Transactionish>;
87
+ decorateTransactions(bundles: commons.transaction.IntendedTransactionBundle | commons.transaction.IntendedTransactionBundle[], status: AccountStatus, chainId?: ethers.BigNumberish): Promise<commons.transaction.IntendedTransactionBundle>;
88
+ decorateSignature<T extends ethers.BytesLike>(signature: T, status: Partial<Pick<AccountStatus, 'presignedConfigurations'>>): Promise<T | string>;
89
+ publishWitnessFor(signers: string[], chainId?: ethers.BigNumberish): Promise<void>;
90
+ publishWitness(): Promise<void>;
91
+ signDigest(digest: ethers.BytesLike, chainId: ethers.BigNumberish, decorate?: boolean, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw', metadata?: object): Promise<string>;
92
+ buildOnChainSignature(digest: ethers.BytesLike): {
93
+ bundle: commons.transaction.TransactionBundle;
94
+ signature: string;
95
+ };
96
+ private buildEIP6492Signature;
97
+ editConfig(changes: {
98
+ add?: commons.config.SimpleSigner[];
99
+ remove?: string[];
100
+ threshold?: ethers.BigNumberish;
101
+ }): Promise<void>;
102
+ updateConfig(config: commons.config.Config): Promise<void>;
103
+ /**
104
+ * This method is used to bootstrap the wallet on a given chain.
105
+ * this deploys the wallets and executes all the necessary transactions
106
+ * for that wallet to start working with the given version.
107
+ *
108
+ * This usually involves: (a) deploying the wallet, (b) executing migrations
109
+ *
110
+ * Notice: It should NOT explicitly include chained signatures. Unless internally used
111
+ * by any of the migrations.
112
+ *
113
+ */
114
+ buildBootstrapTransactions(status: AccountStatus, chainId: ethers.BigNumberish): Promise<commons.transaction.IntendedTransactionBundle>;
115
+ bootstrapTransactions(chainId: ethers.BigNumberish, prestatus?: AccountStatus): Promise<Omit<commons.transaction.IntendedTransactionBundle, 'chainId'>>;
116
+ doBootstrap(chainId: ethers.BigNumberish, feeQuote?: FeeQuote, prestatus?: AccountStatus): Promise<commons.transaction.TransactionResponse<any>>;
117
+ /**
118
+ * Signs a message.
119
+ *
120
+ * This method will sign the message using the account associated with this signer
121
+ * and the specified chain ID. If the message is already prefixed with the EIP-191
122
+ * prefix, it will be hashed directly. Otherwise, it will be prefixed before hashing.
123
+ *
124
+ * @param message - The message to sign. Can be a string or BytesLike.
125
+ * @param chainId - The chain ID to use for signing
126
+ * @param cantValidateBehavior - Behavior when the wallet cannot validate on-chain
127
+ * @returns A Promise that resolves to the signature as a hexadecimal string
128
+ */
129
+ signMessage(message: ethers.BytesLike, chainId: ethers.BigNumberish, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw'): Promise<string>;
130
+ signTransactions(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, pstatus?: AccountStatus, options?: {
131
+ nonceSpace?: ethers.BigNumberish;
132
+ serial?: boolean;
133
+ }): Promise<commons.transaction.SignedTransactionBundle>;
134
+ signMigrations(chainId: ethers.BigNumberish, editConfig: (prevConfig: commons.config.Config) => commons.config.Config): Promise<boolean>;
135
+ signAllMigrations(editConfig: (prevConfig: commons.config.Config) => commons.config.Config): Promise<{
136
+ signedMigrations: Array<any>;
137
+ failedChains: number[];
138
+ }>;
139
+ isMigratedAllChains(): Promise<{
140
+ migratedAllChains: boolean;
141
+ failedChains: number[];
142
+ }>;
143
+ sendSignedTransactions(signedBundle: commons.transaction.IntendedTransactionBundle | commons.transaction.IntendedTransactionBundle[], chainId: ethers.BigNumberish, quote?: FeeQuote, pstatus?: AccountStatus, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void, projectAccessKey?: string): Promise<ethers.TransactionResponse>;
144
+ fillGasLimits(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, status?: AccountStatus): Promise<commons.transaction.SimulatedTransaction[]>;
145
+ gasRefundQuotes(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, stubSignatureOverrides: Map<string, string>, status?: AccountStatus, options?: {
146
+ simulate?: boolean;
147
+ projectAccessKey?: string;
148
+ }): Promise<{
149
+ options: FeeOption[];
150
+ quote?: FeeQuote;
151
+ decorated: commons.transaction.IntendedTransactionBundle;
152
+ }>;
153
+ prepareTransactions(args: {
154
+ txs: commons.transaction.Transactionish;
155
+ chainId: ethers.BigNumberish;
156
+ stubSignatureOverrides: Map<string, string>;
157
+ simulateForFeeOptions?: boolean;
158
+ projectAccessKey?: string;
159
+ }): Promise<PreparedTransactions>;
160
+ sendTransaction(txs: commons.transaction.Transactionish, chainId: ethers.BigNumberish, quote?: FeeQuote, skipPreDecorate?: boolean, callback?: (bundle: commons.transaction.IntendedTransactionBundle) => void, options?: {
161
+ nonceSpace?: ethers.BigNumberish;
162
+ serial?: boolean;
163
+ projectAccessKey?: string;
164
+ }): Promise<ethers.TransactionResponse | undefined>;
165
+ signTypedData(domain: ethers.TypedDataDomain, types: Record<string, Array<ethers.TypedDataField>>, message: Record<string, any>, chainId: ethers.BigNumberish, cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw'): Promise<string>;
166
+ getSigners(): Promise<Array<{
167
+ address: string;
168
+ network: ChainId;
169
+ weight: number;
170
+ }>>;
171
+ getAllSigners(): Promise<{
172
+ address: string;
173
+ weight: number;
174
+ network: number;
175
+ flaggedForRemoval: boolean;
176
+ }[]>;
177
+ }
178
+ export declare function isAccount(value: any): value is Account;
@@ -0,0 +1 @@
1
+ export * from "./account.js";
@@ -0,0 +1,58 @@
1
+ import { ChainId } from '@0xsequence/network';
2
+ import { Account } from "./account.js";
3
+ import { ethers } from 'ethers';
4
+ import { commons } from '@0xsequence/core';
5
+ import { FeeOption } from '@0xsequence/relayer';
6
+ export type AccountSignerOptions = {
7
+ nonceSpace?: ethers.BigNumberish;
8
+ cantValidateBehavior?: 'ignore' | 'eip6492' | 'throw';
9
+ stubSignatureOverrides?: Map<string, string>;
10
+ selectFee?: (txs: ethers.TransactionRequest | commons.transaction.Transactionish, options: FeeOption[]) => Promise<FeeOption | undefined>;
11
+ };
12
+ export declare class AccountSigner implements ethers.AbstractSigner<ethers.Provider> {
13
+ account: Account;
14
+ chainId: ChainId;
15
+ readonly options?: AccountSignerOptions | undefined;
16
+ constructor(account: Account, chainId: ChainId, options?: AccountSignerOptions | undefined);
17
+ get provider(): ethers.Provider;
18
+ getAddress(): Promise<string>;
19
+ /**
20
+ * Signs a message.
21
+ *
22
+ * This method will sign the message using the account associated with this signer
23
+ * and the specified chain ID. The message is already being prefixed with the EIP-191 prefix.
24
+ *
25
+ * @param message - The message to sign. Can be a string or BytesLike.
26
+ * @returns A Promise that resolves to the signature as a hexadecimal string
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const signer = account.getSigner(chainId)
31
+ *
32
+ * const message = "Hello, Sequence!";
33
+ * const signature = await signer.signMessage(message);
34
+ * console.log(signature);
35
+ * // => "0x123abc..." (hexadecimal signature)
36
+ */
37
+ signMessage(message: string | ethers.BytesLike): Promise<string>;
38
+ signTypedData(domain: ethers.TypedDataDomain, types: Record<string, Array<ethers.TypedDataField>>, value: Record<string, any>): Promise<string>;
39
+ private defaultSelectFee;
40
+ sendTransaction(txs: commons.transaction.Transactionish, options?: {
41
+ simulateForFeeOptions?: boolean;
42
+ }): Promise<ethers.TransactionResponse>;
43
+ getBalance(blockTag?: ethers.BlockTag | undefined): Promise<bigint>;
44
+ call(transaction: ethers.TransactionRequest, blockTag?: ethers.BlockTag): Promise<string>;
45
+ resolveName(name: string): Promise<string>;
46
+ connect(_provider: ethers.Provider): ethers.Signer;
47
+ signTransaction(transaction: ethers.TransactionRequest): Promise<string>;
48
+ getTransactionCount(blockTag?: ethers.BlockTag | undefined): Promise<number>;
49
+ estimateGas(transaction: ethers.TransactionRequest): Promise<bigint>;
50
+ getChainId(): Promise<number>;
51
+ getGasPrice(): Promise<bigint>;
52
+ getFeeData(): Promise<ethers.FeeData>;
53
+ getNonce(blockTag?: ethers.BlockTag): Promise<number>;
54
+ populateCall(tx: ethers.TransactionRequest): Promise<ethers.TransactionLike<string>>;
55
+ checkTransaction(transaction: ethers.TransactionRequest): ethers.TransactionRequest;
56
+ populateTransaction(tx: ethers.TransactionRequest): Promise<ethers.TransactionLike<string>>;
57
+ _checkProvider(operation?: string | undefined): void;
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/account",
3
- "version": "2.3.18",
3
+ "version": "2.3.20",
4
4
  "description": "tools for migrating sequence wallets to new versions",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/account",
6
6
  "source": "src/index.ts",
@@ -12,21 +12,21 @@
12
12
  "ethers": ">=6"
13
13
  },
14
14
  "dependencies": {
15
- "@0xsequence/abi": "2.3.18",
16
- "@0xsequence/core": "2.3.18",
17
- "@0xsequence/migration": "2.3.18",
18
- "@0xsequence/network": "2.3.18",
19
- "@0xsequence/relayer": "2.3.18",
20
- "@0xsequence/sessions": "2.3.18",
21
- "@0xsequence/utils": "2.3.18",
22
- "@0xsequence/wallet": "2.3.18"
15
+ "@0xsequence/abi": "2.3.20",
16
+ "@0xsequence/core": "2.3.20",
17
+ "@0xsequence/migration": "2.3.20",
18
+ "@0xsequence/network": "2.3.20",
19
+ "@0xsequence/relayer": "2.3.20",
20
+ "@0xsequence/sessions": "2.3.20",
21
+ "@0xsequence/utils": "2.3.20",
22
+ "@0xsequence/wallet": "2.3.20"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
26
26
  "ethers": "6.13.4",
27
27
  "nyc": "^15.1.0",
28
- "@0xsequence/signhub": "2.3.18",
29
- "@0xsequence/tests": "2.3.18"
28
+ "@0xsequence/signhub": "2.3.20",
29
+ "@0xsequence/tests": "2.3.20"
30
30
  },
31
31
  "files": [
32
32
  "src",