@mysten/deepbook-v3 1.6.3 → 1.6.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/CHANGELOG.md +8 -0
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/utils/index.d.mts +1 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/contracts/utils/index.mjs +5 -1
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/package.json +2 -2
- package/src/contracts/utils/index.ts +49 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { MoveStruct } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs0 from "@mysten/sui/bcs";
|
|
3
3
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
4
4
|
|
|
5
5
|
//#region src/contracts/deepbook/account.d.ts
|
|
6
6
|
declare const Account: MoveStruct<{
|
|
7
|
-
epoch:
|
|
7
|
+
epoch: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
8
8
|
open_orders: MoveStruct<{
|
|
9
|
-
contents:
|
|
9
|
+
contents: _mysten_sui_bcs0.BcsType<string[], Iterable<string | number | bigint> & {
|
|
10
10
|
length: number;
|
|
11
11
|
}, string>;
|
|
12
12
|
}, "0x2::vec_set::VecSet<u128>">;
|
|
13
|
-
taker_volume:
|
|
14
|
-
maker_volume:
|
|
15
|
-
active_stake:
|
|
16
|
-
inactive_stake:
|
|
17
|
-
created_proposal:
|
|
18
|
-
voted_proposal:
|
|
13
|
+
taker_volume: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u128">;
|
|
14
|
+
maker_volume: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u128">;
|
|
15
|
+
active_stake: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
16
|
+
inactive_stake: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
17
|
+
created_proposal: _mysten_sui_bcs0.BcsType<boolean, boolean, "bool">;
|
|
18
|
+
voted_proposal: _mysten_sui_bcs0.BcsType<string | null, string | Uint8Array<ArrayBufferLike> | null | undefined, "Option<bytes[32]>">;
|
|
19
19
|
unclaimed_rebates: MoveStruct<{
|
|
20
|
-
base:
|
|
21
|
-
quote:
|
|
22
|
-
deep:
|
|
20
|
+
base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
21
|
+
quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
22
|
+
deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
23
23
|
}, "@deepbook/core::balances::Balances">;
|
|
24
24
|
settled_balances: MoveStruct<{
|
|
25
|
-
base:
|
|
26
|
-
quote:
|
|
27
|
-
deep:
|
|
25
|
+
base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
26
|
+
quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
27
|
+
deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
28
28
|
}, "@deepbook/core::balances::Balances">;
|
|
29
29
|
owed_balances: MoveStruct<{
|
|
30
|
-
base:
|
|
31
|
-
quote:
|
|
32
|
-
deep:
|
|
30
|
+
base: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
31
|
+
quote: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
32
|
+
deep: _mysten_sui_bcs0.BcsType<string, string | number | bigint, "u64">;
|
|
33
33
|
}, "@deepbook/core::balances::Balances">;
|
|
34
34
|
}, "@deepbook/core::account::Account">;
|
|
35
35
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MoveStruct } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs16 from "@mysten/sui/bcs";
|
|
3
3
|
|
|
4
4
|
//#region src/contracts/deepbook/balances.d.ts
|
|
5
5
|
declare const Balances: MoveStruct<{
|
|
6
|
-
base:
|
|
7
|
-
quote:
|
|
8
|
-
deep:
|
|
6
|
+
base: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
|
|
7
|
+
quote: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
|
|
8
|
+
deep: _mysten_sui_bcs16.BcsType<string, string | number | bigint, "u64">;
|
|
9
9
|
}, "@deepbook/core::balances::Balances">;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Balances };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.d.mts","names":[],"sources":["../../../src/contracts/deepbook/balances.ts"],"mappings":";;;;cAYa,QAAA,EAAQ,UAAA;QAOnB,
|
|
1
|
+
{"version":3,"file":"balances.d.mts","names":[],"sources":["../../../src/contracts/deepbook/balances.ts"],"mappings":";;;;cAYa,QAAA,EAAQ,UAAA;QAOnB,iBAAA,CAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BcsStruct, BcsTuple, BcsType } from "@mysten/sui/bcs";
|
|
2
|
-
import { TransactionArgument } from "@mysten/sui/transactions";
|
|
2
|
+
import { TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
3
3
|
import { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client";
|
|
4
4
|
|
|
5
5
|
//#region src/contracts/utils/index.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/contracts/utils/index.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/contracts/utils/index.ts"],"mappings":";;;;;KAsBY,UAAA,iBAA2B,IAAA,CAAK,cAAA,CAAe,aAAA,qBAC1D,cAAA,CAAe,gBAAA,CAAiB,OAAA;EAAa,MAAA,EAAQ,iBAAA;AAAA;AAAA,KAE1C,cAAA,iBAA+B,IAAA,CAAK,cAAA,CAAe,aAAA,qBAC9D,cAAA,CAAe,iBAAA,CAAkB,OAAA;EAAa,MAAA,EAAQ,iBAAA;AAAA;;KAuL3C,YAAA,YAAwB,OAAA;AAAA,UAEnB,cAAA;EAChB,OAAA;EACA,aAAA,YAAyB,YAAA;AAAA;AAJ1B;;;;;AAAA,KAYK,aAAA,wBAAqC,IAAA,yCACtC,OAAA,EAAS,cAAA;EAAmB,aAAA,WAAwB,YAAA;AAAA,MACpD,OAAA,GAAU,cAAA;AAAA,KAET,qBAAA;EACJ,MAAA,EAAQ,iBAAA;AAAA,KACJ,IAAA,wCACF,cAAA;EAAmB,aAAA,WAAwB,YAAA;AAAA,IAC3C,cAAA;AAAA,cAqFU,UAAA,WACF,MAAA,SAAe,OAAA,oDAEhB,SAAA,CAAU,CAAA,EAAG,IAAA;EAhGlB;;;;;;;;EAyGJ,OAAA,CAAA,GAAW,IAAA,EAAM,aAAA,CAAc,IAAA;EAzGb;;;;;;EAmHZ,cAAA,CAAe,OAAA,EAAS,qBAAA,CAAsB,IAAA,IAAQ,OAAA;EAOtD,GAAA,iBAAoB,IAAA,CAAK,cAAA,CAAe,aAAA,2BAAA,CAAA;IAC7C,QAAA;IAAA,GACG;EAAA,GACD,UAAA,CAAW,OAAA,IAAW,OAAA,CACxB,cAAA,CAAe,MAAA,CAAO,OAAA;IAAY,OAAA;IAAe,IAAA;EAAA;IAChD,IAAA,EAAM,SAAA,CAAU,CAAA;EAAA;EAeZ,OAAA,iBAAwB,IAAA,CAAK,cAAA,CAAe,aAAA,2BAAA,CAAA;IACjD,MAAA;IAAA,GACG;EAAA,GACD,cAAA,CAAe,OAAA,IAAW,OAAA,CAC5B,KAAA,CACC,cAAA,CAAe,MAAA,CAAO,OAAA;IAAY,OAAA;IAAe,IAAA;EAAA;IAChD,IAAA,EAAM,SAAA,CAAU,CAAA;EAAA;AAAA"}
|
|
@@ -51,6 +51,10 @@ function normalizeMoveArguments(args, argTypes, parameterNames) {
|
|
|
51
51
|
normalizedArgs.push((tx) => tx.object.denyList());
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
|
+
if (argType === "0x2::accumulator::AccumulatorRoot") {
|
|
55
|
+
normalizedArgs.push((tx) => tx.object("0xacc"));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
54
58
|
if (argType === "0x3::sui_system::SuiSystemState") {
|
|
55
59
|
normalizedArgs.push((tx) => tx.object.system());
|
|
56
60
|
continue;
|
|
@@ -62,7 +66,7 @@ function normalizeMoveArguments(args, argTypes, parameterNames) {
|
|
|
62
66
|
} else {
|
|
63
67
|
if (!parameterNames) throw new Error(`Expected arguments to be passed as an array`);
|
|
64
68
|
const name = parameterNames[index];
|
|
65
|
-
arg = args[name];
|
|
69
|
+
arg = name !== void 0 && Object.prototype.hasOwnProperty.call(args, name) ? args[name] : void 0;
|
|
66
70
|
if (arg === void 0) throw new Error(`Parameter ${name} is required`);
|
|
67
71
|
}
|
|
68
72
|
index += 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\ttype BcsType,\n\ttype TypeTag,\n\tTypeTagSerializer,\n\tBcsStruct,\n\tBcsEnum,\n\tBcsTuple,\n} from '@mysten/sui/bcs';\nimport { normalizeStructTag, normalizeSuiAddress } from '@mysten/sui/utils';\nimport { type TransactionArgument, isArgument } from '@mysten/sui/transactions';\nimport { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';\n\nconst MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');\nconst SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');\n\nexport type RawTransactionArgument<T> = T | TransactionArgument;\n\nexport type GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =\n\tSuiClientTypes.GetObjectOptions<Include> & { client: ClientWithCoreApi };\n\nexport type GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =\n\tSuiClientTypes.GetObjectsOptions<Include> & { client: ClientWithCoreApi };\n\nexport function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {\n\tconst parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;\n\n\tif ('u8' in parsedTag) {\n\t\treturn bcs.U8;\n\t} else if ('u16' in parsedTag) {\n\t\treturn bcs.U16;\n\t} else if ('u32' in parsedTag) {\n\t\treturn bcs.U32;\n\t} else if ('u64' in parsedTag) {\n\t\treturn bcs.U64;\n\t} else if ('u128' in parsedTag) {\n\t\treturn bcs.U128;\n\t} else if ('u256' in parsedTag) {\n\t\treturn bcs.U256;\n\t} else if ('address' in parsedTag) {\n\t\treturn bcs.Address;\n\t} else if ('bool' in parsedTag) {\n\t\treturn bcs.Bool;\n\t} else if ('vector' in parsedTag) {\n\t\tconst type = getPureBcsSchema(parsedTag.vector);\n\t\treturn type ? bcs.vector(type) : null;\n\t} else if ('struct' in parsedTag) {\n\t\tconst structTag = parsedTag.struct;\n\t\tconst pkg = normalizeSuiAddress(structTag.address);\n\n\t\tif (pkg === MOVE_STDLIB_ADDRESS) {\n\t\t\tif (\n\t\t\t\t(structTag.module === 'ascii' || structTag.module === 'string') &&\n\t\t\t\tstructTag.name === 'String'\n\t\t\t) {\n\t\t\t\treturn bcs.String;\n\t\t\t}\n\n\t\t\tif (structTag.module === 'option' && structTag.name === 'Option') {\n\t\t\t\tconst inner = structTag.typeParams[0];\n\t\t\t\tconst type = inner ? getPureBcsSchema(inner) : null;\n\t\t\t\treturn type ? bcs.option(type) : null;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tpkg === SUI_FRAMEWORK_ADDRESS &&\n\t\t\tstructTag.module === 'object' &&\n\t\t\t(structTag.name === 'ID' || structTag.name === 'UID')\n\t\t) {\n\t\t\treturn bcs.Address;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function normalizeMoveArguments(\n\targs: unknown[] | object,\n\targTypes: readonly (string | null)[],\n\tparameterNames?: string[],\n) {\n\tconst argLen = Array.isArray(args) ? args.length : Object.keys(args).length;\n\tif (parameterNames && argLen !== parameterNames.length) {\n\t\tthrow new Error(\n\t\t\t`Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,\n\t\t);\n\t}\n\n\tconst normalizedArgs: TransactionArgument[] = [];\n\n\tlet index = 0;\n\tfor (const argType of argTypes) {\n\t\tif (argType === '0x2::clock::Clock') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.clock());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::random::Random') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.random());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::deny_list::DenyList') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.denyList());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x3::sui_system::SuiSystemState') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.system());\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet arg;\n\t\tif (Array.isArray(args)) {\n\t\t\tif (index >= args.length) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\targ = args[index];\n\t\t} else {\n\t\t\tif (!parameterNames) {\n\t\t\t\tthrow new Error(`Expected arguments to be passed as an array`);\n\t\t\t}\n\t\t\tconst name = parameterNames[index];\n\t\t\targ = args[name as keyof typeof args];\n\n\t\t\tif (arg === undefined) {\n\t\t\t\tthrow new Error(`Parameter ${name} is required`);\n\t\t\t}\n\t\t}\n\n\t\tindex += 1;\n\n\t\tif (typeof arg === 'function' || isArgument(arg)) {\n\t\t\tnormalizedArgs.push(arg as TransactionArgument);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst bcsType = argType === null ? null : getPureBcsSchema(argType);\n\n\t\tif (bcsType) {\n\t\t\tconst bytes = bcsType.serialize(arg as never);\n\t\t\tnormalizedArgs.push((tx) => tx.pure(bytes));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof arg === 'string') {\n\t\t\tnormalizedArgs.push((tx) => tx.object(arg));\n\t\t\tcontinue;\n\t\t}\n\n\t\tthrow new Error(`Invalid argument ${stringify(arg)} for type ${argType}`);\n\t}\n\n\treturn normalizedArgs;\n}\n\n/* -------------------------- Move type tags -------------------------- */\n\n/** A type argument: a type tag string, or a BCS type whose name is a Move type. */\nexport type TypeArgument = string | BcsType<any>;\n\nexport interface TypeTagOptions {\n\tpackage?: string;\n\ttypeArguments?: readonly TypeArgument[];\n}\n\n/**\n * `typeArguments` is required when the type's name contains unfilled\n * `phantom X` parameters (at any depth). Everything else — argument arity,\n * position contents, and tag validity — is validated at runtime.\n */\ntype TypeTagParams<Name extends string> = Name extends `${string}phantom ${string}`\n\t? [options: TypeTagOptions & { typeArguments: readonly TypeArgument[] }]\n\t: [options?: TypeTagOptions];\n\ntype ResolveTypeTagOptions<Name extends string> = {\n\tclient: ClientWithCoreApi;\n} & (Name extends `${string}phantom ${string}`\n\t? TypeTagOptions & { typeArguments: readonly TypeArgument[] }\n\t: TypeTagOptions);\n\nconst HAS_PHANTOM_REGEX = /phantom [A-Za-z_$][A-Za-z0-9_$]*/;\n\nfunction splitTopLevelTypeArgs(inner: string): string[] {\n\tconst parts: string[] = [];\n\tlet depth = 0;\n\tlet current = '';\n\tfor (const char of inner) {\n\t\tif (char === ',' && depth === 0) {\n\t\t\tparts.push(current.trim());\n\t\t\tcurrent = '';\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '<') depth++;\n\t\tif (char === '>') depth--;\n\t\tcurrent += char;\n\t}\n\tif (current) parts.push(current.trim());\n\treturn parts;\n}\n\nfunction buildTypeTag(name: string, options: TypeTagOptions | undefined): string {\n\tconst lt = name.indexOf('<');\n\tconst base = lt === -1 ? name : name.slice(0, lt);\n\n\tif (base.split('::').length !== 3) {\n\t\tthrow new Error(`${name} is not a top-level Move type`);\n\t}\n\n\tlet result = name;\n\n\tif (options?.typeArguments) {\n\t\tconst baked = lt === -1 ? [] : splitTopLevelTypeArgs(name.slice(lt + 1, -1));\n\t\tconst supplied = options.typeArguments.map((arg) => {\n\t\t\tif (typeof arg === 'string') {\n\t\t\t\treturn arg;\n\t\t\t}\n\t\t\tif (arg && typeof arg.serialize === 'function' && typeof arg.name === 'string') {\n\t\t\t\treturn arg.name;\n\t\t\t}\n\t\t\tthrow new Error(`Invalid type argument ${stringify(arg)}`);\n\t\t});\n\n\t\tif (supplied.length !== baked.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected ${baked.length} type arguments for ${base}, got ${supplied.length}`,\n\t\t\t);\n\t\t}\n\n\t\tresult = supplied.length === 0 ? base : `${base}<${supplied.join(', ')}>`;\n\t}\n\n\tif (HAS_PHANTOM_REGEX.test(result)) {\n\t\tthrow new Error(\n\t\t\toptions?.typeArguments\n\t\t\t\t? `A type argument contains an unfilled phantom parameter in ${result}`\n\t\t\t\t: `Missing type arguments for ${result}`,\n\t\t);\n\t}\n\n\tif (options?.package) {\n\t\tconst [, ...rest] = result.split('::');\n\t\tresult = [options.package, ...rest].join('::');\n\t}\n\n\t// fully validate address-only tags (MVR names can't be parsed as type tags)\n\tif (!HAS_PHANTOM_REGEX.test(result) && !/[@/]/.test(result)) {\n\t\tTypeTagSerializer.parseFromStr(result);\n\t}\n\n\treturn result;\n}\n\nasync function resolveBuiltTypeTag(\n\tname: string,\n\toptions: { client: ClientWithCoreApi } & TypeTagOptions,\n): Promise<string> {\n\tconst { client, ...rest } = options;\n\tconst { type } = await client.core.mvr.resolveType({\n\t\ttype: buildTypeTag(name, rest),\n\t});\n\treturn normalizeStructTag(type);\n}\n\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\n\t/**\n\t * Build the type tag for this struct.\n\t *\n\t * `typeArguments` is the full positional list, in Move declaration order, and\n\t * is required when the struct has unfilled phantom parameters. The result may\n\t * contain MVR names: those are valid in transaction `typeArguments`, but for\n\t * queries or comparisons against on-chain data use `resolveTypeTag` instead.\n\t */\n\ttypeTag(...args: TypeTagParams<Name>): string {\n\t\treturn buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);\n\t}\n\n\t/**\n\t * Build the type tag for this struct, then resolve any MVR names through the\n\t * client (using its configured overrides and the MVR API) and return the\n\t * normalized, address-only form suitable for queries and comparisons against\n\t * on-chain data.\n\t */\n\tasync resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {\n\t\treturn resolveBuiltTypeTag(\n\t\t\tthis.name,\n\t\t\toptions as { client: ClientWithCoreApi } & TypeTagOptions,\n\t\t);\n\t}\n\n\tasync get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tobjectId,\n\t\t...options\n\t}: GetOptions<Include>): Promise<\n\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t}\n\t> {\n\t\tconst [res] = await this.getMany<Include>({\n\t\t\t...options,\n\t\t\tobjectIds: [objectId],\n\t\t});\n\n\t\tif (!res) {\n\t\t\tthrow new Error(`No object found for id ${objectId}`);\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tclient,\n\t\t...options\n\t}: GetManyOptions<Include>): Promise<\n\t\tArray<\n\t\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t\t}\n\t\t>\n\t> {\n\t\tconst response = (await client.core.getObjects({\n\t\t\t...options,\n\t\t\tinclude: {\n\t\t\t\t...options.include,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t})) as SuiClientTypes.GetObjectsResponse<Include & { content: true }>;\n\n\t\treturn response.objects.map((obj) => {\n\t\t\tif (obj instanceof Error) {\n\t\t\t\tthrow obj;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...obj,\n\t\t\t\tjson: this.parse(obj.content),\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport class MoveEnum<\n\tT extends Record<string, BcsType<any> | null>,\n\tconst Name extends string,\n> extends BcsEnum<T, Name> {\n\t/** Build the type tag for this enum. See `MoveStruct.typeTag` for semantics. */\n\ttypeTag(...args: TypeTagParams<Name>): string {\n\t\treturn buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);\n\t}\n\n\t/** Build and resolve the type tag for this enum. See `MoveStruct.resolveTypeTag`. */\n\tasync resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {\n\t\treturn resolveBuiltTypeTag(\n\t\t\tthis.name,\n\t\t\toptions as { client: ClientWithCoreApi } & TypeTagOptions,\n\t\t);\n\t}\n}\n\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {\n\t/** Build the type tag for this struct. See `MoveStruct.typeTag` for semantics. */\n\ttypeTag(...args: TypeTagParams<Name>): string {\n\t\treturn buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);\n\t}\n\n\t/** Build and resolve the type tag for this struct. See `MoveStruct.resolveTypeTag`. */\n\tasync resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {\n\t\treturn resolveBuiltTypeTag(\n\t\t\tthis.name,\n\t\t\toptions as { client: ClientWithCoreApi } & TypeTagOptions,\n\t\t);\n\t}\n}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (_key, value) =>\n\t\t\ttypeof value === 'bigint' ? value.toString() : value,\n\t\t);\n\t}\n\tif (typeof val === 'bigint') {\n\t\treturn val.toString();\n\t}\n\n\treturn val;\n}\n"],"mappings":";;;;;AAaA,MAAM,sBAAsB,oBAAoB,MAAM;AACtD,MAAM,wBAAwB,oBAAoB,MAAM;AAUxD,SAAgB,iBAAiB,SAAgD;CAChF,MAAM,YAAY,OAAO,YAAY,WAAW,kBAAkB,aAAa,QAAQ,GAAG;AAE1F,KAAI,QAAQ,UACX,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,aAAa,UACvB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,YAAY,WAAW;EACjC,MAAM,OAAO,iBAAiB,UAAU,OAAO;AAC/C,SAAO,OAAO,IAAI,OAAO,KAAK,GAAG;YACvB,YAAY,WAAW;EACjC,MAAM,YAAY,UAAU;EAC5B,MAAM,MAAM,oBAAoB,UAAU,QAAQ;AAElD,MAAI,QAAQ,qBAAqB;AAChC,QACE,UAAU,WAAW,WAAW,UAAU,WAAW,aACtD,UAAU,SAAS,SAEnB,QAAO,IAAI;AAGZ,OAAI,UAAU,WAAW,YAAY,UAAU,SAAS,UAAU;IACjE,MAAM,QAAQ,UAAU,WAAW;IACnC,MAAM,OAAO,QAAQ,iBAAiB,MAAM,GAAG;AAC/C,WAAO,OAAO,IAAI,OAAO,KAAK,GAAG;;;AAInC,MACC,QAAQ,yBACR,UAAU,WA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O;IACN,GAAG;IACH,MAAM,KAAK,MAAM,IAAI,QAAQ;IAC7B;IACA;;;AAsBJ,IAAa,YAAb,cAGU,SAAkB;;CAE3B,QAAQ,GAAG,MAAmC;AAC7C,SAAO,aAAa,KAAK,MAAM,KAAK,GAAiC;;;CAItE,MAAM,eAAe,SAAuD;AAC3E,SAAO,oBACN,KAAK,MACL,QACA;;;AAIH,SAAS,UAAU,KAAc;AAChC,KAAI,OAAO,QAAQ,SAClB,QAAO,KAAK,UAAU,MAAM,MAAM,UACjC,OAAO,UAAU,WAAW,MAAM,UAAU,GAAG,MAC/C;AAEF,KAAI,OAAO,QAAQ,SAClB,QAAO,IAAI,UAAU;AAGtB,QAAO"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/contracts/utils/index.ts"],"sourcesContent":["import {\n\tbcs,\n\ttype BcsType,\n\ttype TypeTag,\n\tTypeTagSerializer,\n\tBcsStruct,\n\tBcsEnum,\n\tBcsTuple,\n} from '@mysten/sui/bcs';\nimport { normalizeStructTag, normalizeSuiAddress } from '@mysten/sui/utils';\nimport {\n\ttype TransactionArgument,\n\ttype TransactionObjectArgument,\n\tisArgument,\n} from '@mysten/sui/transactions';\nimport { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';\n\nconst MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');\nconst SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');\n\nexport type RawTransactionArgument<T> = T | TransactionArgument;\n\nexport type GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =\n\tSuiClientTypes.GetObjectOptions<Include> & { client: ClientWithCoreApi };\n\nexport type GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =\n\tSuiClientTypes.GetObjectsOptions<Include> & { client: ClientWithCoreApi };\n\nexport function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {\n\tconst parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;\n\n\tif ('u8' in parsedTag) {\n\t\treturn bcs.U8;\n\t} else if ('u16' in parsedTag) {\n\t\treturn bcs.U16;\n\t} else if ('u32' in parsedTag) {\n\t\treturn bcs.U32;\n\t} else if ('u64' in parsedTag) {\n\t\treturn bcs.U64;\n\t} else if ('u128' in parsedTag) {\n\t\treturn bcs.U128;\n\t} else if ('u256' in parsedTag) {\n\t\treturn bcs.U256;\n\t} else if ('address' in parsedTag) {\n\t\treturn bcs.Address;\n\t} else if ('bool' in parsedTag) {\n\t\treturn bcs.Bool;\n\t} else if ('vector' in parsedTag) {\n\t\tconst type = getPureBcsSchema(parsedTag.vector);\n\t\treturn type ? bcs.vector(type) : null;\n\t} else if ('struct' in parsedTag) {\n\t\tconst structTag = parsedTag.struct;\n\t\tconst pkg = normalizeSuiAddress(structTag.address);\n\n\t\tif (pkg === MOVE_STDLIB_ADDRESS) {\n\t\t\tif (\n\t\t\t\t(structTag.module === 'ascii' || structTag.module === 'string') &&\n\t\t\t\tstructTag.name === 'String'\n\t\t\t) {\n\t\t\t\treturn bcs.String;\n\t\t\t}\n\n\t\t\tif (structTag.module === 'option' && structTag.name === 'Option') {\n\t\t\t\tconst inner = structTag.typeParams[0];\n\t\t\t\tconst type = inner ? getPureBcsSchema(inner) : null;\n\t\t\t\treturn type ? bcs.option(type) : null;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tpkg === SUI_FRAMEWORK_ADDRESS &&\n\t\t\tstructTag.module === 'object' &&\n\t\t\t(structTag.name === 'ID' || structTag.name === 'UID')\n\t\t) {\n\t\t\treturn bcs.Address;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport function normalizeMoveArguments(\n\targs: unknown[] | object,\n\targTypes: readonly (string | null)[],\n\tparameterNames?: string[],\n) {\n\tconst argLen = Array.isArray(args) ? args.length : Object.keys(args).length;\n\tif (parameterNames && argLen !== parameterNames.length) {\n\t\tthrow new Error(\n\t\t\t`Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,\n\t\t);\n\t}\n\n\tconst normalizedArgs: TransactionArgument[] = [];\n\n\tlet index = 0;\n\tfor (const argType of argTypes) {\n\t\tif (argType === '0x2::clock::Clock') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.clock());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::random::Random') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.random());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::deny_list::DenyList') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.denyList());\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x2::accumulator::AccumulatorRoot') {\n\t\t\t// Chain-wide shared singleton at a fixed address (SUI_ACCUMULATOR_ROOT_OBJECT_ID).\n\t\t\tnormalizedArgs.push((tx) => tx.object('0xacc'));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (argType === '0x3::sui_system::SuiSystemState') {\n\t\t\tnormalizedArgs.push((tx) => tx.object.system());\n\t\t\tcontinue;\n\t\t}\n\n\t\tlet arg;\n\t\tif (Array.isArray(args)) {\n\t\t\tif (index >= args.length) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\targ = args[index];\n\t\t} else {\n\t\t\tif (!parameterNames) {\n\t\t\t\tthrow new Error(`Expected arguments to be passed as an array`);\n\t\t\t}\n\t\t\tconst name = parameterNames[index];\n\t\t\targ =\n\t\t\t\tname !== undefined && Object.prototype.hasOwnProperty.call(args, name)\n\t\t\t\t\t? args[name as keyof typeof args]\n\t\t\t\t\t: undefined;\n\n\t\t\tif (arg === undefined) {\n\t\t\t\tthrow new Error(`Parameter ${name} is required`);\n\t\t\t}\n\t\t}\n\n\t\tindex += 1;\n\n\t\tif (typeof arg === 'function' || isArgument(arg)) {\n\t\t\tnormalizedArgs.push(arg as TransactionArgument);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst bcsType = argType === null ? null : getPureBcsSchema(argType);\n\n\t\tif (bcsType) {\n\t\t\tconst bytes = bcsType.serialize(arg as never);\n\t\t\tnormalizedArgs.push((tx) => tx.pure(bytes));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (typeof arg === 'string') {\n\t\t\tnormalizedArgs.push((tx) => tx.object(arg));\n\t\t\tcontinue;\n\t\t}\n\n\t\tthrow new Error(`Invalid argument ${stringify(arg)} for type ${argType}`);\n\t}\n\n\treturn normalizedArgs;\n}\n\n/* -------------------------- Config-mapped arguments -------------------------- */\n\n/** Context passed to config resolver functions. */\nexport interface ConfigResolverContext {\n\t/**\n\t * The matched parameter's own instantiated type arguments (not the whole function's type\n\t * argument tuple). Concrete instantiations are canonical type tags; generic positions pass\n\t * the caller's `typeArguments` strings through as provided.\n\t */\n\ttypeArguments: string[];\n\t/** The package address the generated call will be sent to. */\n\tpackageAddress: string;\n\t/** The Move module of the generated call. */\n\tmoduleName: string;\n\t/** The Move function of the generated call. */\n\tfunctionName: string;\n\t/** The Move name of the matched parameter, when the summary includes parameter names. */\n\tparameterName?: string;\n\t/** The matched parameter's position in the generated function's arguments. */\n\tparameterIndex: number;\n}\n\n/**\n * A non-callback transaction argument in a generated config object, used for keys whose matched\n * parameter can't be supplied as an object id string.\n */\nexport type ConfigObjectValue = Exclude<TransactionObjectArgument, (...args: never[]) => unknown>;\n\n/**\n * A plain value in a generated config object: an object id or a non-callback transaction\n * argument. Keys that can resolve multiple bindings are typed as resolver functions instead.\n */\nexport type ConfigValue = string | ConfigObjectValue;\n\n/* -------------------------- Move type tags -------------------------- */\n\n/** A type argument: a type tag string, or a BCS type whose name is a Move type. */\nexport type TypeArgument = string | BcsType<any>;\n\nexport interface TypeTagOptions {\n\tpackage?: string;\n\ttypeArguments?: readonly TypeArgument[];\n}\n\n/**\n * `typeArguments` is required when the type's name contains unfilled\n * `phantom X` parameters (at any depth). Everything else — argument arity,\n * position contents, and tag validity — is validated at runtime.\n */\ntype TypeTagParams<Name extends string> = Name extends `${string}phantom ${string}`\n\t? [options: TypeTagOptions & { typeArguments: readonly TypeArgument[] }]\n\t: [options?: TypeTagOptions];\n\ntype ResolveTypeTagOptions<Name extends string> = {\n\tclient: ClientWithCoreApi;\n} & (Name extends `${string}phantom ${string}`\n\t? TypeTagOptions & { typeArguments: readonly TypeArgument[] }\n\t: TypeTagOptions);\n\nconst HAS_PHANTOM_REGEX = /phantom [A-Za-z_$][A-Za-z0-9_$]*/;\n\nfunction splitTopLevelTypeArgs(inner: string): string[] {\n\tconst parts: string[] = [];\n\tlet depth = 0;\n\tlet current = '';\n\tfor (const char of inner) {\n\t\tif (char === ',' && depth === 0) {\n\t\t\tparts.push(current.trim());\n\t\t\tcurrent = '';\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '<') depth++;\n\t\tif (char === '>') depth--;\n\t\tcurrent += char;\n\t}\n\tif (current) parts.push(current.trim());\n\treturn parts;\n}\n\nfunction buildTypeTag(name: string, options: TypeTagOptions | undefined): string {\n\tconst lt = name.indexOf('<');\n\tconst base = lt === -1 ? name : name.slice(0, lt);\n\n\tif (base.split('::').length !== 3) {\n\t\tthrow new Error(`${name} is not a top-level Move type`);\n\t}\n\n\tlet result = name;\n\n\tif (options?.typeArguments) {\n\t\tconst baked = lt === -1 ? [] : splitTopLevelTypeArgs(name.slice(lt + 1, -1));\n\t\tconst supplied = options.typeArguments.map((arg) => {\n\t\t\tif (typeof arg === 'string') {\n\t\t\t\treturn arg;\n\t\t\t}\n\t\t\tif (arg && typeof arg.serialize === 'function' && typeof arg.name === 'string') {\n\t\t\t\treturn arg.name;\n\t\t\t}\n\t\t\tthrow new Error(`Invalid type argument ${stringify(arg)}`);\n\t\t});\n\n\t\tif (supplied.length !== baked.length) {\n\t\t\tthrow new Error(\n\t\t\t\t`Expected ${baked.length} type arguments for ${base}, got ${supplied.length}`,\n\t\t\t);\n\t\t}\n\n\t\tresult = supplied.length === 0 ? base : `${base}<${supplied.join(', ')}>`;\n\t}\n\n\tif (HAS_PHANTOM_REGEX.test(result)) {\n\t\tthrow new Error(\n\t\t\toptions?.typeArguments\n\t\t\t\t? `A type argument contains an unfilled phantom parameter in ${result}`\n\t\t\t\t: `Missing type arguments for ${result}`,\n\t\t);\n\t}\n\n\tif (options?.package) {\n\t\tconst [, ...rest] = result.split('::');\n\t\tresult = [options.package, ...rest].join('::');\n\t}\n\n\t// fully validate address-only tags (MVR names can't be parsed as type tags)\n\tif (!HAS_PHANTOM_REGEX.test(result) && !/[@/]/.test(result)) {\n\t\tTypeTagSerializer.parseFromStr(result);\n\t}\n\n\treturn result;\n}\n\nasync function resolveBuiltTypeTag(\n\tname: string,\n\toptions: { client: ClientWithCoreApi } & TypeTagOptions,\n): Promise<string> {\n\tconst { client, ...rest } = options;\n\tconst { type } = await client.core.mvr.resolveType({\n\t\ttype: buildTypeTag(name, rest),\n\t});\n\treturn normalizeStructTag(type);\n}\n\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\n\t/**\n\t * Build the type tag for this struct.\n\t *\n\t * `typeArguments` is the full positional list, in Move declaration order, and\n\t * is required when the struct has unfilled phantom parameters. The result may\n\t * contain MVR names: those are valid in transaction `typeArguments`, but for\n\t * queries or comparisons against on-chain data use `resolveTypeTag` instead.\n\t */\n\ttypeTag(...args: TypeTagParams<Name>): string {\n\t\treturn buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);\n\t}\n\n\t/**\n\t * Build the type tag for this struct, then resolve any MVR names through the\n\t * client (using its configured overrides and the MVR API) and return the\n\t * normalized, address-only form suitable for queries and comparisons against\n\t * on-chain data.\n\t */\n\tasync resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {\n\t\treturn resolveBuiltTypeTag(\n\t\t\tthis.name,\n\t\t\toptions as { client: ClientWithCoreApi } & TypeTagOptions,\n\t\t);\n\t}\n\n\tasync get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tobjectId,\n\t\t...options\n\t}: GetOptions<Include>): Promise<\n\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t}\n\t> {\n\t\tconst [res] = await this.getMany<Include>({\n\t\t\t...options,\n\t\t\tobjectIds: [objectId],\n\t\t});\n\n\t\tif (!res) {\n\t\t\tthrow new Error(`No object found for id ${objectId}`);\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tasync getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({\n\t\tclient,\n\t\t...options\n\t}: GetManyOptions<Include>): Promise<\n\t\tArray<\n\t\t\tSuiClientTypes.Object<Include & { content: true; json: true }> & {\n\t\t\t\tjson: BcsStruct<T>['$inferType'];\n\t\t\t}\n\t\t>\n\t> {\n\t\tconst response = (await client.core.getObjects({\n\t\t\t...options,\n\t\t\tinclude: {\n\t\t\t\t...options.include,\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t})) as SuiClientTypes.GetObjectsResponse<Include & { content: true }>;\n\n\t\treturn response.objects.map((obj) => {\n\t\t\tif (obj instanceof Error) {\n\t\t\t\tthrow obj;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...obj,\n\t\t\t\tjson: this.parse(obj.content),\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport class MoveEnum<\n\tT extends Record<string, BcsType<any> | null>,\n\tconst Name extends string,\n> extends BcsEnum<T, Name> {\n\t/** Build the type tag for this enum. See `MoveStruct.typeTag` for semantics. */\n\ttypeTag(...args: TypeTagParams<Name>): string {\n\t\treturn buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);\n\t}\n\n\t/** Build and resolve the type tag for this enum. See `MoveStruct.resolveTypeTag`. */\n\tasync resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {\n\t\treturn resolveBuiltTypeTag(\n\t\t\tthis.name,\n\t\t\toptions as { client: ClientWithCoreApi } & TypeTagOptions,\n\t\t);\n\t}\n}\n\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {\n\t/** Build the type tag for this struct. See `MoveStruct.typeTag` for semantics. */\n\ttypeTag(...args: TypeTagParams<Name>): string {\n\t\treturn buildTypeTag(this.name, args[0] as TypeTagOptions | undefined);\n\t}\n\n\t/** Build and resolve the type tag for this struct. See `MoveStruct.resolveTypeTag`. */\n\tasync resolveTypeTag(options: ResolveTypeTagOptions<Name>): Promise<string> {\n\t\treturn resolveBuiltTypeTag(\n\t\t\tthis.name,\n\t\t\toptions as { client: ClientWithCoreApi } & TypeTagOptions,\n\t\t);\n\t}\n}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (_key, value) =>\n\t\t\ttypeof value === 'bigint' ? value.toString() : value,\n\t\t);\n\t}\n\tif (typeof val === 'bigint') {\n\t\treturn val.toString();\n\t}\n\n\treturn val;\n}\n"],"mappings":";;;;;AAiBA,MAAM,sBAAsB,oBAAoB,MAAM;AACtD,MAAM,wBAAwB,oBAAoB,MAAM;AAUxD,SAAgB,iBAAiB,SAAgD;CAChF,MAAM,YAAY,OAAO,YAAY,WAAW,kBAAkB,aAAa,QAAQ,GAAG;AAE1F,KAAI,QAAQ,UACX,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,SAAS,UACnB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,aAAa,UACvB,QAAO,IAAI;UACD,UAAU,UACpB,QAAO,IAAI;UACD,YAAY,WAAW;EACjC,MAAM,OAAO,iBAAiB,UAAU,OAAO;AAC/C,SAAO,OAAO,IAAI,OAAO,KAAK,GAAG;YACvB,YAAY,WAAW;EACjC,MAAM,YAAY,UAAU;EAC5B,MAAM,MAAM,oBAAoB,UAAU,QAAQ;AAElD,MAAI,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SAAO,oBACN,KAAK,MACL,QACA;;CAGF,MAAM,IAAiF,EACtF,UACA,GAAG,WAKF;EACD,MAAM,CAAC,OAAO,MAAM,KAAK,QAAiB;GACzC,GAAG;GACH,WAAW,CAAC,SAAS;GACrB,CAAC;AAEF,MAAI,CAAC,IACJ,OAAM,IAAI,MAAM,0BAA0B,WAAW;AAGtD,SAAO;;CAGR,MAAM,QAAqF,EAC1F,QACA,GAAG,WAOF;AASD,UARkB,MAAM,OAAO,KAAK,WAAW;GAC9C,GAAG;GACH,SAAS;IACR,GAAG,QAAQ;IACX,SAAS;IACT;GACD,CAAC,EAEc,QAAQ,KAAK,QAAQ;AACpC,OAAI,eAAe,MAClB,OAAM;AAGP,UAAO;IACN,GAAG;IACH,MAAM,KAAK,MAAM,IAAI,QAAQ;IAC7B;IACA;;;AAsBJ,IAAa,YAAb,cAGU,SAAkB;;CAE3B,QAAQ,GAAG,MAAmC;AAC7C,SAAO,aAAa,KAAK,MAAM,KAAK,GAAiC;;;CAItE,MAAM,eAAe,SAAuD;AAC3E,SAAO,oBACN,KAAK,MACL,QACA;;;AAIH,SAAS,UAAU,KAAc;AAChC,KAAI,OAAO,QAAQ,SAClB,QAAO,KAAK,UAAU,MAAM,MAAM,UACjC,OAAO,UAAU,WAAW,MAAM,UAAU,GAAG,MAC/C;AAEF,KAAI,OAAO,QAAQ,SAClB,QAAO,IAAI,UAAU;AAGtB,QAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_transactions0 from "@mysten/sui/transactions";
|
|
3
3
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
4
4
|
|
|
5
5
|
//#region src/transactions/balanceManager.d.ts
|
|
@@ -21,7 +21,7 @@ declare class BalanceManagerContract {
|
|
|
21
21
|
* @description Create a new BalanceManager, manually set the owner. Returns the manager.
|
|
22
22
|
* @returns A function that takes a Transaction object
|
|
23
23
|
*/
|
|
24
|
-
createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) =>
|
|
24
|
+
createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
25
25
|
/**
|
|
26
26
|
* @description Share the BalanceManager
|
|
27
27
|
* @param {TransactionArgument} manager The BalanceManager to share
|
|
@@ -65,38 +65,38 @@ declare class BalanceManagerContract {
|
|
|
65
65
|
* @param {string} managerKey The key of the BalanceManager
|
|
66
66
|
* @returns A function that takes a Transaction object
|
|
67
67
|
*/
|
|
68
|
-
generateProof: (managerKey: string) => (tx: Transaction) =>
|
|
68
|
+
generateProof: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
69
69
|
/**
|
|
70
70
|
* @description Generate a trade proof as the owner
|
|
71
71
|
* @param {string} managerId The ID of the BalanceManager
|
|
72
72
|
* @returns A function that takes a Transaction object
|
|
73
73
|
*/
|
|
74
|
-
generateProofAsOwner: (managerId: string) => (tx: Transaction) =>
|
|
74
|
+
generateProofAsOwner: (managerId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
75
75
|
/**
|
|
76
76
|
* @description Generate a trade proof as a trader
|
|
77
77
|
* @param {string} managerId The ID of the BalanceManager
|
|
78
78
|
* @param {string} tradeCapId The ID of the tradeCap
|
|
79
79
|
* @returns A function that takes a Transaction object
|
|
80
80
|
*/
|
|
81
|
-
generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) =>
|
|
81
|
+
generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
82
82
|
/**
|
|
83
83
|
* @description Mint a TradeCap
|
|
84
84
|
* @param {string} managerKey The name of the BalanceManager
|
|
85
85
|
* @returns A function that takes a Transaction object
|
|
86
86
|
*/
|
|
87
|
-
mintTradeCap: (managerKey: string) => (tx: Transaction) =>
|
|
87
|
+
mintTradeCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
88
88
|
/**
|
|
89
89
|
* @description Mint a DepositCap
|
|
90
90
|
* @param {string} managerKey The name of the BalanceManager
|
|
91
91
|
* @returns A function that takes a Transaction object
|
|
92
92
|
*/
|
|
93
|
-
mintDepositCap: (managerKey: string) => (tx: Transaction) =>
|
|
93
|
+
mintDepositCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
94
94
|
/**
|
|
95
95
|
* @description Mint a WithdrawalCap
|
|
96
96
|
* @param {string} managerKey The name of the BalanceManager
|
|
97
97
|
* @returns A function that takes a Transaction object
|
|
98
98
|
*/
|
|
99
|
-
mintWithdrawalCap: (managerKey: string) => (tx: Transaction) =>
|
|
99
|
+
mintWithdrawalCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
100
100
|
/**
|
|
101
101
|
* @description Deposit using the DepositCap
|
|
102
102
|
* @param {string} managerKey The name of the BalanceManager
|
|
@@ -112,7 +112,7 @@ declare class BalanceManagerContract {
|
|
|
112
112
|
* @param {number} amountToWithdraw The amount to withdraw
|
|
113
113
|
* @returns A function that takes a Transaction object
|
|
114
114
|
*/
|
|
115
|
-
withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) =>
|
|
115
|
+
withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
116
116
|
/**
|
|
117
117
|
* @description Set the referral for the BalanceManager for a specific pool
|
|
118
118
|
* @param {string} managerKey The name of the BalanceManager
|
|
@@ -147,20 +147,20 @@ declare class BalanceManagerContract {
|
|
|
147
147
|
* @param {string} referralId The ID of the referral to get the owner of
|
|
148
148
|
* @returns A function that takes a Transaction object
|
|
149
149
|
*/
|
|
150
|
-
balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) =>
|
|
150
|
+
balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
151
151
|
/**
|
|
152
152
|
* @description Get the pool ID associated with a referral (DeepBookPoolReferral)
|
|
153
153
|
* @param {string} referralId The ID of the referral to get the pool ID of
|
|
154
154
|
* @returns A function that takes a Transaction object
|
|
155
155
|
*/
|
|
156
|
-
balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) =>
|
|
156
|
+
balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
157
157
|
/**
|
|
158
158
|
* @description Get the referral ID from the balance manager for a specific pool
|
|
159
159
|
* @param {string} managerKey The name of the BalanceManager
|
|
160
160
|
* @param {string} poolKey Key of the pool to get the referral for
|
|
161
161
|
* @returns A function that takes a Transaction object
|
|
162
162
|
*/
|
|
163
|
-
getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) =>
|
|
163
|
+
getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
|
|
164
164
|
/**
|
|
165
165
|
* @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.
|
|
166
166
|
* @param {string} managerKey The name of the BalanceManager
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balanceManager.d.mts","names":[],"sources":["../../src/transactions/balanceManager.ts"],"mappings":";;;;;;;;cAYa,sBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EA6BsD;;;;EArB1E,4BAAA,SAAsC,EAAA,EAAI,WAAA;EAyGwB;;;;EApFlE,6BAAA,GAAiC,YAAA,cAA0B,EAAA,EAAI,WAAA,KAAW,
|
|
1
|
+
{"version":3,"file":"balanceManager.d.mts","names":[],"sources":["../../src/transactions/balanceManager.ts"],"mappings":";;;;;;;;cAYa,sBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EA6BsD;;;;EArB1E,4BAAA,SAAsC,EAAA,EAAI,WAAA;EAyGwB;;;;EAp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A,UAAoB,OAAA,UAAiB,gBAAA,cAA8B,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EAlElE;;;;;;;EA4FlB,yBAAA,GACE,UAAA,UAAoB,QAAA,UAAkB,QAAA,EAAU,mBAAA,MAAyB,EAAA,EAAI,WAAA;EA7EnB;;;;;;;EA8F5D,2BAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,QAAA,EAAU,mBAAA,MAAyB,EAAA,EAAI,WAAA;EAW9E,sBAAA,GAA0B,UAAA,cAAwB,EAAA,EAAI,WAAA;EAxDhC;;;;;EAuEtB,KAAA,GAAS,UAAA,cAAwB,EAAA,EAAI,WAAA;EA5CnC;;;;;EA2DF,EAAA,GAAM,UAAA,cAAwB,EAAA,EAAI,WAAA;EA1ClC;;;;;EAyDA,2BAAA,GAA+B,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EAxDI;;;;;EAsE1E,4BAAA,GAAgC,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EA5C9D;;;;;;EA2DT,2BAAA,GAA+B,UAAA,UAAoB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EA7BvF;;;;;;EA8CA,cAAA,GAAkB,UAAA,UAAoB,UAAA,cAAwB,EAAA,EAAI,WAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, CreatePermissionlessPoolParams, PlaceLimitOrderParams, PlaceMarketOrderParams, SwapParams, SwapWithManagerParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions10 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/deepbook.d.ts
|
|
@@ -380,40 +380,40 @@ declare class DeepBookContract {
|
|
|
380
380
|
* @param {string} referral The referral (DeepBookPoolReferral) to get the balances for
|
|
381
381
|
* @returns A function that takes a Transaction object
|
|
382
382
|
*/
|
|
383
|
-
getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) =>
|
|
383
|
+
getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
384
384
|
/**
|
|
385
385
|
* @description Get the multiplier for a referral (DeepBookPoolReferral)
|
|
386
386
|
* @param {string} poolKey The key to identify the pool
|
|
387
387
|
* @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
|
|
388
388
|
* @returns A function that takes a Transaction object
|
|
389
389
|
*/
|
|
390
|
-
poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) =>
|
|
390
|
+
poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
391
391
|
/**
|
|
392
392
|
* @description Check if a pool is a stable pool
|
|
393
393
|
* @param {string} poolKey The key to identify the pool
|
|
394
394
|
* @returns A function that takes a Transaction object
|
|
395
395
|
*/
|
|
396
|
-
stablePool: (poolKey: string) => (tx: Transaction) =>
|
|
396
|
+
stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
397
397
|
/**
|
|
398
398
|
* @description Check if a pool is registered
|
|
399
399
|
* @param {string} poolKey The key to identify the pool
|
|
400
400
|
* @returns A function that takes a Transaction object
|
|
401
401
|
*/
|
|
402
|
-
registeredPool: (poolKey: string) => (tx: Transaction) =>
|
|
402
|
+
registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
403
403
|
/**
|
|
404
404
|
* @description Get the quote quantity out for a given base quantity using input token as fee
|
|
405
405
|
* @param {string} poolKey The key to identify the pool
|
|
406
406
|
* @param {number} baseQuantity Base quantity to convert
|
|
407
407
|
* @returns A function that takes a Transaction object
|
|
408
408
|
*/
|
|
409
|
-
getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) =>
|
|
409
|
+
getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
410
410
|
/**
|
|
411
411
|
* @description Get the base quantity out for a given quote quantity using input token as fee
|
|
412
412
|
* @param {string} poolKey The key to identify the pool
|
|
413
413
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
414
414
|
* @returns A function that takes a Transaction object
|
|
415
415
|
*/
|
|
416
|
-
getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) =>
|
|
416
|
+
getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
417
417
|
/**
|
|
418
418
|
* @description Get the quantity out for a given base or quote quantity using input token as fee
|
|
419
419
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -421,7 +421,7 @@ declare class DeepBookContract {
|
|
|
421
421
|
* @param {number} quoteQuantity Quote quantity to convert
|
|
422
422
|
* @returns A function that takes a Transaction object
|
|
423
423
|
*/
|
|
424
|
-
getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) =>
|
|
424
|
+
getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
425
425
|
/**
|
|
426
426
|
* @description Get the base quantity needed to receive a target quote quantity
|
|
427
427
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -429,7 +429,7 @@ declare class DeepBookContract {
|
|
|
429
429
|
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
430
430
|
* @returns A function that takes a Transaction object
|
|
431
431
|
*/
|
|
432
|
-
getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) =>
|
|
432
|
+
getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
433
433
|
/**
|
|
434
434
|
* @description Get the quote quantity needed to receive a target base quantity
|
|
435
435
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -437,14 +437,14 @@ declare class DeepBookContract {
|
|
|
437
437
|
* @param {boolean} payWithDeep Whether to pay fees with DEEP
|
|
438
438
|
* @returns A function that takes a Transaction object
|
|
439
439
|
*/
|
|
440
|
-
getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) =>
|
|
440
|
+
getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
441
441
|
/**
|
|
442
442
|
* @description Get account order details for a balance manager
|
|
443
443
|
* @param {string} poolKey The key to identify the pool
|
|
444
444
|
* @param {string} managerKey Key of the balance manager
|
|
445
445
|
* @returns A function that takes a Transaction object
|
|
446
446
|
*/
|
|
447
|
-
getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) =>
|
|
447
|
+
getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
448
448
|
/**
|
|
449
449
|
* @description Get the DEEP required for an order
|
|
450
450
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -452,51 +452,51 @@ declare class DeepBookContract {
|
|
|
452
452
|
* @param {number} price Price
|
|
453
453
|
* @returns A function that takes a Transaction object
|
|
454
454
|
*/
|
|
455
|
-
getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) =>
|
|
455
|
+
getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
456
456
|
/**
|
|
457
457
|
* @description Check if account exists for a balance manager
|
|
458
458
|
* @param {string} poolKey The key to identify the pool
|
|
459
459
|
* @param {string} managerKey Key of the balance manager
|
|
460
460
|
* @returns A function that takes a Transaction object
|
|
461
461
|
*/
|
|
462
|
-
accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) =>
|
|
462
|
+
accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
463
463
|
/**
|
|
464
464
|
* @description Get the next epoch trade parameters for a pool
|
|
465
465
|
* @param {string} poolKey The key to identify the pool
|
|
466
466
|
* @returns A function that takes a Transaction object
|
|
467
467
|
*/
|
|
468
|
-
poolTradeParamsNext: (poolKey: string) => (tx: Transaction) =>
|
|
468
|
+
poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
469
469
|
/**
|
|
470
470
|
* @description Get the quorum for a pool
|
|
471
471
|
* @param {string} poolKey The key to identify the pool
|
|
472
472
|
* @returns A function that takes a Transaction object
|
|
473
473
|
*/
|
|
474
|
-
quorum: (poolKey: string) => (tx: Transaction) =>
|
|
474
|
+
quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
475
475
|
/**
|
|
476
476
|
* @description Get the pool ID
|
|
477
477
|
* @param {string} poolKey The key to identify the pool
|
|
478
478
|
* @returns A function that takes a Transaction object
|
|
479
479
|
*/
|
|
480
|
-
poolId: (poolKey: string) => (tx: Transaction) =>
|
|
480
|
+
poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
481
481
|
/**
|
|
482
482
|
* @description Check if a limit order can be placed
|
|
483
483
|
* @param {CanPlaceLimitOrderParams} params Parameters for checking limit order validity
|
|
484
484
|
* @returns A function that takes a Transaction object
|
|
485
485
|
*/
|
|
486
|
-
canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) =>
|
|
486
|
+
canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
487
487
|
/**
|
|
488
488
|
* @description Check if a market order can be placed
|
|
489
489
|
* @param {CanPlaceMarketOrderParams} params Parameters for checking market order validity
|
|
490
490
|
* @returns A function that takes a Transaction object
|
|
491
491
|
*/
|
|
492
|
-
canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) =>
|
|
492
|
+
canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
493
493
|
/**
|
|
494
494
|
* @description Check if market order params are valid
|
|
495
495
|
* @param {string} poolKey The key to identify the pool
|
|
496
496
|
* @param {number} quantity Quantity
|
|
497
497
|
* @returns A function that takes a Transaction object
|
|
498
498
|
*/
|
|
499
|
-
checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) =>
|
|
499
|
+
checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
500
500
|
/**
|
|
501
501
|
* @description Check if limit order params are valid
|
|
502
502
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -505,7 +505,7 @@ declare class DeepBookContract {
|
|
|
505
505
|
* @param {number} expireTimestamp Expiration timestamp
|
|
506
506
|
* @returns A function that takes a Transaction object
|
|
507
507
|
*/
|
|
508
|
-
checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) =>
|
|
508
|
+
checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions10.TransactionResult;
|
|
509
509
|
}
|
|
510
510
|
//#endregion
|
|
511
511
|
export { DeepBookContract };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreatePoolAdminParams, SetEwmaParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions29 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/deepbookAdmin.d.ts
|
|
@@ -104,7 +104,7 @@ declare class DeepBookAdminContract {
|
|
|
104
104
|
* @description Deauthorize the MarginApp by removing its authorization key
|
|
105
105
|
* @returns A function that takes a Transaction object and returns a bool
|
|
106
106
|
*/
|
|
107
|
-
deauthorizeMarginApp: () => (tx: Transaction) =>
|
|
107
|
+
deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
108
108
|
/**
|
|
109
109
|
* @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded
|
|
110
110
|
* in the core registry so it can later disable any allowed package version
|
|
@@ -112,7 +112,7 @@ declare class DeepBookAdminContract {
|
|
|
112
112
|
* `MarginAdminContract.mintPauseCap`.
|
|
113
113
|
* @returns A function that takes a Transaction object and returns the new pause cap
|
|
114
114
|
*/
|
|
115
|
-
mintCorePauseCap: () => (tx: Transaction) =>
|
|
115
|
+
mintCorePauseCap: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
116
116
|
/**
|
|
117
117
|
* @description Revoke a previously minted `DeepbookCorePauseCap` by ID.
|
|
118
118
|
* @param {string} pauseCapId The ID of the core pause cap to revoke
|
|
@@ -133,7 +133,7 @@ declare class DeepBookAdminContract {
|
|
|
133
133
|
* core registry.
|
|
134
134
|
* @returns A function that takes a Transaction object and returns a `VecSet<ID>`
|
|
135
135
|
*/
|
|
136
|
-
corePauseCaps: () => (tx: Transaction) =>
|
|
136
|
+
corePauseCaps: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
|
|
137
137
|
}
|
|
138
138
|
//#endregion
|
|
139
139
|
export { DeepBookAdminContract };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PoolConfigParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions32 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/marginAdmin.d.ts
|
|
@@ -17,7 +17,7 @@ declare class MarginAdminContract {
|
|
|
17
17
|
* @description Mint a maintainer cap
|
|
18
18
|
* @returns A function that takes a Transaction object
|
|
19
19
|
*/
|
|
20
|
-
mintMaintainerCap: () => (tx: Transaction) =>
|
|
20
|
+
mintMaintainerCap: () => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
|
|
21
21
|
/**
|
|
22
22
|
* @description Revoke a maintainer cap
|
|
23
23
|
* @returns A function that takes a Transaction object
|
|
@@ -121,7 +121,7 @@ declare class MarginAdminContract {
|
|
|
121
121
|
* @param {PoolConfigParams} poolConfigParams The parameters for the pool config
|
|
122
122
|
* @returns A function that takes a Transaction object
|
|
123
123
|
*/
|
|
124
|
-
newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) =>
|
|
124
|
+
newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
|
|
125
125
|
/**
|
|
126
126
|
* @description Create a new pool config with leverage
|
|
127
127
|
* @param {string} poolKey The key to identify the pool
|
|
@@ -136,7 +136,7 @@ declare class MarginAdminContract {
|
|
|
136
136
|
* @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points
|
|
137
137
|
* @returns A function that takes a Transaction object
|
|
138
138
|
*/
|
|
139
|
-
newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) =>
|
|
139
|
+
newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
|
|
140
140
|
/**
|
|
141
141
|
* @description Create a new Pyth config
|
|
142
142
|
* @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config
|
|
@@ -147,12 +147,12 @@ declare class MarginAdminContract {
|
|
|
147
147
|
coinKey: string;
|
|
148
148
|
maxConfBps: number;
|
|
149
149
|
maxEwmaDifferenceBps: number;
|
|
150
|
-
}>, maxAgeSeconds: number) => (tx: Transaction) =>
|
|
150
|
+
}>, maxAgeSeconds: number) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
|
|
151
151
|
/**
|
|
152
152
|
* @description Mint a pause cap
|
|
153
153
|
* @returns A function that takes a Transaction object
|
|
154
154
|
*/
|
|
155
|
-
mintPauseCap: () => (tx: Transaction) =>
|
|
155
|
+
mintPauseCap: () => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
|
|
156
156
|
/**
|
|
157
157
|
* @description Revoke a pause cap
|
|
158
158
|
* @param {string} pauseCapId The ID of the pause cap to revoke
|
|
@@ -172,7 +172,7 @@ declare class MarginAdminContract {
|
|
|
172
172
|
* @param {string} coinKey The key to identify the margin pool
|
|
173
173
|
* @returns A function that takes a Transaction object and returns a Coin<Asset>
|
|
174
174
|
*/
|
|
175
|
-
adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) =>
|
|
175
|
+
adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions32.TransactionResult;
|
|
176
176
|
}
|
|
177
177
|
//#endregion
|
|
178
178
|
export { MarginAdminContract };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InterestConfigParams, MarginPoolConfigParams } from "../types/index.mjs";
|
|
2
2
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _mysten_sui_transactions38 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/transactions/marginMaintainer.d.ts
|
|
@@ -27,27 +27,27 @@ declare class MarginMaintainerContract {
|
|
|
27
27
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
28
28
|
* @returns A function that takes a Transaction object
|
|
29
29
|
*/
|
|
30
|
-
newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) =>
|
|
30
|
+
newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
|
|
31
31
|
/**
|
|
32
32
|
* @description Create a new margin pool config
|
|
33
33
|
* @param {string} coinKey The key to identify the coin
|
|
34
34
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool
|
|
35
35
|
* @returns A function that takes a Transaction object
|
|
36
36
|
*/
|
|
37
|
-
newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) =>
|
|
37
|
+
newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
|
|
38
38
|
/**
|
|
39
39
|
* @description Create a new margin pool config with rate limit
|
|
40
40
|
* @param {string} coinKey The key to identify the coin
|
|
41
41
|
* @param {MarginPoolConfigParams} marginPoolConfig The configuration for the margin pool with rate limit
|
|
42
42
|
* @returns A function that takes a Transaction object
|
|
43
43
|
*/
|
|
44
|
-
newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) =>
|
|
44
|
+
newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
|
|
45
45
|
/**
|
|
46
46
|
* @description Create a new interest config
|
|
47
47
|
* @param {InterestConfigParams} interestConfig The configuration for the interest
|
|
48
48
|
* @returns A function that takes a Transaction object
|
|
49
49
|
*/
|
|
50
|
-
newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) =>
|
|
50
|
+
newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions38.TransactionResult;
|
|
51
51
|
/**
|
|
52
52
|
* @description Enable a deepbook pool for loan
|
|
53
53
|
* @param {string} deepbookPoolKey The key to identify the deepbook pool
|