@mysten/deepbook-v3 1.3.2 → 1.3.3

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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mysten/deepbook-v3
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - bb8d26a: Fix three latent type errors in the generated `utils/index.ts` that surfaced for
8
+ consumers with `noUncheckedIndexedAccess: true`:
9
+ - `getPureBcsSchema(structTag.typeParams[0])` passed `TypeTag | undefined` to a parameter typed
10
+ `string | TypeTag`. Now null-checks the inner tag before passing it.
11
+ - `argTypes[i]` was redundantly re-indexed inside a `for…of entries()` loop, returning
12
+ `string | null | undefined` and being passed back to `getPureBcsSchema`. Switched to the loop
13
+ variable, which is `string | null`.
14
+ - `MoveStruct.get()` returned the destructured `[res]` from `getMany([objectId])` without
15
+ asserting it was defined. Now throws if no object was returned.
16
+
17
+ The codegen test suite gained a `tsc`-based check that compiles the generated `utils/index.ts`
18
+ under strict + `noUncheckedIndexedAccess`, so embedded-template type bugs are caught before
19
+ release rather than by downstream consumers.
20
+
21
+ All consumer packages (`payment-kit`, `pas`, `walrus`, `suins`, `deepbook-v3`, `kiosk`) have been
22
+ regenerated with the fix.
23
+
3
24
  ## 1.3.2
4
25
 
5
26
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/contracts/utils/index.ts"],"mappings":";;;;;KAkBY,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;AAAA,cAyI1C,UAAA,WACF,MAAA,SAAe,OAAA,oDAEhB,SAAA,CAAU,CAAA,EAAG,IAAA;EAChB,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;EAWZ,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"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/contracts/utils/index.ts"],"mappings":";;;;;KAkBY,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;AAAA,cAyI1C,UAAA,WACF,MAAA,SAAe,OAAA,oDAEhB,SAAA,CAAU,CAAA,EAAG,IAAA;EAChB,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"}
@@ -11,6 +11,7 @@ var MoveStruct = class extends BcsStruct {
11
11
  ...options,
12
12
  objectIds: [objectId]
13
13
  });
14
+ if (!res) throw new Error(`No object found for id ${objectId}`);
14
15
  return res;
15
16
  }
