@thru/programs 0.3.3 → 0.3.5
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/README.md +123 -37
- package/dist/abi-manager/index.cjs +9568 -0
- package/dist/abi-manager/index.cjs.map +1 -0
- package/dist/abi-manager/index.d.cts +2169 -0
- package/dist/abi-manager/index.d.ts +2169 -0
- package/dist/abi-manager/index.js +4 -0
- package/dist/abi-manager/index.js.map +1 -0
- package/dist/amm/index.cjs +1 -3
- package/dist/amm/index.cjs.map +1 -1
- package/dist/amm/index.d.cts +1 -1
- package/dist/amm/index.d.ts +1 -1
- package/dist/amm/index.js +2 -2
- package/dist/amm/index.js.map +1 -1
- package/dist/chunk-6IC6CO5S.js +9443 -0
- package/dist/chunk-6IC6CO5S.js.map +1 -0
- package/dist/chunk-7DRJVAYI.js +8587 -0
- package/dist/chunk-7DRJVAYI.js.map +1 -0
- package/dist/chunk-7FBCBZIY.js +41 -0
- package/dist/chunk-7FBCBZIY.js.map +1 -0
- package/dist/chunk-BNYDH4ZP.js +4351 -0
- package/dist/chunk-BNYDH4ZP.js.map +1 -0
- package/dist/chunk-OODN6LJA.js +6567 -0
- package/dist/chunk-OODN6LJA.js.map +1 -0
- package/dist/chunk-YX7BLFQZ.js +81 -0
- package/dist/chunk-YX7BLFQZ.js.map +1 -0
- package/dist/clob/index.cjs +19361 -6851
- package/dist/clob/index.cjs.map +1 -1
- package/dist/clob/index.d.cts +1243 -63
- package/dist/clob/index.d.ts +1243 -63
- package/dist/clob/index.js +6826 -2818
- package/dist/clob/index.js.map +1 -1
- package/dist/deploy/index.cjs +24734 -0
- package/dist/deploy/index.cjs.map +1 -0
- package/dist/deploy/index.d.cts +180 -0
- package/dist/deploy/index.d.ts +180 -0
- package/dist/deploy/index.js +1846 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/helpers-DD7q61nr.d.cts +7 -0
- package/dist/helpers-DD7q61nr.d.ts +7 -0
- package/dist/manager/index.cjs +6680 -0
- package/dist/manager/index.cjs.map +1 -0
- package/dist/manager/index.d.cts +1279 -0
- package/dist/manager/index.d.ts +1279 -0
- package/dist/manager/index.js +4 -0
- package/dist/manager/index.js.map +1 -0
- package/dist/passkey-manager/index.cjs +4 -5
- package/dist/passkey-manager/index.cjs.map +1 -1
- package/dist/passkey-manager/index.js +2 -2
- package/dist/token/index.js +1 -8585
- package/dist/token/index.js.map +1 -1
- package/dist/uploader/index.cjs +4442 -0
- package/dist/uploader/index.cjs.map +1 -0
- package/dist/uploader/index.d.cts +761 -0
- package/dist/uploader/index.d.ts +761 -0
- package/dist/uploader/index.js +4 -0
- package/dist/uploader/index.js.map +1 -0
- package/package.json +22 -2
- package/src/abi-manager/abi/thru/blockchain/state_proof/types.ts +1906 -0
- package/src/abi-manager/abi/thru/common/primitives/types.ts +2428 -0
- package/src/abi-manager/abi/thru/program/abi_manager/types.ts +7037 -0
- package/src/abi-manager/accounts.ts +91 -0
- package/src/abi-manager/constants.ts +19 -0
- package/src/abi-manager/derivation.ts +86 -0
- package/src/abi-manager/errors.ts +48 -0
- package/src/abi-manager/index.test.ts +136 -0
- package/src/abi-manager/index.ts +56 -0
- package/src/abi-manager/instructions.ts +573 -0
- package/src/abi-manager/types.ts +150 -0
- package/src/amm/index.test.ts +8 -2
- package/src/amm/index.ts +1 -1
- package/src/clob/abi/thru/program/clob/types.ts +6981 -3070
- package/src/clob/exchange-client.test.ts +592 -0
- package/src/clob/exchange-client.ts +953 -0
- package/src/clob/exchange.test.ts +18 -16
- package/src/clob/exchange.ts +4 -0
- package/src/clob/index.test.ts +134 -7
- package/src/clob/index.ts +303 -10
- package/src/clob/price.test.ts +32 -0
- package/src/clob/price.ts +77 -0
- package/src/deploy/accounts.ts +208 -0
- package/src/deploy/chain.ts +163 -0
- package/src/deploy/constants.ts +25 -0
- package/src/deploy/deploy.test.ts +349 -0
- package/src/deploy/errors.ts +72 -0
- package/src/deploy/index.ts +44 -0
- package/src/deploy/inspection.ts +146 -0
- package/src/deploy/seeds.ts +29 -0
- package/src/deploy/types.ts +178 -0
- package/src/deploy/uploader.test.ts +326 -0
- package/src/deploy/uploader.ts +558 -0
- package/src/deploy/validation-imports.test.ts +55 -0
- package/src/deploy/validation.ts +183 -0
- package/src/deploy/workflows.test.ts +422 -0
- package/src/deploy/workflows.ts +1088 -0
- package/src/helpers/bytes.test.ts +58 -0
- package/src/helpers/bytes.ts +28 -3
- package/src/manager/abi/thru/blockchain/state_proof/types.ts +1906 -0
- package/src/manager/abi/thru/common/primitives/types.ts +2428 -0
- package/src/manager/abi/thru/program/manager/types.ts +3814 -0
- package/src/manager/accounts.ts +44 -0
- package/src/manager/constants.ts +16 -0
- package/src/manager/derivation.ts +32 -0
- package/src/manager/errors.ts +47 -0
- package/src/manager/index.test.ts +108 -0
- package/src/manager/index.ts +68 -0
- package/src/manager/instructions.ts +281 -0
- package/src/manager/types.ts +95 -0
- package/src/manager/validation.ts +35 -0
- package/src/uploader/abi/thru/common/primitives/types.ts +2428 -0
- package/src/uploader/abi/thru/program/uploader/types.ts +3022 -0
- package/src/uploader/accounts.ts +38 -0
- package/src/uploader/constants.ts +14 -0
- package/src/uploader/derivation.ts +34 -0
- package/src/uploader/errors.ts +25 -0
- package/src/uploader/index.test.ts +107 -0
- package/src/uploader/index.ts +34 -0
- package/src/uploader/instructions.ts +163 -0
- package/src/uploader/types.ts +67 -0
- package/src/utils/helpers.ts +121 -0
- package/tsup.config.ts +4 -0
- package/dist/chunk-P5OABVJI.js +0 -28
- package/dist/chunk-P5OABVJI.js.map +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Account, Pubkey } from "@thru/sdk";
|
|
2
|
+
import type { Thru } from "@thru/sdk/client";
|
|
3
|
+
import { parseManagerProgramMeta } from "../manager";
|
|
4
|
+
import {
|
|
5
|
+
parseABIAccount as parseABIManagerAccount,
|
|
6
|
+
parseABIMetaAccount,
|
|
7
|
+
} from "../abi-manager";
|
|
8
|
+
import { parseUploaderProgramMeta } from "../uploader";
|
|
9
|
+
import { bytesEqual } from "../helpers/bytes";
|
|
10
|
+
import {
|
|
11
|
+
ABI_MANAGER_PROGRAM_ADDRESS,
|
|
12
|
+
ABI_STATE_FINALIZED,
|
|
13
|
+
ABI_STATE_OPEN,
|
|
14
|
+
MANAGER_PROGRAM_ADDRESS,
|
|
15
|
+
MANAGER_STATE_FINALIZED,
|
|
16
|
+
MANAGER_STATE_OPEN,
|
|
17
|
+
UPLOADER_PROGRAM_ADDRESS,
|
|
18
|
+
} from "./constants";
|
|
19
|
+
import { DeployError, asDeployError } from "./errors";
|
|
20
|
+
|
|
21
|
+
export interface ParsedManagerMeta {
|
|
22
|
+
authority: Uint8Array;
|
|
23
|
+
version: bigint;
|
|
24
|
+
state: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ParsedABIMeta {
|
|
28
|
+
program: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ParsedABIAccount {
|
|
32
|
+
abiMetaAccount: Uint8Array;
|
|
33
|
+
revision: bigint;
|
|
34
|
+
state: number;
|
|
35
|
+
content: Uint8Array;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ParsedUploaderMeta {
|
|
39
|
+
authority: Uint8Array;
|
|
40
|
+
expectedHash: Uint8Array;
|
|
41
|
+
state: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function getOptionalAccount(
|
|
45
|
+
client: Thru,
|
|
46
|
+
address: string,
|
|
47
|
+
): Promise<Account | undefined> {
|
|
48
|
+
try {
|
|
49
|
+
return await client.accounts.get(address);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if ((error as { code?: number } | undefined)?.code === 5) return undefined;
|
|
52
|
+
throw asDeployError(
|
|
53
|
+
error,
|
|
54
|
+
"RPC_ERROR",
|
|
55
|
+
`Failed to read account ${address}`,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function requireAccountData(
|
|
61
|
+
account: Account,
|
|
62
|
+
label: string,
|
|
63
|
+
): Uint8Array {
|
|
64
|
+
const data = account.data?.data;
|
|
65
|
+
if (!data)
|
|
66
|
+
throw new DeployError("VERIFICATION_FAILED", `${label} data is missing`);
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function assertOwner(account: Account, owner: string, label: string): void {
|
|
71
|
+
if (!account.meta?.owner?.equals(owner)) {
|
|
72
|
+
throw new DeployError(
|
|
73
|
+
"VERIFICATION_FAILED",
|
|
74
|
+
`${label} has an unexpected owner`,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function assertManagedProgramAccount(
|
|
80
|
+
account: Account,
|
|
81
|
+
label = "managed program account",
|
|
82
|
+
): void {
|
|
83
|
+
assertOwner(account, MANAGER_PROGRAM_ADDRESS, label);
|
|
84
|
+
if (!account.meta?.flags.isProgram) {
|
|
85
|
+
throw new DeployError("VERIFICATION_FAILED", `${label} is not executable`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function parseManagerMeta(account: Account): ParsedManagerMeta {
|
|
90
|
+
assertOwner(account, MANAGER_PROGRAM_ADDRESS, "program metadata account");
|
|
91
|
+
try {
|
|
92
|
+
const parsed = parseManagerProgramMeta(account);
|
|
93
|
+
return {
|
|
94
|
+
authority: Pubkey.from(parsed.authorityAddress).toBytes(),
|
|
95
|
+
version: parsed.version,
|
|
96
|
+
state: parsed.state,
|
|
97
|
+
};
|
|
98
|
+
} catch (error) {
|
|
99
|
+
throw asDeployError(
|
|
100
|
+
error,
|
|
101
|
+
"VERIFICATION_FAILED",
|
|
102
|
+
"program metadata account is invalid",
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function parseABIMeta(account: Account): ParsedABIMeta {
|
|
108
|
+
assertOwner(account, ABI_MANAGER_PROGRAM_ADDRESS, "ABI metadata account");
|
|
109
|
+
const data = requireAccountData(account, "ABI metadata account");
|
|
110
|
+
let parsed;
|
|
111
|
+
try {
|
|
112
|
+
parsed = parseABIMetaAccount(data);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
throw asDeployError(
|
|
115
|
+
error,
|
|
116
|
+
"VERIFICATION_FAILED",
|
|
117
|
+
"official ABI metadata account is invalid",
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
if (parsed.kind !== "official") {
|
|
121
|
+
throw new DeployError(
|
|
122
|
+
"VERIFICATION_FAILED",
|
|
123
|
+
"ABI metadata account is not official",
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
for (let index = 36; index < data.length; index += 1) {
|
|
127
|
+
if (data[index] !== 0) {
|
|
128
|
+
throw new DeployError(
|
|
129
|
+
"VERIFICATION_FAILED",
|
|
130
|
+
"official ABI metadata reserved bytes are invalid",
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { program: Pubkey.from(parsed.programAddress).toBytes() };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function parseABIAccount(account: Account): ParsedABIAccount {
|
|
138
|
+
assertOwner(account, ABI_MANAGER_PROGRAM_ADDRESS, "ABI account");
|
|
139
|
+
try {
|
|
140
|
+
const parsed = parseABIManagerAccount(account);
|
|
141
|
+
return {
|
|
142
|
+
abiMetaAccount: Pubkey.from(parsed.abiMetaAccountAddress).toBytes(),
|
|
143
|
+
revision: parsed.revision,
|
|
144
|
+
state: parsed.state,
|
|
145
|
+
content: parsed.contents,
|
|
146
|
+
};
|
|
147
|
+
} catch (error) {
|
|
148
|
+
throw asDeployError(error, "VERIFICATION_FAILED", "ABI account is invalid");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function parseUploaderMeta(account: Account): ParsedUploaderMeta {
|
|
153
|
+
if (!account.meta?.owner?.equals(UPLOADER_PROGRAM_ADDRESS)) {
|
|
154
|
+
throw new DeployError(
|
|
155
|
+
"UPLOAD_CONFLICT",
|
|
156
|
+
"uploader metadata account has an unexpected owner",
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const parsed = parseUploaderProgramMeta(account);
|
|
161
|
+
return {
|
|
162
|
+
authority: Pubkey.from(parsed.authorityAddress).toBytes(),
|
|
163
|
+
expectedHash: parsed.expectedHash,
|
|
164
|
+
state: parsed.state,
|
|
165
|
+
};
|
|
166
|
+
} catch (error) {
|
|
167
|
+
throw asDeployError(
|
|
168
|
+
error,
|
|
169
|
+
"UPLOAD_CONFLICT",
|
|
170
|
+
"uploader metadata account is invalid",
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function assertManagerOpen(meta: ParsedManagerMeta): void {
|
|
176
|
+
if (meta.state === MANAGER_STATE_FINALIZED) {
|
|
177
|
+
throw new DeployError("TARGET_FINALIZED", "managed program is finalized");
|
|
178
|
+
}
|
|
179
|
+
if (meta.state !== MANAGER_STATE_OPEN) {
|
|
180
|
+
throw new DeployError(
|
|
181
|
+
"VERIFICATION_FAILED",
|
|
182
|
+
`managed program is not open (state ${meta.state})`,
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function assertABIOpen(abi: ParsedABIAccount): void {
|
|
188
|
+
if (abi.state === ABI_STATE_FINALIZED) {
|
|
189
|
+
throw new DeployError("TARGET_FINALIZED", "program ABI is finalized");
|
|
190
|
+
}
|
|
191
|
+
if (abi.state !== ABI_STATE_OPEN) {
|
|
192
|
+
throw new DeployError(
|
|
193
|
+
"VERIFICATION_FAILED",
|
|
194
|
+
`program ABI is not open (state ${abi.state})`,
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function assertPubkeyBytes(
|
|
200
|
+
actual: Uint8Array,
|
|
201
|
+
expected: string | Uint8Array,
|
|
202
|
+
message: string,
|
|
203
|
+
): void {
|
|
204
|
+
const expectedBytes =
|
|
205
|
+
expected instanceof Uint8Array ? expected : Pubkey.from(expected).toBytes();
|
|
206
|
+
if (!bytesEqual(actual, expectedBytes))
|
|
207
|
+
throw new DeployError("VERIFICATION_FAILED", message);
|
|
208
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConsensusStatus,
|
|
3
|
+
Signature,
|
|
4
|
+
SubmissionStatus,
|
|
5
|
+
type InstructionContext,
|
|
6
|
+
} from "@thru/sdk";
|
|
7
|
+
import type { Thru } from "@thru/sdk/client";
|
|
8
|
+
import { StateProofType } from "@thru/sdk/proto";
|
|
9
|
+
import { TRANSACTION_TIMEOUT_MS } from "./constants";
|
|
10
|
+
import { DeployError, asDeployError } from "./errors";
|
|
11
|
+
import type {
|
|
12
|
+
DeployProgressEvent,
|
|
13
|
+
DeployProgressPhase,
|
|
14
|
+
DeploymentOperation,
|
|
15
|
+
} from "./types";
|
|
16
|
+
import type { ResolvedSigner } from "./validation";
|
|
17
|
+
|
|
18
|
+
export interface DeploymentTransaction {
|
|
19
|
+
program: string;
|
|
20
|
+
readWrite?: string[];
|
|
21
|
+
readOnly?: string[];
|
|
22
|
+
instructionData:
|
|
23
|
+
| Uint8Array
|
|
24
|
+
| ((context: InstructionContext) => Uint8Array | Promise<Uint8Array>);
|
|
25
|
+
computeUnits?: number;
|
|
26
|
+
stateUnits?: number;
|
|
27
|
+
memoryUnits?: number;
|
|
28
|
+
expiryAfter?: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function emitProgress(
|
|
32
|
+
onProgress: ((event: DeployProgressEvent) => void) | undefined,
|
|
33
|
+
event: DeployProgressEvent,
|
|
34
|
+
): void {
|
|
35
|
+
if (!onProgress) return;
|
|
36
|
+
try {
|
|
37
|
+
onProgress(event);
|
|
38
|
+
} catch {
|
|
39
|
+
/* Progress observers cannot change deployment behavior. */
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function creationProof(
|
|
44
|
+
client: Thru,
|
|
45
|
+
address: string,
|
|
46
|
+
ephemeral: boolean,
|
|
47
|
+
): Promise<Uint8Array> {
|
|
48
|
+
if (ephemeral) return new Uint8Array();
|
|
49
|
+
try {
|
|
50
|
+
const proof = await client.proofs.generate({
|
|
51
|
+
address,
|
|
52
|
+
proofType: StateProofType.CREATING,
|
|
53
|
+
});
|
|
54
|
+
if (!proof.proof.length) {
|
|
55
|
+
throw new Error("empty state proof");
|
|
56
|
+
}
|
|
57
|
+
return proof.proof;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
throw asDeployError(
|
|
60
|
+
error,
|
|
61
|
+
"RPC_ERROR",
|
|
62
|
+
`Failed to create state proof for ${address}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function submitTransaction(
|
|
68
|
+
client: Thru,
|
|
69
|
+
signer: ResolvedSigner,
|
|
70
|
+
operation: DeploymentOperation,
|
|
71
|
+
phase: DeployProgressPhase,
|
|
72
|
+
transaction: DeploymentTransaction,
|
|
73
|
+
): Promise<string> {
|
|
74
|
+
let rawTransaction: Uint8Array;
|
|
75
|
+
let signature: string | undefined;
|
|
76
|
+
try {
|
|
77
|
+
const signed = await client.transactions.buildAndSign({
|
|
78
|
+
feePayer: {
|
|
79
|
+
publicKey: signer.publicKey,
|
|
80
|
+
privateKey: signer.privateKey,
|
|
81
|
+
},
|
|
82
|
+
program: transaction.program,
|
|
83
|
+
header: {
|
|
84
|
+
fee: 0n,
|
|
85
|
+
computeUnits: transaction.computeUnits ?? 500_000_000,
|
|
86
|
+
stateUnits: transaction.stateUnits ?? 5_000,
|
|
87
|
+
memoryUnits: transaction.memoryUnits ?? 5_000,
|
|
88
|
+
expiryAfter: transaction.expiryAfter ?? 10_000,
|
|
89
|
+
},
|
|
90
|
+
accounts: {
|
|
91
|
+
readWrite: transaction.readWrite,
|
|
92
|
+
readOnly: transaction.readOnly,
|
|
93
|
+
},
|
|
94
|
+
instructionData: transaction.instructionData,
|
|
95
|
+
});
|
|
96
|
+
rawTransaction = signed.rawTransaction;
|
|
97
|
+
signature = signed.signature.toThruFmt();
|
|
98
|
+
} catch (error) {
|
|
99
|
+
throw asDeployError(
|
|
100
|
+
error,
|
|
101
|
+
"RPC_ERROR",
|
|
102
|
+
"Failed to build deployment transaction",
|
|
103
|
+
{
|
|
104
|
+
operation,
|
|
105
|
+
phase,
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let accepted = false;
|
|
111
|
+
let finalized = false;
|
|
112
|
+
try {
|
|
113
|
+
for await (const update of client.transactions.sendAndTrack(
|
|
114
|
+
rawTransaction,
|
|
115
|
+
{
|
|
116
|
+
timeoutMs: TRANSACTION_TIMEOUT_MS,
|
|
117
|
+
},
|
|
118
|
+
)) {
|
|
119
|
+
if (update.signature?.value) {
|
|
120
|
+
signature = Signature.from(update.signature.value).toThruFmt();
|
|
121
|
+
}
|
|
122
|
+
if (update.status === SubmissionStatus.ACCEPTED) accepted = true;
|
|
123
|
+
if (
|
|
124
|
+
update.consensusStatus === ConsensusStatus.FINALIZED ||
|
|
125
|
+
update.consensusStatus === ConsensusStatus.CLUSTER_EXECUTED
|
|
126
|
+
) {
|
|
127
|
+
finalized = true;
|
|
128
|
+
}
|
|
129
|
+
if (!update.executionResult) continue;
|
|
130
|
+
|
|
131
|
+
const { vmError, userErrorCode } = update.executionResult;
|
|
132
|
+
if (vmError !== 0 || userErrorCode !== 0n) {
|
|
133
|
+
throw new DeployError(
|
|
134
|
+
"TRANSACTION_FAILED",
|
|
135
|
+
"Deployment transaction failed",
|
|
136
|
+
{
|
|
137
|
+
operation,
|
|
138
|
+
phase,
|
|
139
|
+
transactionSignature: signature,
|
|
140
|
+
vmError,
|
|
141
|
+
userErrorCode,
|
|
142
|
+
},
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
return signature;
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (error instanceof DeployError) throw error;
|
|
149
|
+
throw new DeployError(
|
|
150
|
+
"OUTCOME_UNKNOWN",
|
|
151
|
+
accepted || finalized
|
|
152
|
+
? "Transaction was submitted but its final outcome is unknown"
|
|
153
|
+
: "Transaction submission may have succeeded, but no outcome was received",
|
|
154
|
+
{ operation, phase, transactionSignature: signature, cause: error },
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
throw new DeployError(
|
|
159
|
+
"OUTCOME_UNKNOWN",
|
|
160
|
+
"Transaction tracking ended before execution was confirmed",
|
|
161
|
+
{ operation, phase, transactionSignature: signature },
|
|
162
|
+
);
|
|
163
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export {
|
|
2
|
+
MANAGER_META_SIZE,
|
|
3
|
+
MANAGER_PROGRAM_ADDRESS,
|
|
4
|
+
MANAGER_STATE_FINALIZED,
|
|
5
|
+
MANAGER_STATE_OPEN,
|
|
6
|
+
} from "../manager";
|
|
7
|
+
export {
|
|
8
|
+
ABI_ACCOUNT_HEADER_SIZE,
|
|
9
|
+
ABI_MANAGER_PROGRAM_ADDRESS,
|
|
10
|
+
ABI_META_SIZE,
|
|
11
|
+
ABI_STATE_FINALIZED,
|
|
12
|
+
ABI_STATE_OPEN,
|
|
13
|
+
} from "../abi-manager";
|
|
14
|
+
export { MULTICALL_PROGRAM_ADDRESS } from "../multicall";
|
|
15
|
+
export {
|
|
16
|
+
UPLOADER_DEFAULT_CHUNK_SIZE as DEFAULT_CHUNK_SIZE,
|
|
17
|
+
UPLOADER_MAX_CHUNK_SIZE as MAX_CHUNK_SIZE,
|
|
18
|
+
UPLOADER_META_SIZE,
|
|
19
|
+
UPLOADER_MIN_CHUNK_SIZE as MIN_CHUNK_SIZE,
|
|
20
|
+
UPLOADER_PROGRAM_ADDRESS,
|
|
21
|
+
UPLOADER_STATE_FINALIZED,
|
|
22
|
+
UPLOADER_STATE_OPEN,
|
|
23
|
+
} from "../uploader";
|
|
24
|
+
|
|
25
|
+
export const TRANSACTION_TIMEOUT_MS = 60_000;
|