@hawksightco/hawk-sdk 1.1.5 → 1.1.6-4.test
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/addresses.d.ts +2 -1
- package/dist/src/addresses.d.ts.map +1 -1
- package/dist/src/addresses.js +3 -1
- package/dist/src/anchor.d.ts +113 -2
- package/dist/src/anchor.d.ts.map +1 -1
- package/dist/src/anchor.js +33 -1
- package/dist/src/classes/AltStorage.d.ts +29 -0
- package/dist/src/classes/AltStorage.d.ts.map +1 -0
- package/dist/src/classes/AltStorage.js +58 -0
- package/dist/src/classes/Atomicity.d.ts +34 -0
- package/dist/src/classes/Atomicity.d.ts.map +1 -0
- package/dist/src/classes/Atomicity.js +110 -0
- package/dist/src/classes/CreateTxMetadata.d.ts +16 -1
- package/dist/src/classes/CreateTxMetadata.d.ts.map +1 -1
- package/dist/src/classes/CreateTxMetadata.js +115 -6
- package/dist/src/classes/General.d.ts +16 -1
- package/dist/src/classes/General.d.ts.map +1 -1
- package/dist/src/classes/General.js +32 -0
- package/dist/src/classes/HawkAPI.d.ts +32 -0
- package/dist/src/classes/HawkAPI.d.ts.map +1 -1
- package/dist/src/classes/HawkAPI.js +37 -0
- package/dist/src/classes/JupiterAlts.d.ts +37 -0
- package/dist/src/classes/JupiterAlts.d.ts.map +1 -0
- package/dist/src/classes/JupiterAlts.js +104 -0
- package/dist/src/classes/JupiterSwap.d.ts +19 -0
- package/dist/src/classes/JupiterSwap.d.ts.map +1 -0
- package/dist/src/classes/JupiterSwap.js +37 -0
- package/dist/src/classes/Logging.d.ts +13 -0
- package/dist/src/classes/Logging.d.ts.map +1 -0
- package/dist/src/classes/Logging.js +51 -0
- package/dist/src/classes/MultiTransaction.d.ts +75 -0
- package/dist/src/classes/MultiTransaction.d.ts.map +1 -0
- package/dist/src/classes/MultiTransaction.js +286 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts +34 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +1 -0
- package/dist/src/classes/SimpleIxGenerator.js +39 -0
- package/dist/src/classes/SimplePdaGenerator.d.ts +28 -0
- package/dist/src/classes/SimplePdaGenerator.d.ts.map +1 -0
- package/dist/src/classes/SimplePdaGenerator.js +33 -0
- package/dist/src/classes/Transaction.d.ts +42 -13
- package/dist/src/classes/Transaction.d.ts.map +1 -1
- package/dist/src/classes/Transaction.js +37 -15
- package/dist/src/classes/Transaction2.d.ts +107 -0
- package/dist/src/classes/Transaction2.d.ts.map +1 -0
- package/dist/src/classes/Transaction2.js +239 -0
- package/dist/src/classes/Transaction3.d.ts +165 -0
- package/dist/src/classes/Transaction3.d.ts.map +1 -0
- package/dist/src/classes/Transaction3.js +406 -0
- package/dist/src/classes/TransactionBatchExecute.d.ts +163 -0
- package/dist/src/classes/TransactionBatchExecute.d.ts.map +1 -0
- package/dist/src/classes/TransactionBatchExecute.js +456 -0
- package/dist/src/classes/TransactionBatchExecute2.d.ts +99 -0
- package/dist/src/classes/TransactionBatchExecute2.d.ts.map +1 -0
- package/dist/src/classes/TransactionBatchExecute2.js +347 -0
- package/dist/src/classes/Transactions.d.ts +102 -10
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +890 -116
- package/dist/src/classes/TxGenerator.d.ts +95 -2
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +333 -5
- package/dist/src/classes/TxGeneratorAutomations.d.ts +23 -2
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +72 -0
- package/dist/src/classes/Util.d.ts +22 -0
- package/dist/src/classes/Util.d.ts.map +1 -1
- package/dist/src/classes/Util.js +33 -0
- package/dist/src/functions.d.ts +81 -4
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +442 -8
- package/dist/src/hawksight.d.ts +14 -1
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +52 -2
- package/dist/src/hsToMeteora.d.ts +7 -1
- package/dist/src/hsToMeteora.d.ts.map +1 -1
- package/dist/src/hsToMeteora.js +563 -32
- package/dist/src/idl/iyf-extension-idl.d.ts +9207 -4250
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +9261 -4310
- package/dist/src/idl/iyf-main-idl.d.ts +244 -5
- package/dist/src/idl/iyf-main-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-main-idl.js +244 -5
- package/dist/src/idl/jupiter-idl.d.ts +1767 -0
- package/dist/src/idl/jupiter-idl.d.ts.map +1 -0
- package/dist/src/idl/jupiter-idl.js +1768 -0
- package/dist/src/idl/meteora-idl.d.ts +5251 -0
- package/dist/src/idl/meteora-idl.d.ts.map +1 -0
- package/dist/src/idl/meteora-idl.js +5252 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -1
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts +26 -0
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.js +72 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +119 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +295 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +49 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +279 -0
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts +23 -0
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/OrcaIxGenerator.js +119 -0
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts +20 -0
- package/dist/src/ixGenerator/UtilIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/UtilIxGenerator.js +25 -0
- package/dist/src/meteora.d.ts +230 -2
- package/dist/src/meteora.d.ts.map +1 -1
- package/dist/src/meteora.js +704 -11
- package/dist/src/orca.d.ts +16 -1
- package/dist/src/orca.d.ts.map +1 -1
- package/dist/src/orca.js +29 -1
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts +23 -0
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/HawksightPdaGenerator.js +56 -0
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts +6 -0
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/MeteoraPdaGenerator.js +9 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts +15 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.js +45 -0
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts +6 -0
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/RaydiumPdaGenerator.js +9 -0
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts +8 -0
- package/dist/src/pdaGenerator/UtilPdaGenerator.d.ts.map +1 -0
- package/dist/src/pdaGenerator/UtilPdaGenerator.js +41 -0
- package/dist/src/types.d.ts +81 -15
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +31 -5
- package/package.json +3 -2
package/dist/src/addresses.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
|
|
2
1
|
import * as web3 from "@solana/web3.js";
|
|
3
2
|
export declare const GLOBAL_ALT: string[];
|
|
4
3
|
export declare const IYF_MAIN: web3.PublicKey;
|
|
@@ -11,8 +10,10 @@ export declare const SITE_FEE_OWNER: web3.PublicKey;
|
|
|
11
10
|
export declare const USDC_FARM: web3.PublicKey;
|
|
12
11
|
export declare const SOME_METEORA_DLMM_POOL: web3.PublicKey;
|
|
13
12
|
export declare const METEORA_DLMM_PROGRAM: web3.PublicKey;
|
|
13
|
+
export declare const METEORA_EVENT_AUTHORITY: web3.PublicKey;
|
|
14
14
|
export declare const COMPUTE_BUDGET: web3.PublicKey;
|
|
15
15
|
export declare const HS_AUTHORITY: web3.PublicKey;
|
|
16
16
|
export declare const ORCA_WHIRLPOOL_PROGRAM: web3.PublicKey;
|
|
17
17
|
export declare const WSOL_MINT: web3.PublicKey;
|
|
18
|
+
export declare const JUPITER_PROGRAM: web3.PublicKey;
|
|
18
19
|
//# sourceMappingURL=addresses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src/addresses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../src/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,eAAO,MAAM,UAAU,UAYtB,CAAC;AAEF,eAAO,MAAM,QAAQ,gBAAqE,CAAC;AAC3F,eAAO,MAAM,aAAa,gBAAqE,CAAC;AAChG,eAAO,MAAM,YAAY,gBAAqE,CAAC;AAC/F,eAAO,MAAM,YAAY,gBAAqE,CAAC;AAC/F,eAAO,MAAM,gBAAgB,gBAAoE,CAAC;AAClG,eAAO,MAAM,wBAAwB,gBAAqE,CAAC;AAC3G,eAAO,MAAM,cAAc,gBAAqE,CAAC;AACjG,eAAO,MAAM,SAAS,gBAAqE,CAAC;AAC5F,eAAO,MAAM,sBAAsB,gBAAqE,CAAC;AACzG,eAAO,MAAM,oBAAoB,gBAAoE,CAAC;AACtG,eAAO,MAAM,uBAAuB,gBAAqE,CAAC;AAC1G,eAAO,MAAM,cAAc,gBAAoE,CAAC;AAChG,eAAO,MAAM,YAAY,gBAAoE,CAAC;AAC9F,eAAO,MAAM,sBAAsB,gBAAoE,CAAC;AACxG,eAAO,MAAM,SAAS,gBAAoE,CAAC;AAC3F,eAAO,MAAM,eAAe,gBAAoE,CAAC"}
|
package/dist/src/addresses.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.WSOL_MINT = exports.ORCA_WHIRLPOOL_PROGRAM = exports.HS_AUTHORITY = exports.COMPUTE_BUDGET = exports.METEORA_DLMM_PROGRAM = exports.SOME_METEORA_DLMM_POOL = exports.USDC_FARM = exports.SITE_FEE_OWNER = exports.ASSOCIATED_TOKEN_PROGRAM = exports.TOKEN_PROGRAM_ID = exports.STABLEMINT_2 = exports.STABLEMINT_1 = exports.IYF_EXTENSION = exports.IYF_MAIN = exports.GLOBAL_ALT = void 0;
|
|
26
|
+
exports.JUPITER_PROGRAM = exports.WSOL_MINT = exports.ORCA_WHIRLPOOL_PROGRAM = exports.HS_AUTHORITY = exports.COMPUTE_BUDGET = exports.METEORA_EVENT_AUTHORITY = exports.METEORA_DLMM_PROGRAM = exports.SOME_METEORA_DLMM_POOL = exports.USDC_FARM = exports.SITE_FEE_OWNER = exports.ASSOCIATED_TOKEN_PROGRAM = exports.TOKEN_PROGRAM_ID = exports.STABLEMINT_2 = exports.STABLEMINT_1 = exports.IYF_EXTENSION = exports.IYF_MAIN = exports.GLOBAL_ALT = void 0;
|
|
27
27
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
28
28
|
exports.GLOBAL_ALT = [
|
|
29
29
|
"AC3t5k5PUTJirxGEHgGGQStafu1vXkvddPyqVNDrRQDt",
|
|
@@ -48,7 +48,9 @@ exports.SITE_FEE_OWNER = new web3.PublicKey("4K3a2ucXiGvuMJMPNneRDyzmNp6i4RdzXJm
|
|
|
48
48
|
exports.USDC_FARM = new web3.PublicKey("7jLQhREMxXjKdpwVuN6gwsWt3BNfAg9WqbepffPbi4ww");
|
|
49
49
|
exports.SOME_METEORA_DLMM_POOL = new web3.PublicKey("7eexH14UjhNxJe6zTT3f1Vb1E8iACsBMVaWheDEmxdT2");
|
|
50
50
|
exports.METEORA_DLMM_PROGRAM = new web3.PublicKey("LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo");
|
|
51
|
+
exports.METEORA_EVENT_AUTHORITY = new web3.PublicKey("D1ZN9Wj1fRSUQfCjhvnu1hqDMT7hzjzBBpi12nVniYD6");
|
|
51
52
|
exports.COMPUTE_BUDGET = new web3.PublicKey("ComputeBudget111111111111111111111111111111");
|
|
52
53
|
exports.HS_AUTHORITY = new web3.PublicKey("dche7M2764e8AxNihBdn7uffVzZvTBNeL8x4LZg5E2c");
|
|
53
54
|
exports.ORCA_WHIRLPOOL_PROGRAM = new web3.PublicKey("whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc");
|
|
54
55
|
exports.WSOL_MINT = new web3.PublicKey("So11111111111111111111111111111111111111112");
|
|
56
|
+
exports.JUPITER_PROGRAM = new web3.PublicKey("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4");
|
package/dist/src/anchor.d.ts
CHANGED
|
@@ -1,9 +1,118 @@
|
|
|
1
|
-
/// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
|
|
2
1
|
import * as web3 from "@solana/web3.js";
|
|
3
2
|
import * as anchor from "@coral-xyz/anchor";
|
|
4
3
|
import { IndexYieldFarming } from "./idl/iyf-main-idl";
|
|
5
|
-
import { IyfExtension } from "./idl/iyf-extension-idl";
|
|
4
|
+
import { IyfExtension as IyfExtensionNew } from "./idl/iyf-extension-idl";
|
|
6
5
|
import { Whirlpool } from "./idl/orca-idl";
|
|
6
|
+
import { LbClmm } from "./idl/meteora-idl";
|
|
7
|
+
type IdlInstruction = {
|
|
8
|
+
name: string;
|
|
9
|
+
docs?: string[];
|
|
10
|
+
accounts: IdlAccountItem[];
|
|
11
|
+
args: IdlField[];
|
|
12
|
+
returns?: IdlType;
|
|
13
|
+
};
|
|
14
|
+
type IdlAccountItem = IdlAccount | IdlAccounts;
|
|
15
|
+
type IdlAccount = {
|
|
16
|
+
name: string;
|
|
17
|
+
isMut: boolean;
|
|
18
|
+
isSigner: boolean;
|
|
19
|
+
isOptional?: boolean;
|
|
20
|
+
docs?: string[];
|
|
21
|
+
relations?: string[];
|
|
22
|
+
pda?: IdlPda;
|
|
23
|
+
};
|
|
24
|
+
type IdlPda = {
|
|
25
|
+
seeds: IdlSeed[];
|
|
26
|
+
programId?: IdlSeed;
|
|
27
|
+
};
|
|
28
|
+
type IdlSeed = any;
|
|
29
|
+
type IdlAccounts = {
|
|
30
|
+
name: string;
|
|
31
|
+
docs?: string[];
|
|
32
|
+
accounts: IdlAccountItem[];
|
|
33
|
+
};
|
|
34
|
+
type IdlField = {
|
|
35
|
+
name: string;
|
|
36
|
+
docs?: string[];
|
|
37
|
+
type: IdlType;
|
|
38
|
+
};
|
|
39
|
+
type IdlType = "bool" | "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "f32" | "u64" | "i64" | "f64" | "u128" | "i128" | "u256" | "i256" | "bytes" | "string" | "publicKey" | IdlTypeDefined | IdlTypeOption | IdlTypeCOption | IdlTypeVec | IdlTypeArray;
|
|
40
|
+
type IdlTypeDefined = {
|
|
41
|
+
defined: string;
|
|
42
|
+
};
|
|
43
|
+
type IdlTypeOption = {
|
|
44
|
+
option: IdlType;
|
|
45
|
+
};
|
|
46
|
+
type IdlTypeCOption = {
|
|
47
|
+
coption: IdlType;
|
|
48
|
+
};
|
|
49
|
+
type IdlTypeVec = {
|
|
50
|
+
vec: IdlType;
|
|
51
|
+
};
|
|
52
|
+
type IdlTypeArray = {
|
|
53
|
+
array: [idlType: IdlType, size: number];
|
|
54
|
+
};
|
|
55
|
+
type IdlAccountDef = {
|
|
56
|
+
name: string;
|
|
57
|
+
docs?: string[];
|
|
58
|
+
type: IdlTypeDefTyStruct;
|
|
59
|
+
};
|
|
60
|
+
type IdlTypeDefTyStruct = {
|
|
61
|
+
kind: "struct";
|
|
62
|
+
fields: IdlTypeDefStruct;
|
|
63
|
+
};
|
|
64
|
+
type IdlTypeDefStruct = Array<IdlField>;
|
|
65
|
+
type IdlTypeDef = {
|
|
66
|
+
name: string;
|
|
67
|
+
docs?: string[];
|
|
68
|
+
type: IdlTypeDefTy;
|
|
69
|
+
};
|
|
70
|
+
type IdlTypeDefTy = IdlTypeDefTyEnum | IdlTypeDefTyStruct | IdlTypeDefTyAlias;
|
|
71
|
+
type IdlTypeDefTyEnum = {
|
|
72
|
+
kind: "enum";
|
|
73
|
+
variants: IdlEnumVariant[];
|
|
74
|
+
};
|
|
75
|
+
type IdlEnumVariant = {
|
|
76
|
+
name: string;
|
|
77
|
+
fields?: IdlEnumFields;
|
|
78
|
+
};
|
|
79
|
+
type IdlTypeDefTyAlias = {
|
|
80
|
+
kind: "alias";
|
|
81
|
+
value: IdlType;
|
|
82
|
+
};
|
|
83
|
+
type IdlEnumFields = IdlEnumFieldsNamed | IdlEnumFieldsTuple;
|
|
84
|
+
type IdlEnumFieldsNamed = IdlField[];
|
|
85
|
+
type IdlEnumFieldsTuple = IdlType[];
|
|
86
|
+
type Instruction<I extends number> = {
|
|
87
|
+
name: IyfExtensionNew["instructions"][I]["name"];
|
|
88
|
+
accounts: IyfExtensionNew["instructions"][I]["accounts"];
|
|
89
|
+
args: IyfExtensionNew["instructions"][I]["args"];
|
|
90
|
+
} & IdlInstruction;
|
|
91
|
+
type GenerateInstructions<T extends any[], I extends number[] = []> = I["length"] extends T["length"] ? [] : [
|
|
92
|
+
Instruction<I["length"]>,
|
|
93
|
+
...GenerateInstructions<T, [...I, I["length"]]>
|
|
94
|
+
];
|
|
95
|
+
type FilteredInstructions = GenerateInstructions<IyfExtensionNew["instructions"]>;
|
|
96
|
+
type FindMatchingType<Name, Types extends any[]> = Types extends Array<infer T> ? T extends {
|
|
97
|
+
name: Name;
|
|
98
|
+
type: infer Type;
|
|
99
|
+
} ? Type : never : never;
|
|
100
|
+
type Account<I extends number> = {
|
|
101
|
+
name: unknown extends IyfExtensionNew["accounts"][I]["name"] ? never : IyfExtensionNew["accounts"][I]["name"];
|
|
102
|
+
type: unknown extends IyfExtensionNew["accounts"][I]["name"] ? never : FindMatchingType<IyfExtensionNew["accounts"][I]["name"], IyfExtensionNew["types"]>;
|
|
103
|
+
} & IdlAccountDef;
|
|
104
|
+
type GenerateAccounts<T extends any[], I extends number[] = []> = I["length"] extends T["length"] ? [] : [
|
|
105
|
+
Account<I["length"]>,
|
|
106
|
+
...GenerateAccounts<T, [...I, I["length"]]>
|
|
107
|
+
];
|
|
108
|
+
type FilteredAccounts = GenerateAccounts<IyfExtensionNew["accounts"]>;
|
|
109
|
+
export type IyfExtension = {
|
|
110
|
+
"version": string;
|
|
111
|
+
"name": string;
|
|
112
|
+
"instructions": FilteredInstructions;
|
|
113
|
+
"accounts": FilteredAccounts;
|
|
114
|
+
"types": IyfExtensionNew["types"] & Array<IdlTypeDef>;
|
|
115
|
+
};
|
|
7
116
|
export declare class Anchor {
|
|
8
117
|
connection: web3.Connection;
|
|
9
118
|
private static _instance;
|
|
@@ -11,8 +120,10 @@ export declare class Anchor {
|
|
|
11
120
|
iyfMain: anchor.Program<IndexYieldFarming>;
|
|
12
121
|
iyfExtension: anchor.Program<IyfExtension>;
|
|
13
122
|
orcaProgram: anchor.Program<Whirlpool>;
|
|
123
|
+
meteoraProgram: anchor.Program<LbClmm>;
|
|
14
124
|
private constructor();
|
|
15
125
|
static initialize(connection: web3.Connection): void;
|
|
16
126
|
static instance(): Anchor;
|
|
17
127
|
}
|
|
128
|
+
export {};
|
|
18
129
|
//# sourceMappingURL=anchor.d.ts.map
|
package/dist/src/anchor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/anchor.ts"],"names":[],"mappings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,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,oBAAoB,CAAC;IACrC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,qBAAa,MAAM;IAUR,UAAU,EAAE,IAAI,CAAC,UAAU;IARpC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAS;IACjC,QAAQ,EAAE,MAAM,CAAC,cAAc,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO;IAwCP,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAI7C,MAAM,CAAC,QAAQ,IAAI,MAAM;CAO1B"}
|
package/dist/src/anchor.js
CHANGED
|
@@ -32,6 +32,7 @@ const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
|
32
32
|
const iyf_main_idl_1 = require("./idl/iyf-main-idl");
|
|
33
33
|
const iyf_extension_idl_1 = require("./idl/iyf-extension-idl");
|
|
34
34
|
const orca_idl_1 = require("./idl/orca-idl");
|
|
35
|
+
const meteora_idl_1 = require("./idl/meteora-idl");
|
|
35
36
|
const nodewallet_1 = __importDefault(require("@coral-xyz/anchor/dist/cjs/nodewallet"));
|
|
36
37
|
const addresses_1 = require("./addresses");
|
|
37
38
|
class Anchor {
|
|
@@ -39,8 +40,39 @@ class Anchor {
|
|
|
39
40
|
this.connection = connection;
|
|
40
41
|
this.provider = new anchor.AnchorProvider(connection, new nodewallet_1.default(web3.Keypair.generate()), {});
|
|
41
42
|
this.iyfMain = new anchor.Program(iyf_main_idl_1.IDL, addresses_1.IYF_MAIN, this.provider);
|
|
42
|
-
|
|
43
|
+
const p = iyf_extension_idl_1.IDL.instructions.map(instruction => {
|
|
44
|
+
return {
|
|
45
|
+
name: instruction.name,
|
|
46
|
+
accounts: [instruction.accounts.map(account => {
|
|
47
|
+
return {
|
|
48
|
+
name: account.name,
|
|
49
|
+
isMut: "writable" in account ? account.writable : false,
|
|
50
|
+
isSigner: "signer" in account ? account.signer : false,
|
|
51
|
+
};
|
|
52
|
+
})],
|
|
53
|
+
args: instruction.args,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const IyfExtension = {
|
|
57
|
+
version: iyf_extension_idl_1.IDL.metadata.version,
|
|
58
|
+
name: iyf_extension_idl_1.IDL.metadata.name,
|
|
59
|
+
instructions: iyf_extension_idl_1.IDL.instructions.map((instruction, index) => {
|
|
60
|
+
return {
|
|
61
|
+
name: instruction.name,
|
|
62
|
+
accounts: instruction.accounts.map(account => {
|
|
63
|
+
return {
|
|
64
|
+
name: account.name,
|
|
65
|
+
isMut: "writable" in account ? account.writable : false,
|
|
66
|
+
isSigner: "signer" in account ? account.signer : false,
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
args: instruction.args,
|
|
70
|
+
};
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
73
|
+
this.iyfExtension = new anchor.Program(IyfExtension, addresses_1.IYF_EXTENSION, this.provider);
|
|
43
74
|
this.orcaProgram = new anchor.Program(orca_idl_1.IDL, addresses_1.ORCA_WHIRLPOOL_PROGRAM, this.provider);
|
|
75
|
+
this.meteoraProgram = new anchor.Program(meteora_idl_1.IDL, addresses_1.METEORA_DLMM_PROGRAM, this.provider);
|
|
44
76
|
}
|
|
45
77
|
static initialize(connection) {
|
|
46
78
|
Anchor._instance = new Anchor(connection);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
export declare class AltStorage {
|
|
3
|
+
private static _instance;
|
|
4
|
+
static instance(): AltStorage;
|
|
5
|
+
/**
|
|
6
|
+
* Override property to override behavior of this class
|
|
7
|
+
*/
|
|
8
|
+
override: {
|
|
9
|
+
loadSingleAlt: (alt: string, connection?: web3.Connection) => Promise<web3.AddressLookupTableAccount>;
|
|
10
|
+
getAlt: (alt: string) => Promise<web3.AddressLookupTableAccount | null>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Loads a single address lookup table account.
|
|
14
|
+
*
|
|
15
|
+
* @param alt - The address lookup table account address as a string.
|
|
16
|
+
* @param connection - (Optional) A specific Solana blockchain connection object to use.
|
|
17
|
+
* @returns A promise that resolves to the address lookup table account.
|
|
18
|
+
* @throws Error if the address lookup table does not exist.
|
|
19
|
+
*/
|
|
20
|
+
loadSingleAlt(alt: string, connection?: web3.Connection): Promise<web3.AddressLookupTableAccount>;
|
|
21
|
+
/**
|
|
22
|
+
* Gets an address lookup table account.
|
|
23
|
+
*
|
|
24
|
+
* @param alt - The address lookup table account address as a string.
|
|
25
|
+
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
26
|
+
*/
|
|
27
|
+
getAlt(alt: string): Promise<web3.AddressLookupTableAccount | null>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=AltStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AltStorage.d.ts","sourceRoot":"","sources":["../../../src/classes/AltStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,qBAAa,UAAU;IAErB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAa;IACrC,MAAM,CAAC,QAAQ;IAOf;;OAEG;IACH,QAAQ,EAAE;QACR,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACtG,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;KACxE,CAOA;IACD;;;;;;;OAOG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;IAIvG;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;CAG1E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AltStorage = void 0;
|
|
13
|
+
class AltStorage {
|
|
14
|
+
constructor() {
|
|
15
|
+
/**
|
|
16
|
+
* Override property to override behavior of this class
|
|
17
|
+
*/
|
|
18
|
+
this.override = {
|
|
19
|
+
loadSingleAlt: (alt, connection) => {
|
|
20
|
+
throw new Error('Not yet implemented.');
|
|
21
|
+
},
|
|
22
|
+
getAlt: (alt) => {
|
|
23
|
+
throw new Error('Not yet implemented.');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static instance() {
|
|
28
|
+
if (this._instance === undefined) {
|
|
29
|
+
this._instance = new AltStorage();
|
|
30
|
+
}
|
|
31
|
+
return this._instance;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Loads a single address lookup table account.
|
|
35
|
+
*
|
|
36
|
+
* @param alt - The address lookup table account address as a string.
|
|
37
|
+
* @param connection - (Optional) A specific Solana blockchain connection object to use.
|
|
38
|
+
* @returns A promise that resolves to the address lookup table account.
|
|
39
|
+
* @throws Error if the address lookup table does not exist.
|
|
40
|
+
*/
|
|
41
|
+
loadSingleAlt(alt, connection) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
return yield this.override.loadSingleAlt(alt, connection);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets an address lookup table account.
|
|
48
|
+
*
|
|
49
|
+
* @param alt - The address lookup table account address as a string.
|
|
50
|
+
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
51
|
+
*/
|
|
52
|
+
getAlt(alt) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return this.override.getAlt(alt);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.AltStorage = AltStorage;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as web3 from '@solana/web3.js';
|
|
2
|
+
import { DummySigners, TransactionBatchExecute } from "./TransactionBatchExecute";
|
|
3
|
+
import { SimpleIxGenerator } from './SimpleIxGenerator';
|
|
4
|
+
import { JupiterAlts } from './JupiterAlts';
|
|
5
|
+
export declare class Atomicity extends TransactionBatchExecute {
|
|
6
|
+
private ixGenerator;
|
|
7
|
+
/**
|
|
8
|
+
* User wallet
|
|
9
|
+
*/
|
|
10
|
+
private userWallet?;
|
|
11
|
+
constructor(lookupTableAddresses: web3.PublicKey[], instructions: web3.TransactionInstruction[], payer: web3.Keypair, connection: web3.Connection, signers: web3.Keypair[] | undefined, jupiterAlts: JupiterAlts, ixGenerator: SimpleIxGenerator);
|
|
12
|
+
/**
|
|
13
|
+
* Set user wallet
|
|
14
|
+
*/
|
|
15
|
+
setUserWallet(userWallet: web3.PublicKey): void;
|
|
16
|
+
/**
|
|
17
|
+
* Check whether instruction is an atomicity instruction
|
|
18
|
+
* @param ix
|
|
19
|
+
*/
|
|
20
|
+
private isAtomicityIx;
|
|
21
|
+
/**
|
|
22
|
+
* Builds a batch of executable transaction instructions
|
|
23
|
+
*/
|
|
24
|
+
buildBatch(): Promise<web3.TransactionInstruction[][]>;
|
|
25
|
+
/**
|
|
26
|
+
* Split transactions
|
|
27
|
+
*
|
|
28
|
+
* @param simulationIxs
|
|
29
|
+
* @param dummySigners
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
protected splitToTransactions(simulationIxs: web3.TransactionInstruction[], dummySigners: DummySigners): Promise<web3.TransactionInstruction[][]>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=Atomicity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Atomicity.d.ts","sourceRoot":"","sources":["../../../src/classes/Atomicity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,SAAU,SAAQ,uBAAuB;IAclD,OAAO,CAAC,WAAW;IAZrB;;OAEG;IACH,OAAO,CAAC,UAAU,CAAC,CAAiB;gBAGlC,oBAAoB,EAAE,IAAI,CAAC,SAAS,EAAE,EACtC,YAAY,EAAE,IAAI,CAAC,sBAAsB,EAAE,EAC3C,KAAK,EAAE,IAAI,CAAC,OAAO,EACnB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,OAAO,4BAAqB,EAC5B,WAAW,EAAE,WAAW,EAChB,WAAW,EAAE,iBAAiB;IAYxC;;OAEG;IACH,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS;IAIxC;;;OAGG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;IA4B5D;;;;;;OAMG;cACa,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,sBAAsB,EAAE,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;CAiDxJ"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Atomicity = void 0;
|
|
13
|
+
const TransactionBatchExecute_1 = require("./TransactionBatchExecute");
|
|
14
|
+
const functions_1 = require("../functions");
|
|
15
|
+
class Atomicity extends TransactionBatchExecute_1.TransactionBatchExecute {
|
|
16
|
+
constructor(lookupTableAddresses, instructions, payer, connection, signers = [], jupiterAlts, ixGenerator) {
|
|
17
|
+
super(lookupTableAddresses, instructions, payer, connection, signers, jupiterAlts);
|
|
18
|
+
this.ixGenerator = ixGenerator;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set user wallet
|
|
22
|
+
*/
|
|
23
|
+
setUserWallet(userWallet) {
|
|
24
|
+
this.userWallet = userWallet;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check whether instruction is an atomicity instruction
|
|
28
|
+
* @param ix
|
|
29
|
+
*/
|
|
30
|
+
isAtomicityIx(ix) {
|
|
31
|
+
return ix.data.length >= 8 && (0, functions_1.sighashMatch)(ix.data, "setTransactionSlot") || (0, functions_1.sighashMatch)(ix.data, "verifyTransactionSlot");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds a batch of executable transaction instructions
|
|
35
|
+
*/
|
|
36
|
+
buildBatch() {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
// Download address lookup table from given cluster
|
|
39
|
+
yield this.downloadAlts();
|
|
40
|
+
// Generate dummy instructions for batch calculation
|
|
41
|
+
const [simulationIxs, dummySigners] = this.generateSimulationIxs();
|
|
42
|
+
// Split simulation ixs
|
|
43
|
+
const dummyBatches = yield this.splitToTransactions(simulationIxs, dummySigners);
|
|
44
|
+
// Batch of actual instructions
|
|
45
|
+
const batch = [];
|
|
46
|
+
let index = 0;
|
|
47
|
+
for (const dummyIxs of dummyBatches) {
|
|
48
|
+
const currentBatch = [];
|
|
49
|
+
for (const dummyIx of dummyIxs) {
|
|
50
|
+
if (this.isAtomicityIx(dummyIx)) {
|
|
51
|
+
currentBatch.push(dummyIx);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
currentBatch.push(this.instructions[index++]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
batch.push(currentBatch);
|
|
58
|
+
}
|
|
59
|
+
return batch;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Split transactions
|
|
64
|
+
*
|
|
65
|
+
* @param simulationIxs
|
|
66
|
+
* @param dummySigners
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
splitToTransactions(simulationIxs, dummySigners) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
// Fetch latest blockhash required to calculate transaction size
|
|
72
|
+
const latestBlockhash = yield this.connection.getLatestBlockhash();
|
|
73
|
+
// User wallet must be set
|
|
74
|
+
if (this.userWallet === undefined) {
|
|
75
|
+
throw new Error(`Atomicity.userWallet is not set`);
|
|
76
|
+
}
|
|
77
|
+
// Generate set transaction slot instruction
|
|
78
|
+
const setTransactionSlotIx = yield this.ixGenerator.iyfMain.setTransactionSlot(this.connection, { userWallet: this.userWallet });
|
|
79
|
+
// Generate verify transaction slot instruction
|
|
80
|
+
const verifyTransactionSlotIx = yield this.ixGenerator.iyfMain.verifyTransactionSlot(this.connection, { userWallet: this.userWallet });
|
|
81
|
+
// Run simulation
|
|
82
|
+
let batch = [];
|
|
83
|
+
let result = [];
|
|
84
|
+
let postIx;
|
|
85
|
+
for (const ix of simulationIxs) {
|
|
86
|
+
// Include dummy ix to transaction
|
|
87
|
+
batch.push(ix);
|
|
88
|
+
// Include setTransactionSlot instruction if result batch is still zero
|
|
89
|
+
if (result.length === 0) {
|
|
90
|
+
postIx = setTransactionSlotIx;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
postIx = verifyTransactionSlotIx;
|
|
94
|
+
}
|
|
95
|
+
// Calculate transaction size
|
|
96
|
+
const txSize = this.calculateTransactionSize(latestBlockhash, [...batch, postIx], dummySigners);
|
|
97
|
+
if (txSize > this.MAX_SIZE) {
|
|
98
|
+
batch.pop();
|
|
99
|
+
result.push([...batch, postIx]);
|
|
100
|
+
batch = [ix];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (batch.length > 0 && simulationIxs.length !== 0) {
|
|
104
|
+
result.push([...batch, postIx]);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.Atomicity = Atomicity;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
|
|
2
1
|
import * as web3 from "@solana/web3.js";
|
|
3
2
|
import { TransactionMetadata, TransactionMetadataResponse } from "../types";
|
|
4
3
|
import { GeneralUtility } from "./GeneralUtility";
|
|
@@ -47,6 +46,21 @@ export declare class CreateTxMetadata {
|
|
|
47
46
|
* @returns A promise that resolves to the address lookup table account or null if it does not exist.
|
|
48
47
|
*/
|
|
49
48
|
getAlt(alt: string): Promise<web3.AddressLookupTableAccount | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Store address lookup table in the object
|
|
51
|
+
*
|
|
52
|
+
* @param alt
|
|
53
|
+
* @param account
|
|
54
|
+
*/
|
|
55
|
+
storeAlt(alt: string, account: web3.AddressLookupTableAccount): void;
|
|
56
|
+
/**
|
|
57
|
+
* String to address lookup table. Can input multiple address lookup table addresses
|
|
58
|
+
*
|
|
59
|
+
* @param connection
|
|
60
|
+
* @param alts
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
stringToAlt(alts: string[]): Promise<web3.AddressLookupTableAccount[]>;
|
|
50
64
|
/**
|
|
51
65
|
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
52
66
|
* This includes constructing a transaction with given instructions, calculating fees, and optionally handling priority fees.
|
|
@@ -64,5 +78,6 @@ export declare class CreateTxMetadata {
|
|
|
64
78
|
* @throws Error if there is an issue in constructing the transaction or during simulation which includes logs of errors.
|
|
65
79
|
*/
|
|
66
80
|
createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse): Promise<TransactionMetadata>;
|
|
81
|
+
createTxMetadata2(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse): Promise<TransactionMetadata[]>;
|
|
67
82
|
}
|
|
68
83
|
//# sourceMappingURL=CreateTxMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateTxMetadata.d.ts","sourceRoot":"","sources":["../../../src/classes/Cre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