16
17
  async getMany({ client, ...options }) {
@@ -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 { 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 type = getPureBcsSchema(structTag.typeParams[0]);\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 [i, argType] of argTypes.entries()) {\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 type = argTypes[i];\n\t\tconst bcsType = type === null ? null : getPureBcsSchema(type);\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 ${type}`);\n\t}\n\n\treturn normalizedArgs;\n}\n\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\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\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\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (val: unknown) => val);\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;AAiJxD,IAAa,aAAb,cAGU,UAAmB;CAC5B,MAAM,IAAiF,EACtF,UACA,GAAG,WAKF;EACD,MAAM,CAAC,OAAO,MAAM,KAAK,QAAiB;GACzC,GAAG;GACH,WAAW,CAAC,SAAS;GACrB,CAAC;AAEF,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"}
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 { 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\nexport class MoveStruct<\n\tT extends Record<string, BcsType<any>>,\n\tconst Name extends string = string,\n> extends BcsStruct<T, Name> {\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\nexport class MoveTuple<\n\tconst T extends readonly BcsType<any>[],\n\tconst Name extends string,\n> extends BcsTuple<T, Name> {}\n\nfunction stringify(val: unknown) {\n\tif (typeof val === 'object') {\n\t\treturn JSON.stringify(val, (val: unknown) => val);\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;AAiJxD,IAAa,aAAb,cAGU,UAAmB;CAC5B,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"}
@@ -1,6 +1,6 @@
1
1
  import { PoolConfigParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions52 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions30 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) => _mysten_sui_transactions52.TransactionResult;
20
+ mintMaintainerCap: () => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
21
21
  /**
22
22
  * @description Revoke a maintainer cap
23
23
  * @returns A function that takes a Transaction object
@@ -80,7 +80,7 @@ declare class MarginAdminContract {
80
80
  * @param {PoolConfigParams} poolConfigParams The parameters for the pool config
81
81
  * @returns A function that takes a Transaction object
82
82
  */
83
- newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions52.TransactionResult;
83
+ newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
84
84
  /**
85
85
  * @description Create a new pool config with leverage
86
86
  * @param {string} poolKey The key to identify the pool
@@ -95,7 +95,7 @@ declare class MarginAdminContract {
95
95
  * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points
96
96
  * @returns A function that takes a Transaction object
97
97
  */
98
- newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => _mysten_sui_transactions52.TransactionResult;
98
+ newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
99
99
  /**
100
100
  * @description Create a new Pyth config
101
101
  * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config
@@ -106,12 +106,12 @@ declare class MarginAdminContract {
106
106
  coinKey: string;
107
107
  maxConfBps: number;
108
108
  maxEwmaDifferenceBps: number;
109
- }>, maxAgeSeconds: number) => (tx: Transaction) => _mysten_sui_transactions52.TransactionResult;
109
+ }>, maxAgeSeconds: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
110
110
  /**
111
111
  * @description Mint a pause cap
112
112
  * @returns A function that takes a Transaction object
113
113
  */
114
- mintPauseCap: () => (tx: Transaction) => _mysten_sui_transactions52.TransactionResult;
114
+ mintPauseCap: () => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
115
115
  /**
116
116
  * @description Revoke a pause cap
117
117
  * @param {string} pauseCapId The ID of the pause cap to revoke
@@ -131,7 +131,7 @@ declare class MarginAdminContract {
131
131
  * @param {string} coinKey The key to identify the margin pool
132
132
  * @returns A function that takes a Transaction object and returns a Coin<Asset>
133
133
  */
134
- adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions52.TransactionResult;
134
+ adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
135
135
  }
136
136
  //#endregion
137
137
  export { MarginAdminContract };
@@ -1,5 +1,5 @@
1
1
  import { DeepBookConfig } from "../utils/config.mjs";
2
- import * as _mysten_sui_transactions105 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions91 from "@mysten/sui/transactions";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/marginLiquidations.d.ts
@@ -35,7 +35,7 @@ declare class MarginLiquidationsContract {
35
35
  * @param {number} amount The amount to withdraw
36
36
  * @returns A function that takes a Transaction object and returns the withdrawn coin
37
37
  */
38
- withdraw: (vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions105.TransactionResult;
38
+ withdraw: (vaultId: string, liquidationAdminCap: string, coinKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
39
39
  /**
40
40
  * @description Liquidate a margin manager by repaying base debt
41
41
  * @param {string} vaultId The liquidation vault object ID
@@ -60,7 +60,7 @@ declare class MarginLiquidationsContract {
60
60
  * @param {string} coinKey The key to identify the coin type
61
61
  * @returns A function that takes a Transaction object
62
62
  */
63
- balance: (vaultId: string, coinKey: string) => (tx: Transaction) => _mysten_sui_transactions105.TransactionResult;
63
+ balance: (vaultId: string, coinKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
64
64
  }
65
65
  //#endregion
66
66
  export { MarginLiquidationsContract };
@@ -1 +1 @@
1
- {"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;cAWa,0BAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAiDd;;;;;EAxCN,sBAAA,GAA0B,mBAAA,cAAiC,EAAA,EAAI,WAAA;EA6IC;;;;;;;;EA9HhE,OAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA;EAjBqD;;;;;;;;EAsC3D,QAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;EADf;;;;;;;;EAsBF,aAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADa;;;;;;;;EAuCnB,cAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADsD;;;;;;EAuC5D,OAAA,GAAW,OAAA,UAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA"}
1
+ {"version":3,"file":"marginLiquidations.d.mts","names":[],"sources":["../../src/transactions/marginLiquidations.ts"],"mappings":";;;;;;;;cAWa,0BAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAiDd;;;;;EAxCN,sBAAA,GAA0B,mBAAA,cAAiC,EAAA,EAAI,WAAA;EA6IC;;;;;;;;EA9HhE,OAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA;EAjBqD;;;;;;;;EAsC3D,QAAA,GACE,OAAA,UAAiB,mBAAA,UAA6B,OAAA,UAAiB,MAAA,cAC/D,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EADf;;;;;;;;EAsBF,aAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADa;;;;;;;;EAuCnB,cAAA,GACE,OAAA,UAAiB,cAAA,UAAwB,OAAA,UAAiB,WAAA,eAC1D,EAAA,EAAI,WAAA;EADsD;;;;;;EAuC5D,OAAA,GAAW,OAAA,UAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { InterestConfigParams, MarginPoolConfigParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions58 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions36 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) => _mysten_sui_transactions58.TransactionResult;
30
+ newProtocolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams, interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions36.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) => _mysten_sui_transactions58.TransactionResult;
37
+ newMarginPoolConfig: (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions36.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) => _mysten_sui_transactions58.TransactionResult;
44
+ newMarginPoolConfigWithRateLimit: (coinKey: string, marginPoolConfig: Required<Pick<MarginPoolConfigParams, "rateLimitCapacity" | "rateLimitRefillRatePerMs" | "rateLimitEnabled">> & MarginPoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions36.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) => _mysten_sui_transactions58.TransactionResult;
50
+ newInterestConfig: (interestConfig: InterestConfigParams) => (tx: Transaction) => _mysten_sui_transactions36.TransactionResult;
51
51
  /**
52
52
  * @description Enable a deepbook pool for loan
53
53
  * @param {string} deepbookPoolKey The key to identify the deepbook pool
@@ -1,6 +1,6 @@
1
1
  import { DepositDuringInitParams, DepositParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions30 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions40 from "@mysten/sui/transactions";
4
4
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginManager.d.ts
@@ -73,49 +73,49 @@ declare class MarginManagerContract {
73
73
  * @param {number} amount The amount to withdraw
74
74
  * @returns A function that takes a Transaction object
75
75
  */
76
- withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
76
+ withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
77
77
  /**
78
78
  * @description Withdraw quote from a margin manager
79
79
  * @param {string} managerKey The key to identify the manager
80
80
  * @param {number} amount The amount to withdraw
81
81
  * @returns A function that takes a Transaction object
82
82
  */
83
- withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
83
+ withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
84
84
  /**
85
85
  * @description Withdraw deep from a margin manager
86
86
  * @param {string} managerKey The key to identify the manager
87
87
  * @param {number} amount The amount to withdraw
88
88
  * @returns A function that takes a Transaction object
89
89
  */
90
- withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
90
+ withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
91
91
  /**
92
92
  * @description Borrow base from a margin manager
93
93
  * @param {string} managerKey The key to identify the manager
94
94
  * @param {number} amount The amount to borrow
95
95
  * @returns A function that takes a Transaction object
96
96
  */
97
- borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
97
+ borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
98
98
  /**
99
99
  * @description Borrow quote from a margin manager
100
100
  * @param {string} managerKey The key to identify the manager
101
101
  * @param {number} amount The amount to borrow
102
102
  * @returns A function that takes a Transaction object
103
103
  */
104
- borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
104
+ borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
105
105
  /**
106
106
  * @description Repay base from a margin manager
107
107
  * @param {string} managerKey The key to identify the manager
108
108
  * @param {number} amount The amount to repay
109
109
  * @returns A function that takes a Transaction object
110
110
  */
111
- repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
111
+ repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
112
112
  /**
113
113
  * @description Repay quote from a margin manager
114
114
  * @param {string} managerKey The key to identify the manager
115
115
  * @param {number} amount The amount to repay
116
116
  * @returns A function that takes a Transaction object
117
117
  */
118
- repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
118
+ repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
119
119
  /**
120
120
  * @description Liquidate a margin manager
121
121
  * @param {string} managerAddress The address of the manager to liquidate
@@ -124,7 +124,7 @@ declare class MarginManagerContract {
124
124
  * @param {TransactionArgument} repayCoin The coin to repay
125
125
  * @returns A function that takes a Transaction object
126
126
  */
127
- liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
127
+ liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
128
128
  /**
129
129
  * @description Set the referral for a margin manager (DeepBookPoolReferral)
130
130
  * @param {string} managerKey The key to identify the margin manager
@@ -145,63 +145,63 @@ declare class MarginManagerContract {
145
145
  * @param {string} marginManagerId The ID of the margin manager
146
146
  * @returns A function that takes a Transaction object
147
147
  */
148
- ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
148
+ ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
149
149
  /**
150
150
  * @description Get the DeepBook pool ID associated with a margin manager
151
151
  * @param {string} poolKey The key to identify the pool
152
152
  * @param {string} marginManagerId The ID of the margin manager
153
153
  * @returns A function that takes a Transaction object
154
154
  */
155
- deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
155
+ deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
156
156
  /**
157
157
  * @description Get the margin pool ID (if any) associated with a margin manager
158
158
  * @param {string} poolKey The key to identify the pool
159
159
  * @param {string} marginManagerId The ID of the margin manager
160
160
  * @returns A function that takes a Transaction object
161
161
  */
162
- marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
162
+ marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
163
163
  /**
164
164
  * @description Get borrowed shares for both base and quote assets
165
165
  * @param {string} poolKey The key to identify the pool
166
166
  * @param {string} marginManagerId The ID of the margin manager
167
167
  * @returns A function that takes a Transaction object
168
168
  */
169
- borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
169
+ borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
170
170
  /**
171
171
  * @description Get borrowed base shares
172
172
  * @param {string} poolKey The key to identify the pool
173
173
  * @param {string} marginManagerId The ID of the margin manager
174
174
  * @returns A function that takes a Transaction object
175
175
  */
176
- borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
176
+ borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
177
177
  /**
178
178
  * @description Get borrowed quote shares
179
179
  * @param {string} poolKey The key to identify the pool
180
180
  * @param {string} marginManagerId The ID of the margin manager
181
181
  * @returns A function that takes a Transaction object
182
182
  */
183
- borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
183
+ borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
184
184
  /**
185
185
  * @description Check if margin manager has base asset debt
186
186
  * @param {string} poolKey The key to identify the pool
187
187
  * @param {string} marginManagerId The ID of the margin manager
188
188
  * @returns A function that takes a Transaction object
189
189
  */
190
- hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
190
+ hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
191
191
  /**
192
192
  * @description Get the balance manager ID for a margin manager
193
193
  * @param {string} poolKey The key to identify the pool
194
194
  * @param {string} marginManagerId The ID of the margin manager
195
195
  * @returns A function that takes a Transaction object
196
196
  */
197
- balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
197
+ balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
198
198
  /**
199
199
  * @description Calculate assets (base and quote) for a margin manager
200
200
  * @param {string} poolKey The key to identify the pool
201
201
  * @param {string} marginManagerId The ID of the margin manager
202
202
  * @returns A function that takes a Transaction object
203
203
  */
204
- calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
204
+ calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
205
205
  /**
206
206
  * @description Calculate debts (base and quote) for a margin manager
207
207
  * @param {string} poolKey The key to identify the pool
@@ -209,7 +209,7 @@ declare class MarginManagerContract {
209
209
  * @param {string} marginManagerId The ID of the margin manager
210
210
  * @returns A function that takes a Transaction object
211
211
  */
212
- calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
212
+ calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
213
213
  /**
214
214
  * @description Get comprehensive state information for a margin manager
215
215
  * @param {string} poolKey The key to identify the pool
@@ -219,28 +219,28 @@ declare class MarginManagerContract {
219
219
  * base_debt, quote_debt, base_pyth_price, base_pyth_decimals,
220
220
  * quote_pyth_price, quote_pyth_decimals)
221
221
  */
222
- managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
222
+ managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
223
223
  /**
224
224
  * @description Get the base asset balance of a margin manager
225
225
  * @param {string} poolKey The key to identify the pool
226
226
  * @param {string} marginManagerId The ID of the margin manager
227
227
  * @returns A function that takes a Transaction object
228
228
  */
229
- baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
229
+ baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
230
230
  /**
231
231
  * @description Get the quote asset balance of a margin manager
232
232
  * @param {string} poolKey The key to identify the pool
233
233
  * @param {string} marginManagerId The ID of the margin manager
234
234
  * @returns A function that takes a Transaction object
235
235
  */
236
- quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
236
+ quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
237
237
  /**
238
238
  * @description Get the DEEP token balance of a margin manager
239
239
  * @param {string} poolKey The key to identify the pool
240
240
  * @param {string} marginManagerId The ID of the margin manager
241
241
  * @returns A function that takes a Transaction object
242
242
  */
243
- deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions30.TransactionResult;
243
+ deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions40.TransactionResult;
244
244
  }
245
245
  //#endregion
246
246
  export { MarginManagerContract };
@@ -1,5 +1,5 @@
1
1
  import { DeepBookConfig } from "../utils/config.mjs";
2
- import * as _mysten_sui_transactions91 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions93 from "@mysten/sui/transactions";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/marginRegistry.d.ts
@@ -17,83 +17,83 @@ declare class MarginRegistryContract {
17
17
  * @param {string} poolKey The key to identify the pool
18
18
  * @returns A function that takes a Transaction object
19
19
  */
20
- poolEnabled: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
20
+ poolEnabled: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
21
21
  /**
22
22
  * @description Get the margin pool ID for a given asset
23
23
  * @param {string} coinKey The key to identify the coin
24
24
  * @returns A function that takes a Transaction object
25
25
  */
26
- getMarginPoolId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
26
+ getMarginPoolId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
27
27
  /**
28
28
  * @description Get the margin pool IDs (base and quote) for a deepbook pool
29
29
  * @param {string} poolKey The key to identify the pool
30
30
  * @returns A function that takes a Transaction object
31
31
  */
32
- getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
32
+ getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
33
33
  /**
34
34
  * @description Get the margin manager IDs for a given owner
35
35
  * @param {string} owner The owner address
36
36
  * @returns A function that takes a Transaction object
37
37
  */
38
- getMarginManagerIds: (owner: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
38
+ getMarginManagerIds: (owner: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
39
39
  /**
40
40
  * @description Get the base margin pool ID for a deepbook pool
41
41
  * @param {string} poolKey The key to identify the pool
42
42
  * @returns A function that takes a Transaction object
43
43
  */
44
- baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
44
+ baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
45
45
  /**
46
46
  * @description Get the quote margin pool ID for a deepbook pool
47
47
  * @param {string} poolKey The key to identify the pool
48
48
  * @returns A function that takes a Transaction object
49
49
  */
50
- quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
50
+ quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
51
51
  /**
52
52
  * @description Get the minimum withdraw risk ratio for a deepbook pool
53
53
  * @param {string} poolKey The key to identify the pool
54
54
  * @returns A function that takes a Transaction object
55
55
  */
56
- minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
56
+ minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
57
57
  /**
58
58
  * @description Get the minimum borrow risk ratio for a deepbook pool
59
59
  * @param {string} poolKey The key to identify the pool
60
60
  * @returns A function that takes a Transaction object
61
61
  */
62
- minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
62
+ minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
63
63
  /**
64
64
  * @description Get the liquidation risk ratio for a deepbook pool
65
65
  * @param {string} poolKey The key to identify the pool
66
66
  * @returns A function that takes a Transaction object
67
67
  */
68
- liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
68
+ liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
69
69
  /**
70
70
  * @description Get the target liquidation risk ratio for a deepbook pool
71
71
  * @param {string} poolKey The key to identify the pool
72
72
  * @returns A function that takes a Transaction object
73
73
  */
74
- targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
74
+ targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
75
75
  /**
76
76
  * @description Get the user liquidation reward for a deepbook pool
77
77
  * @param {string} poolKey The key to identify the pool
78
78
  * @returns A function that takes a Transaction object
79
79
  */
80
- userLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
80
+ userLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
81
81
  /**
82
82
  * @description Get the pool liquidation reward for a deepbook pool
83
83
  * @param {string} poolKey The key to identify the pool
84
84
  * @returns A function that takes a Transaction object
85
85
  */
86
- poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
86
+ poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
87
87
  /**
88
88
  * @description Get all allowed maintainer cap IDs
89
89
  * @returns A function that takes a Transaction object
90
90
  */
91
- allowedMaintainers: () => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
91
+ allowedMaintainers: () => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
92
92
  /**
93
93
  * @description Get all allowed pause cap IDs
94
94
  * @returns A function that takes a Transaction object
95
95
  */
96
- allowedPauseCaps: () => (tx: Transaction) => _mysten_sui_transactions91.TransactionResult;
96
+ allowedPauseCaps: () => (tx: Transaction) => _mysten_sui_transactions93.TransactionResult;
97
97
  }
98
98
  //#endregion
99
99
  export { MarginRegistryContract };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@mysten/deepbook-v3",
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui Deepbook SDK",
5
- "version": "1.3.2",
5
+ "version": "1.3.3",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",
8
8
  "main": "./dist/index.mjs",
@@ -46,7 +46,7 @@
46
46
  "vite": "^8.0.5",
47
47
  "vitest": "^4.0.17",
48
48
  "wait-on": "^9.0.3",
49
- "@mysten/codegen": "^0.10.0",
49
+ "@mysten/codegen": "^0.10.3",
50
50
  "@mysten/sui": "^2.16.0"
51
51
  },
52
52
  "peerDependencies": {
@@ -57,7 +57,8 @@ export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null
57
57
  }
58
58
 
59
59
  if (structTag.module === 'option' && structTag.name === 'Option') {
60
- const type = getPureBcsSchema(structTag.typeParams[0]);
60
+ const inner = structTag.typeParams[0];
61
+ const type = inner ? getPureBcsSchema(inner) : null;
61
62
  return type ? bcs.option(type) : null;
62
63
  }
63
64
  }
@@ -89,7 +90,7 @@ export function normalizeMoveArguments(
89
90
  const normalizedArgs: TransactionArgument[] = [];
90
91
 
91
92
  let index = 0;
92
- for (const [i, argType] of argTypes.entries()) {
93
+ for (const argType of argTypes) {
93
94
  if (argType === '0x2::clock::Clock') {
94
95
  normalizedArgs.push((tx) => tx.object.clock());
95
96
  continue;
@@ -137,8 +138,7 @@ export function normalizeMoveArguments(
137
138
  continue;
138
139
  }
139
140
 
140
- const type = argTypes[i];
141
- const bcsType = type === null ? null : getPureBcsSchema(type);
141
+ const bcsType = argType === null ? null : getPureBcsSchema(argType);
142
142
 
143
143
  if (bcsType) {
144
144
  const bytes = bcsType.serialize(arg as never);
@@ -151,7 +151,7 @@ export function normalizeMoveArguments(
151
151
  continue;
152
152
  }
153
153
 
154
- throw new Error(`Invalid argument ${stringify(arg)} for type ${type}`);
154
+ throw new Error(`Invalid argument ${stringify(arg)} for type ${argType}`);
155
155
  }
156
156
 
157
157
  return normalizedArgs;
@@ -174,6 +174,10 @@ export class MoveStruct<
174
174
  objectIds: [objectId],
175
175
  });
176
176
 
177
+ if (!res) {
178
+ throw new Error(`No object found for id ${objectId}`);
179
+ }
180
+
177
181
  return res;
178
182
  }
179
183