@sentio/sdk 2.13.0-rc.2 → 2.13.0-rc.4
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/lib/aptos/aptos-chain-adapter.d.ts +11 -0
- package/lib/aptos/aptos-chain-adapter.js +56 -0
- package/lib/aptos/aptos-chain-adapter.js.map +1 -0
- package/lib/aptos/aptos-processor.d.ts +1 -2
- package/lib/aptos/aptos-processor.js +6 -14
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/builtin/0x1.js +2 -1
- package/lib/aptos/builtin/0x1.js.map +1 -1
- package/lib/aptos/builtin/0x3.js +2 -1
- package/lib/aptos/builtin/0x3.js.map +1 -1
- package/lib/aptos/codegen/codegen.js +4 -45
- package/lib/aptos/codegen/codegen.js.map +1 -1
- package/lib/aptos/context.d.ts +3 -0
- package/lib/aptos/context.js +5 -0
- package/lib/aptos/context.js.map +1 -1
- package/lib/aptos/ext/aptos-dex.js +1 -2
- package/lib/aptos/ext/aptos-dex.js.map +1 -1
- package/lib/aptos/move-coder.d.ts +4 -5
- package/lib/aptos/move-coder.js +14 -8
- package/lib/aptos/move-coder.js.map +1 -1
- package/lib/move/abstract-codegen.d.ts +4 -4
- package/lib/move/abstract-codegen.js +22 -10
- package/lib/move/abstract-codegen.js.map +1 -1
- package/lib/move/abstract-move-coder.d.ts +5 -2
- package/lib/move/abstract-move-coder.js +7 -1
- package/lib/move/abstract-move-coder.js.map +1 -1
- package/lib/move/chain-adapter.d.ts +9 -0
- package/lib/move/chain-adapter.js +3 -0
- package/lib/move/chain-adapter.js.map +1 -0
- package/lib/move/index.d.ts +1 -0
- package/lib/move/index.js +1 -0
- package/lib/move/index.js.map +1 -1
- package/lib/sui/builtin/0x1.js +2 -1
- package/lib/sui/builtin/0x1.js.map +1 -1
- package/lib/sui/builtin/0x2.js +2 -1
- package/lib/sui/builtin/0x2.js.map +1 -1
- package/lib/sui/builtin/0x3.js +2 -1
- package/lib/sui/builtin/0x3.js.map +1 -1
- package/lib/sui/codegen/codegen.js +4 -34
- package/lib/sui/codegen/codegen.js.map +1 -1
- package/lib/sui/context.d.ts +2 -0
- package/lib/sui/context.js +3 -0
- package/lib/sui/context.js.map +1 -1
- package/lib/sui/move-coder.d.ts +5 -5
- package/lib/sui/move-coder.js +14 -8
- package/lib/sui/move-coder.js.map +1 -1
- package/lib/sui/sui-chain-adapter.d.ts +11 -0
- package/lib/sui/sui-chain-adapter.js +43 -0
- package/lib/sui/sui-chain-adapter.js.map +1 -0
- package/lib/sui/sui-processor.d.ts +2 -0
- package/lib/sui/sui-processor.js +4 -2
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/sui/utils.d.ts +0 -2
- package/lib/sui/utils.js +0 -6
- package/lib/sui/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/aptos/aptos-chain-adapter.ts +65 -0
- package/src/aptos/aptos-processor.ts +17 -15
- package/src/aptos/builtin/0x1.ts +2 -1
- package/src/aptos/builtin/0x3.ts +2 -1
- package/src/aptos/codegen/codegen.ts +5 -54
- package/src/aptos/context.ts +5 -0
- package/src/aptos/ext/aptos-dex.ts +2 -11
- package/src/aptos/move-coder.ts +17 -12
- package/src/move/abstract-codegen.ts +28 -17
- package/src/move/abstract-move-coder.ts +10 -3
- package/src/move/chain-adapter.ts +14 -0
- package/src/move/index.ts +1 -0
- package/src/sui/builtin/0x1.ts +2 -1
- package/src/sui/builtin/0x2.ts +2 -1
- package/src/sui/builtin/0x3.ts +2 -1
- package/src/sui/codegen/codegen.ts +5 -40
- package/src/sui/context.ts +3 -0
- package/src/sui/move-coder.ts +18 -11
- package/src/sui/sui-chain-adapter.ts +50 -0
- package/src/sui/sui-processor.ts +5 -3
- package/src/sui/utils.ts +0 -8
- package/lib/aptos/utils.d.ts +0 -2
- package/lib/aptos/utils.js +0 -10
- package/lib/aptos/utils.js.map +0 -1
- package/src/aptos/utils.ts +0 -11
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"abst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veFunctionVisibility,\n InternalMoveModule,\n InternalMoveStruct,\n} from './internal-models.js'\nimport path from 'path'\nimport fs from 'fs'\nimport { AccountModulesImportInfo, AccountRegister } from './account.js'\nimport chalk from 'chalk'\nimport { format } from 'prettier'\nimport { isFrameworkAccount, moduleQname, normalizeToJSName, SPLITTER, VECTOR_STR } from './utils.js'\nimport { camelCase, upperFirst } from 'lodash-es'\nimport { TypeDescriptor } from './types.js'\n\ninterface OutputFile {\n fileName: string\n fileContent: string\n}\n\ninterface Config<NetworkType> {\n fileName: string\n outputDir: string\n network: NetworkType\n}\n\nexport abstract class AbstractCodegen<ModuleTypes, NetworkType> {\n TEST_NET: NetworkType\n MAIN_NET: NetworkType\n ADDRESS_TYPE: string\n PREFIX: string\n STRUCT_FIELD_NAME: string = 'data'\n GENERATE_CLIENT = false\n GENERATE_ON_ENTRY = true\n PAYLOAD_OPTIONAL = false\n\n abstract fetchModules(account: string, network: NetworkType): Promise<ModuleTypes>\n abstract toInternalModules(modules: ModuleTypes): InternalMoveModule[]\n // Get the structs that represent Events\n abstract getEventStructs(module: InternalMoveModule): Map<string, InternalMoveStruct>\n // Get the parameters that actually have arguments in runtime\n // Aptos first signer and Sui's last TxContext are no use\n abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[]\n\n readModulesFile(fullPath: string) {\n return JSON.parse(fs.readFileSync(fullPath, 'utf-8'))\n }\n\n async generate(srcDir: string, outputDir: string): Promise<number> {\n const num1 = await this.generateForNetwork(srcDir, outputDir, this.MAIN_NET)\n const num2 = await this.generateForNetwork(\n path.join(srcDir, 'testnet'),\n path.join(outputDir, 'testnet'),\n this.TEST_NET\n )\n return num1 + num2\n }\n\n async generateForNetwork(srcDir: string, outputDir: string, network: NetworkType) {\n if (!fs.existsSync(srcDir)) {\n return 0\n }\n\n const files = fs.readdirSync(srcDir)\n outputDir = path.resolve(outputDir)\n const outputs: OutputFile[] = []\n\n fs.mkdirSync(outputDir, { recursive: true })\n\n const loader = new AccountRegister()\n\n // when generating user code, don't need to generate framework account\n loader.accountImports.set('0x1', new AccountModulesImportInfo('0x1', '0x1'))\n loader.accountImports.set('0x2', new AccountModulesImportInfo('0x2', '0x2'))\n loader.accountImports.set('0x3', new AccountModulesImportInfo('0x3', '0x3'))\n // const client = getRpcClient(network)\n\n for (const file of files) {\n if (!file.endsWith('.json')) {\n continue\n }\n const fullPath = path.resolve(srcDir, file)\n const abi = this.readModulesFile(fullPath)\n const modules = this.toInternalModules(abi)\n\n for (const module of modules) {\n loader.register(module, path.basename(file, '.json'))\n }\n const codeGen = new AccountCodegen(this, loader, abi, modules, {\n fileName: path.basename(file, '.json'),\n outputDir: outputDir,\n network,\n })\n\n outputs.push(...codeGen.generate())\n }\n\n while (loader.pendingAccounts.size > 0) {\n for (const account of loader.pendingAccounts) {\n console.log(`download dependent module for account ${account} at ${network}`)\n\n try {\n const rawModules = await this.fetchModules(account, network)\n const modules = this.toInternalModules(rawModules)\n\n fs.writeFileSync(path.resolve(srcDir, account + '.json'), JSON.stringify(rawModules, null, '\\t'))\n for (const module of modules) {\n loader.register(module, account)\n }\n const codeGen = new AccountCodegen(this, loader, rawModules, modules, {\n fileName: account,\n outputDir: outputDir,\n network,\n })\n\n outputs.push(...codeGen.generate())\n } catch (e) {\n console.error(\n chalk.red(\n 'Error downloading account module, check if you choose the right network,or download account modules manually into your director'\n )\n )\n console.error(e)\n process.exit(1)\n }\n }\n }\n\n for (const output of outputs) {\n // const content = output.fileContent\n const content = format(output.fileContent, { parser: 'typescript' })\n fs.writeFileSync(path.join(outputDir, output.fileName), content)\n }\n\n const rootFile = path.join(outputDir, 'index.ts')\n fs.writeFileSync(\n rootFile,\n `/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n`\n )\n for (const output of outputs) {\n const parsed = path.parse(output.fileName)\n const content = `export * as _${parsed.name.replaceAll('-', '_')} from './${parsed.name}.js'\\n`\n fs.appendFileSync(rootFile, content)\n }\n return outputs.length + 1\n }\n\n generateNetworkOption(network: NetworkType) {\n switch (network) {\n case this.TEST_NET:\n return 'TEST_NET'\n }\n return 'MAIN_NET'\n }\n\n generateModule(module: InternalMoveModule, network: NetworkType) {\n const functions = this.GENERATE_ON_ENTRY\n ? module.exposedFunctions.map((f) => this.generateOnEntryFunctions(module, f)).filter((s) => s !== '')\n : []\n const clientFunctions = this.GENERATE_CLIENT\n ? module.exposedFunctions.map((f) => this.generateClientFunctions(module, f)).filter((s) => s !== '')\n : []\n const eventStructs = this.getEventStructs(module)\n const eventTypes = new Set(eventStructs.keys())\n const events = Array.from(eventStructs.values())\n .map((e) => this.generateOnEvents(module, e))\n .filter((s) => s !== '')\n const structs = module.structs.map((s) => this.generateStructs(module, s, eventTypes))\n const callArgs = module.exposedFunctions.map((f) => this.generateCallArgsStructs(module, f))\n\n const moduleName = normalizeToJSName(module.name)\n let processor = ''\n let client = ''\n\n if (clientFunctions.length > 0) {\n client = `\n export class ${moduleName}_client extends ModuleClient {\n ${clientFunctions.join('\\n')}\n }\n `\n }\n\n if (functions.length > 0 || events.length > 0) {\n processor = `export class ${moduleName} extends ${this.PREFIX}BaseProcessor {\n\n constructor(options: ${this.PREFIX}BindOptions) {\n super(\"${module.name}\", options)\n }\n static DEFAULT_OPTIONS: ${this.PREFIX}BindOptions = {\n address: \"${module.address}\",\n network: ${this.PREFIX}Network.${this.generateNetworkOption(network)}\n }\n\n static bind(options: Partial<${this.PREFIX}BindOptions> = {}): ${moduleName} {\n return new ${moduleName}({ ...${moduleName}.DEFAULT_OPTIONS, ...options })\n }\n\n ${functions.join('\\n')}\n\n ${events.join('\\n')}\n }\n `\n }\n\n return `\n ${client}\n\n ${processor}\n\n export namespace ${moduleName} {\n ${structs.join('\\n')}\n\n ${callArgs.join('\\n')}\n }\n `\n }\n\n generateStructs(module: InternalMoveModule, struct: InternalMoveStruct, events: Set<string>) {\n const genericString = this.generateStructTypeParameters(struct)\n const genericStringAny = this.generateStructTypeParameters(struct, true)\n\n const structName = normalizeToJSName(struct.name)\n\n const fields = struct.fields.map((field) => {\n const type = this.generateTypeForDescriptor(field.type, module.address)\n return `${field.name}: ${type}`\n })\n\n let eventPayload = ''\n if (events.has(moduleQname(module) + SPLITTER + struct.name)) {\n eventPayload = `\n export interface ${structName}Instance extends\n TypedEventInstance<${structName}${genericStringAny}> {\n ${this.STRUCT_FIELD_NAME}_decoded: ${structName}${genericStringAny}\n type_arguments: [${struct.typeParams.map((_) => 'string').join(', ')}]\n }\n `\n }\n\n return `\n export class ${structName}${genericString} {\n static TYPE_QNAME = '${module.address}::${module.name}::${struct.name}'\n ${fields.join('\\n')}\n }\n\n ${eventPayload}\n `\n }\n\n generateFunctionTypeParameters(func: InternalMoveFunction) {\n let genericString = ''\n if (func.typeParams && func.typeParams.length > 0) {\n const params = func.typeParams\n .map((v, idx) => {\n return `T${idx}=any`\n })\n .join(',')\n genericString = `<${params}>`\n }\n return genericString\n }\n\n generateStructTypeParameters(struct: InternalMoveStruct, useAny = false) {\n let genericString = ''\n\n if (struct.typeParams && struct.typeParams.length > 0) {\n const params = struct.typeParams\n .map((v, idx) => {\n return useAny ? 'any' : 'T' + idx\n })\n .join(',')\n genericString = `<${params}>`\n }\n return genericString\n }\n\n generateCallArgsStructs(module: InternalMoveModule, func: InternalMoveFunction) {\n if (!func.isEntry) {\n return\n }\n\n const fields = this.getMeaningfulFunctionParams(func.params).map((param) => {\n return this.generateTypeForDescriptor(param, module.address) + (this.PAYLOAD_OPTIONAL ? ' | undefined' : '')\n })\n\n const camelFuncName = upperFirst(camelCase(func.name))\n\n const genericString = this.generateFunctionTypeParameters(func)\n return `\n export interface ${camelFuncName}Payload${genericString}\n extends TypedFunctionPayload<[${fields.join(',')}]> {\n arguments_decoded: [${fields.join(',')}],\n type_arguments: [${func.typeParams.map((_) => 'string').join(', ')}]\n }\n `\n }\n\n generateClientFunctions(module: InternalMoveModule, func: InternalMoveFunction) {\n if (func.visibility === InternalMoveFunctionVisibility.PRIVATE) {\n return ''\n }\n if (func.isEntry) {\n return ''\n }\n // const moduleName = normalizeToJSName(module.name)\n const funcName = camelCase(func.name)\n const fields = this.getMeaningfulFunctionParams(func.params).map((param) => {\n return this.generateTypeForDescriptor(param, module.address)\n })\n const genericString = this.generateFunctionTypeParameters(func)\n\n const returns = func.return.map((param) => {\n return this.generateTypeForDescriptor(param, module.address)\n })\n\n const source = `\n ${funcName}${genericString}(type_arguments: [${func.typeParams\n .map((_) => 'string')\n .join(', ')}], args: [${fields.join(',')}], version?: bigint): Promise<[${returns.join(',')}]> {\n return this.viewDecoded('${module.address}::${module.name}::${func.name}', type_arguments, args, version) as any\n }`\n return source\n }\n\n generateOnEntryFunctions(module: InternalMoveModule, func: InternalMoveFunction) {\n if (!func.isEntry) {\n return ''\n }\n\n // const genericString = generateFunctionTypeParameters(func)\n const moduleName = normalizeToJSName(module.name)\n\n const camelFuncName = upperFirst(camelCase(func.name))\n const source = `\n onEntry${camelFuncName}(func: (call: ${moduleName}.${camelFuncName}Payload, ctx: ${this.PREFIX}Context) => void, filter?: CallFilter, fetchConfig?: Partial<MoveFetchConfig>): ${moduleName} {\n this.onEntryFunctionCall(func, {\n ...filter,\n function: '${module.name}::${func.name}'\n },\n fetchConfig)\n return this\n }`\n\n return source\n }\n\n generateOnEvents(module: InternalMoveModule, struct: InternalMoveStruct): string {\n // for struct that has drop + store\n // if (!isEvent(struct, module)) {\n // return ''\n // }\n\n // const genericString = generateStructTypeParameters(struct)\n\n const moduleName = normalizeToJSName(module.name)\n const source = `\n onEvent${struct.name}(func: (event: ${moduleName}.${normalizeToJSName(struct.name)}Instance, ctx: ${\n this.PREFIX\n }Context) => void, fetchConfig?: Partial<MoveFetchConfig>): ${moduleName} {\n this.onMoveEvent(func, {\n type: '${module.name}::${struct.name}'\n },\n fetchConfig)\n return this\n }\n `\n return source\n }\n\n generateTypeForDescriptor(type: TypeDescriptor, currentAddress: string): string {\n if (type.reference) {\n return this.ADDRESS_TYPE\n }\n\n switch (type.qname) {\n case 'signer': // TODO check this\n case 'address':\n case 'Address':\n return this.ADDRESS_TYPE\n case '0x1::string::String':\n return 'string'\n case 'bool':\n case 'Bool':\n return 'Boolean'\n case 'u8':\n case 'U8':\n case 'u16':\n case 'U16':\n case 'u32':\n case 'U32':\n return 'number'\n case 'u64':\n case 'U64':\n case 'u128':\n case 'U128':\n case 'u256':\n case 'U256':\n return 'bigint'\n }\n\n if (type.qname.toLowerCase() === VECTOR_STR) {\n // vector<u8> as hex string\n const elementTypeQname = type.typeArgs[0].qname\n if (elementTypeQname === 'u8') {\n // only for aptos\n return 'string'\n }\n if (elementTypeQname.startsWith('T') && !elementTypeQname.includes(SPLITTER)) {\n return `${elementTypeQname}[] | string`\n }\n return this.generateTypeForDescriptor(type.typeArgs[0], currentAddress) + '[]'\n }\n\n const simpleName = this.generateSimpleType(type.qname, currentAddress)\n if (simpleName.length === 0) {\n console.error('unexpected error')\n }\n if (simpleName.toLowerCase() === VECTOR_STR || simpleName.toLowerCase().startsWith(VECTOR_STR + SPLITTER)) {\n console.error('unexpected vector type error')\n }\n if (type.typeArgs.length > 0) {\n // return simpleName\n return (\n simpleName + '<' + type.typeArgs.map((t) => this.generateTypeForDescriptor(t, currentAddress)).join(',') + '>'\n )\n }\n return simpleName\n }\n\n generateSimpleType(type: string, currentAddress: string): string {\n const parts = type.split(SPLITTER)\n\n for (let i = 0; i < parts.length; i++) {\n parts[i] = normalizeToJSName(parts[i])\n }\n\n if (parts.length < 2) {\n return parts[0]\n }\n if (parts[0] === currentAddress) {\n return parts.slice(1).join('.')\n }\n return '_' + parts.join('.')\n }\n}\n\nexport class AccountCodegen<ModuleType, NetworkType> {\n modules: InternalMoveModule[]\n config: Config<NetworkType>\n abi: ModuleType\n loader: AccountRegister\n moduleGen: AbstractCodegen<ModuleType, NetworkType>\n\n constructor(\n moduleGen: AbstractCodegen<ModuleType, NetworkType>,\n loader: AccountRegister,\n abi: ModuleType,\n modules: InternalMoveModule[],\n config: Config<NetworkType>\n ) {\n // const json = fs.readFileSync(config.srcFile, 'utf-8')\n this.moduleGen = moduleGen\n this.abi = abi\n this.modules = modules\n this.config = config\n this.loader = loader\n }\n\n generate(): OutputFile[] {\n if (!this.modules) {\n return []\n }\n // const baseName = path.basename(this.config.fileName, '.json')\n\n let address: string | undefined\n for (const module of this.modules) {\n address = module.address\n }\n if (!address) {\n return []\n }\n\n const imports = `\n import { CallFilter } from \"@sentio/sdk/move\"\n import {\n MoveCoder, defaultMoveCoder, ${this.moduleGen.PREFIX}BindOptions, ${this.moduleGen.PREFIX}BaseProcessor,\n TypedEventInstance, ${this.moduleGen.PREFIX}Network, TypedFunctionPayload,\n ${this.moduleGen.PREFIX}Context } from \"@sentio/sdk/${this.moduleGen.PREFIX.toLowerCase()}\"\n import { MoveFetchConfig } from \"@sentio/protos\"\n import { ${this.moduleGen.ADDRESS_TYPE}, ModuleClient } from \"@sentio/sdk/${this.moduleGen.PREFIX.toLowerCase()}\"\n `\n\n const dependedAccounts: string[] = []\n\n const moduleImports: string[] = []\n\n const info = this.loader.accountImports.get(address)\n\n if (info) {\n for (const [account] of info.imports.entries()) {\n // Remap to user's filename if possible, TODO codepath not well tested\n const tsAccountModule = './' + (this.loader.accountImports.get(account)?.moduleName || account)\n if (isFrameworkAccount(account) && !isFrameworkAccount(address)) {\n // Decide where to find runtime library\n moduleImports.push(`import { _${account} } from \"@sentio/sdk/${this.moduleGen.PREFIX.toLowerCase()}/builtin\"`)\n } else {\n moduleImports.push(`import * as _${account} from \"${tsAccountModule}.js\"`)\n }\n\n dependedAccounts.push(account)\n }\n }\n\n const source = `\n /* Autogenerated file. Do not edit manually. */\n /* tslint:disable */\n /* eslint-disable */\n\n /* Generated modules for account ${address} */\n\n ${imports}\n\n ${moduleImports.join('\\n')}\n\n ${this.modules.map((m) => this.moduleGen.generateModule(m, this.config.network)).join('\\n')}\n\n const MODULES = JSON.parse('${JSON.stringify(this.abi)}')\n\n export function loadAllTypes(coder: MoveCoder) {\n ${dependedAccounts.map((a) => `_${a}.loadAllTypes(coder)`).join('\\n')}\n for (const m of Object.values(MODULES)) {\n coder.load(m as any)\n }\n }\n\n loadAllTypes(defaultMoveCoder())\n ` // source\n\n return [\n {\n fileName: this.config.fileName + '.ts',\n fileContent: source,\n },\n ]\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"abstract-codegen.js","sourceRoot":"","sources":["../../src/move/abstract-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,8BAA8B,GAG/B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACxE,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACrG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAejD,MAAM,OAAgB,eAAe;IACnC,QAAQ,CAAa;IACrB,QAAQ,CAAa;IACrB,YAAY,CAAQ;IACpB,MAAM,CAAQ;IACd,iBAAiB,GAAW,MAAM,CAAA;IAClC,eAAe,GAAG,KAAK,CAAA;IACvB,iBAAiB,GAAG,IAAI,CAAA;IACxB,gBAAgB,GAAG,KAAK,CAAA;IACxB,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA;IAE/C,YAAY,CAAwC;IAEpD,YAAsB,YAAoD;QACxE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,eAAe,CAAC,QAAgB;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAA;IACvD,CAAC;I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,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;;MAExB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;kCAE7D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC;;;QAGlD,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;MAMrE,YAAY;KACb,CAAA,CAAC,SAAS;QAEX,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK;gBACtC,WAAW,EAAE,MAAM;aACpB;SACF,CAAA;IACH,CAAC;CACF","sourcesContent":["import {\n InternalMoveFunction,\n InternalMoveFunctionVisibility,\n InternalMoveModule,\n InternalMoveStruct,\n} from './internal-models.js'\nimport path from 'path'\nimport fs from 'fs'\nimport { AccountModulesImportInfo, AccountRegister } from './account.js'\nimport chalk from 'chalk'\nimport { format } from 'prettier'\nimport { isFrameworkAccount, moduleQname, normalizeToJSName, SPLITTER, VECTOR_STR } from './utils.js'\nimport { camelCase, upperFirst } from 'lodash-es'\nimport { TypeDescriptor } from './types.js'\nimport { ChainAdapter } from './chain-adapter.js'\n\ninterface OutputFile {\n fileName: string\n fileContent: string\n}\n\ninterface Config<NetworkType> {\n fileName: string\n outputDir: string\n network: NetworkType\n}\n\nexport abstract class AbstractCodegen<ModuleTypes, NetworkType> {\n TEST_NET: NetworkType\n MAIN_NET: NetworkType\n ADDRESS_TYPE: string\n PREFIX: string\n STRUCT_FIELD_NAME: string = 'data'\n GENERATE_CLIENT = false\n GENERATE_ON_ENTRY = true\n PAYLOAD_OPTIONAL = false\n SYSTEM_MODULES = new Set(['0x1', '0x2', '0x3'])\n\n chainAdapter: ChainAdapter<NetworkType, ModuleTypes>\n\n protected constructor(chainAdapter: ChainAdapter<NetworkType, ModuleTypes>) {\n this.chainAdapter = chainAdapter\n }\n\n readModulesFile(fullPath: string) {\n return JSON.parse(fs.readFileSync(fullPath, 'utf-8'))\n }\n\n async generate(srcDir: string, outputDir: string): Promise<number> {\n const num1 = await this.generateForNetwork(srcDir, outputDir, this.MAIN_NET)\n const num2 = await this.generateForNetwork(\n path.join(srcDir, 'testnet'),\n path.join(outputDir, 'testnet'),\n this.TEST_NET\n )\n return num1 + num2\n }\n\n async generateForNetwork(srcDir: string, outputDir: string, network: NetworkType) {\n if (!fs.existsSync(srcDir)) {\n return 0\n }\n\n const files = fs.readdirSync(srcDir)\n outputDir = path.resolve(outputDir)\n const outputs: OutputFile[] = []\n\n fs.mkdirSync(outputDir, { recursive: true })\n\n const loader = new AccountRegister()\n\n // when generating user code, don't need to generate framework account\n for (const sysModule of this.SYSTEM_MODULES) {\n loader.accountImports.set(sysModule, new AccountModulesImportInfo(sysModule, sysModule))\n }\n // const client = getRpcClient(network)\n\n for (const file of files) {\n if (!file.endsWith('.json')) {\n continue\n }\n const fullPath = path.resolve(srcDir, file)\n const abi = this.readModulesFile(fullPath)\n const modules = this.chainAdapter.toInternalModules(abi)\n\n for (const module of modules) {\n loader.register(module, path.basename(file, '.json'))\n }\n const codeGen = new AccountCodegen(this, loader, abi, modules, {\n fileName: path.basename(file, '.json'),\n outputDir: outputDir,\n network,\n })\n\n outputs.push(...codeGen.generate())\n }\n\n while (loader.pendingAccounts.size > 0) {\n for (const account of loader.pendingAccounts) {\n console.log(`download dependent module for account ${account} at ${network}`)\n\n try {\n const rawModules = await this.chainAdapter.fetchModules(account, network)\n const modules = this.chainAdapter.toInternalModules(rawModules)\n\n fs.writeFileSync(path.resolve(srcDir, account + '.json'), JSON.stringify(rawModules, null, '\\t'))\n for (const module of modules) {\n loader.register(module, account)\n }\n const codeGen = new AccountCodegen(this, loader, rawModules, modules, {\n fileName: account,\n outputDir: outputDir,\n network,\n })\n\n outputs.push(...codeGen.generate())\n } catch (e) {\n console.error(\n chalk.red(\n 'Error downloading account module, check if you choose the right network,or download account modules manually into your director'\n )\n )\n console.error(e)\n process.exit(1)\n }\n }\n }\n\n for (const output of outputs) {\n // const content = output.fileContent\n const content = format(output.fileContent, { parser: 'typescript' })\n fs.writeFileSync(path.join(outputDir, output.fileName), content)\n }\n\n const rootFile = path.join(outputDir, 'index.ts')\n fs.writeFileSync(\n rootFile,\n `/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n`\n )\n for (const output of outputs) {\n const parsed = path.parse(output.fileName)\n const content = `export * as _${parsed.name.replaceAll('-', '_')} from './${parsed.name}.js'\\n`\n fs.appendFileSync(rootFile, content)\n }\n return outputs.length + 1\n }\n\n generateNetworkOption(network: NetworkType) {\n switch (network) {\n case this.TEST_NET:\n return 'TEST_NET'\n }\n return 'MAIN_NET'\n }\n\n generateModule(module: InternalMoveModule, network: NetworkType) {\n const functions = this.GENERATE_ON_ENTRY\n ? module.exposedFunctions.map((f) => this.generateOnEntryFunctions(module, f)).filter((s) => s !== '')\n : []\n const clientFunctions = this.GENERATE_CLIENT\n ? module.exposedFunctions.map((f) => this.generateClientFunctions(module, f)).filter((s) => s !== '')\n : []\n const eventStructs = this.chainAdapter.getEventStructs(module)\n const eventTypes = new Set(eventStructs.keys())\n const events = Array.from(eventStructs.values())\n .map((e) => this.generateOnEvents(module, e))\n .filter((s) => s !== '')\n const structs = module.structs.map((s) => this.generateStructs(module, s, eventTypes))\n const callArgs = module.exposedFunctions.map((f) => this.generateCallArgsStructs(module, f))\n\n const moduleName = normalizeToJSName(module.name)\n let processor = ''\n let client = ''\n\n if (clientFunctions.length > 0) {\n client = `\n export class ${moduleName}_client extends ModuleClient {\n ${clientFunctions.join('\\n')}\n }\n `\n }\n\n if (functions.length > 0 || events.length > 0) {\n processor = `export class ${moduleName} extends ${this.PREFIX}BaseProcessor {\n\n constructor(options: ${this.PREFIX}BindOptions) {\n super(\"${module.name}\", options)\n }\n static DEFAULT_OPTIONS: ${this.PREFIX}BindOptions = {\n address: \"${module.address}\",\n network: ${this.PREFIX}Network.${this.generateNetworkOption(network)}\n }\n\n static bind(options: Partial<${this.PREFIX}BindOptions> = {}): ${moduleName} {\n return new ${moduleName}({ ...${moduleName}.DEFAULT_OPTIONS, ...options })\n }\n\n ${functions.join('\\n')}\n\n ${events.join('\\n')}\n }\n `\n }\n\n return `\n ${client}\n\n ${processor}\n\n export namespace ${moduleName} {\n ${structs.join('\\n')}\n\n ${callArgs.join('\\n')}\n }\n `\n }\n\n generateStructs(module: InternalMoveModule, struct: InternalMoveStruct, events: Set<string>) {\n const genericString = this.generateStructTypeParameters(struct)\n const genericStringAny = this.generateStructTypeParameters(struct, true)\n\n const structName = normalizeToJSName(struct.name)\n\n const fields = struct.fields.map((field) => {\n const type = this.generateTypeForDescriptor(field.type, module.address)\n return `${field.name}: ${type}`\n })\n\n let eventPayload = ''\n if (events.has(moduleQname(module) + SPLITTER + struct.name)) {\n eventPayload = `\n export interface ${structName}Instance extends\n TypedEventInstance<${structName}${genericStringAny}> {\n ${this.STRUCT_FIELD_NAME}_decoded: ${structName}${genericStringAny}\n type_arguments: [${struct.typeParams.map((_) => 'string').join(', ')}]\n }\n `\n }\n\n return `\n export class ${structName}${genericString} {\n static TYPE_QNAME = '${module.address}::${module.name}::${struct.name}'\n ${fields.join('\\n')}\n }\n\n ${eventPayload}\n `\n }\n\n generateFunctionTypeParameters(func: InternalMoveFunction) {\n let genericString = ''\n if (func.typeParams && func.typeParams.length > 0) {\n const params = func.typeParams\n .map((v, idx) => {\n return `T${idx}=any`\n })\n .join(',')\n genericString = `<${params}>`\n }\n return genericString\n }\n\n generateStructTypeParameters(struct: InternalMoveStruct, useAny = false) {\n let genericString = ''\n\n if (struct.typeParams && struct.typeParams.length > 0) {\n const params = struct.typeParams\n .map((v, idx) => {\n return useAny ? 'any' : 'T' + idx\n })\n .join(',')\n genericString = `<${params}>`\n }\n return genericString\n }\n\n generateCallArgsStructs(module: InternalMoveModule, func: InternalMoveFunction) {\n if (!func.isEntry) {\n return\n }\n\n const fields = this.chainAdapter.getMeaningfulFunctionParams(func.params).map((param) => {\n return this.generateTypeForDescriptor(param, module.address) + (this.PAYLOAD_OPTIONAL ? ' | undefined' : '')\n })\n\n const camelFuncName = upperFirst(camelCase(func.name))\n\n const genericString = this.generateFunctionTypeParameters(func)\n return `\n export interface ${camelFuncName}Payload${genericString}\n extends TypedFunctionPayload<[${fields.join(',')}]> {\n arguments_decoded: [${fields.join(',')}],\n type_arguments: [${func.typeParams.map((_) => 'string').join(', ')}]\n }\n `\n }\n\n generateClientFunctions(module: InternalMoveModule, func: InternalMoveFunction) {\n if (func.visibility === InternalMoveFunctionVisibility.PRIVATE) {\n return ''\n }\n if (func.isEntry) {\n return ''\n }\n // const moduleName = normalizeToJSName(module.name)\n const funcName = camelCase(func.name)\n const fields = this.chainAdapter.getMeaningfulFunctionParams(func.params).map((param) => {\n return this.generateTypeForDescriptor(param, module.address)\n })\n const genericString = this.generateFunctionTypeParameters(func)\n\n const returns = func.return.map((param) => {\n return this.generateTypeForDescriptor(param, module.address)\n })\n\n const source = `\n ${funcName}${genericString}(type_arguments: [${func.typeParams\n .map((_) => 'string')\n .join(', ')}], args: [${fields.join(',')}], version?: bigint): Promise<[${returns.join(',')}]> {\n return this.viewDecoded('${module.address}::${module.name}::${func.name}', type_arguments, args, version) as any\n }`\n return source\n }\n\n generateOnEntryFunctions(module: InternalMoveModule, func: InternalMoveFunction) {\n if (!func.isEntry) {\n return ''\n }\n\n // const genericString = generateFunctionTypeParameters(func)\n const moduleName = normalizeToJSName(module.name)\n\n const camelFuncName = upperFirst(camelCase(func.name))\n const source = `\n onEntry${camelFuncName}(func: (call: ${moduleName}.${camelFuncName}Payload, ctx: ${this.PREFIX}Context) => void, filter?: CallFilter, fetchConfig?: Partial<MoveFetchConfig>): ${moduleName} {\n this.onEntryFunctionCall(func, {\n ...filter,\n function: '${module.name}::${func.name}'\n },\n fetchConfig)\n return this\n }`\n\n return source\n }\n\n generateOnEvents(module: InternalMoveModule, struct: InternalMoveStruct): string {\n // for struct that has drop + store\n // if (!isEvent(struct, module)) {\n // return ''\n // }\n\n // const genericString = generateStructTypeParameters(struct)\n\n const moduleName = normalizeToJSName(module.name)\n const source = `\n onEvent${struct.name}(func: (event: ${moduleName}.${normalizeToJSName(struct.name)}Instance, ctx: ${\n this.PREFIX\n }Context) => void, fetchConfig?: Partial<MoveFetchConfig>): ${moduleName} {\n this.onMoveEvent(func, {\n type: '${module.name}::${struct.name}'\n },\n fetchConfig)\n return this\n }\n `\n return source\n }\n\n generateTypeForDescriptor(type: TypeDescriptor, currentAddress: string): string {\n if (type.reference) {\n return this.ADDRESS_TYPE\n }\n\n switch (type.qname) {\n case 'signer': // TODO check this\n case 'address':\n case 'Address':\n return this.ADDRESS_TYPE\n case '0x1::string::String':\n return 'string'\n case 'bool':\n case 'Bool':\n return 'Boolean'\n case 'u8':\n case 'U8':\n case 'u16':\n case 'U16':\n case 'u32':\n case 'U32':\n return 'number'\n case 'u64':\n case 'U64':\n case 'u128':\n case 'U128':\n case 'u256':\n case 'U256':\n return 'bigint'\n }\n\n if (type.qname.toLowerCase() === VECTOR_STR) {\n // vector<u8> as hex string\n const elementTypeQname = type.typeArgs[0].qname\n if (elementTypeQname === 'u8') {\n // only for aptos\n return 'string'\n }\n if (elementTypeQname.startsWith('T') && !elementTypeQname.includes(SPLITTER)) {\n return `${elementTypeQname}[] | string`\n }\n return this.generateTypeForDescriptor(type.typeArgs[0], currentAddress) + '[]'\n }\n\n const simpleName = this.generateSimpleType(type.qname, currentAddress)\n if (simpleName.length === 0) {\n console.error('unexpected error')\n }\n if (simpleName.toLowerCase() === VECTOR_STR || simpleName.toLowerCase().startsWith(VECTOR_STR + SPLITTER)) {\n console.error('unexpected vector type error')\n }\n if (type.typeArgs.length > 0) {\n // return simpleName\n return (\n simpleName + '<' + type.typeArgs.map((t) => this.generateTypeForDescriptor(t, currentAddress)).join(',') + '>'\n )\n }\n return simpleName\n }\n\n generateSimpleType(type: string, currentAddress: string): string {\n const parts = type.split(SPLITTER)\n\n for (let i = 0; i < parts.length; i++) {\n parts[i] = normalizeToJSName(parts[i])\n }\n\n if (parts.length < 2) {\n return parts[0]\n }\n if (parts[0] === currentAddress) {\n return parts.slice(1).join('.')\n }\n return '_' + parts.join('.')\n }\n}\n\nexport class AccountCodegen<ModuleType, NetworkType> {\n modules: InternalMoveModule[]\n config: Config<NetworkType>\n abi: ModuleType\n loader: AccountRegister\n moduleGen: AbstractCodegen<ModuleType, NetworkType>\n\n constructor(\n moduleGen: AbstractCodegen<ModuleType, NetworkType>,\n loader: AccountRegister,\n abi: ModuleType,\n modules: InternalMoveModule[],\n config: Config<NetworkType>\n ) {\n // const json = fs.readFileSync(config.srcFile, 'utf-8')\n this.moduleGen = moduleGen\n this.abi = abi\n this.modules = modules\n this.config = config\n this.loader = loader\n }\n\n generate(): OutputFile[] {\n if (!this.modules) {\n return []\n }\n // const baseName = path.basename(this.config.fileName, '.json')\n\n let address: string | undefined\n for (const module of this.modules) {\n address = module.address\n }\n if (!address) {\n return []\n }\n\n const imports = `\n import { CallFilter } from \"@sentio/sdk/move\"\n import {\n MoveCoder, defaultMoveCoder, ${this.moduleGen.PREFIX}BindOptions, ${this.moduleGen.PREFIX}BaseProcessor,\n TypedEventInstance, ${this.moduleGen.PREFIX}Network, TypedFunctionPayload,\n ${this.moduleGen.PREFIX}Context } from \"@sentio/sdk/${this.moduleGen.PREFIX.toLowerCase()}\"\n import { MoveFetchConfig } from \"@sentio/protos\"\n import { ${this.moduleGen.ADDRESS_TYPE}, ModuleClient } from \"@sentio/sdk/${this.moduleGen.PREFIX.toLowerCase()}\"\n `\n\n const dependedAccounts: string[] = []\n\n const moduleImports: string[] = []\n\n const info = this.loader.accountImports.get(address)\n\n if (info) {\n for (const [account] of info.imports.entries()) {\n // Remap to user's filename if possible, TODO codepath not well tested\n const tsAccountModule = './' + (this.loader.accountImports.get(account)?.moduleName || account)\n if (isFrameworkAccount(account) && !isFrameworkAccount(address)) {\n // Decide where to find runtime library\n moduleImports.push(`import { _${account} } from \"@sentio/sdk/${this.moduleGen.PREFIX.toLowerCase()}/builtin\"`)\n } else {\n moduleImports.push(`import * as _${account} from \"${tsAccountModule}.js\"`)\n }\n\n dependedAccounts.push(account)\n }\n }\n\n let loadAllTypes = `loadAllTypes(defaultMoveCoder(${\n this.moduleGen.PREFIX\n }Network.${this.moduleGen.generateNetworkOption(this.config.network)}))`\n\n if (this.moduleGen.SYSTEM_MODULES.has(address)) {\n loadAllTypes = `\n loadAllTypes(defaultMoveCoder(${this.moduleGen.PREFIX}Network.MAIN_NET))\n loadAllTypes(defaultMoveCoder(${this.moduleGen.PREFIX}Network.TEST_NET))\n `\n }\n\n const source = `\n /* Autogenerated file. Do not edit manually. */\n /* tslint:disable */\n /* eslint-disable */\n\n /* Generated modules for account ${address} */\n\n ${imports}\n\n ${moduleImports.join('\\n')}\n\n ${this.modules.map((m) => this.moduleGen.generateModule(m, this.config.network)).join('\\n')}\n\n const MODULES = JSON.parse('${JSON.stringify(this.abi)}')\n\n export function loadAllTypes(coder: MoveCoder) {\n ${dependedAccounts.map((a) => `_${a}.loadAllTypes(coder)`).join('\\n')}\n for (const m of Object.values(MODULES)) {\n coder.load(m as any)\n }\n }\n\n ${loadAllTypes}\n ` // source\n\n return [\n {\n fileName: this.config.fileName + '.ts',\n fileContent: source,\n },\n ]\n }\n}\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { TypeDescriptor } from './types.js';
|
2
2
|
import { InternalMoveFunction, InternalMoveModule, InternalMoveStruct } from './internal-models.js';
|
3
|
+
import { ChainAdapter } from './chain-adapter.js';
|
3
4
|
export type StructWithTag<Base> = {
|
4
5
|
type: string;
|
5
6
|
data: Base;
|
@@ -8,12 +9,14 @@ export type DecodedStructWithTag<B, T> = StructWithTag<B> & {
|
|
8
9
|
data_decoded: T;
|
9
10
|
type_arguments: string[];
|
10
11
|
};
|
11
|
-
export declare abstract class AbstractMoveCoder<StructType> {
|
12
|
+
export declare abstract class AbstractMoveCoder<Network, ModuleTypes, StructType> {
|
12
13
|
private moduleMapping;
|
13
14
|
private typeMapping;
|
14
15
|
private funcMapping;
|
16
|
+
network: Network;
|
17
|
+
adapter: ChainAdapter<Network, ModuleTypes>;
|
18
|
+
protected constructor(network: Network);
|
15
19
|
contains(account: string, name: string): boolean;
|
16
|
-
protected abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[];
|
17
20
|
protected toStructWithTag(val: StructType): StructWithTag<StructType>;
|
18
21
|
protected loadInternal(module: InternalMoveModule): void;
|
19
22
|
protected decodeBigInt(data: any): bigint;
|
@@ -5,9 +5,15 @@ export class AbstractMoveCoder {
|
|
5
5
|
moduleMapping = new Map();
|
6
6
|
typeMapping = new Map();
|
7
7
|
funcMapping = new Map();
|
8
|
+
network;
|
9
|
+
adapter;
|
10
|
+
constructor(network) {
|
11
|
+
this.network = network;
|
12
|
+
}
|
8
13
|
contains(account, name) {
|
9
14
|
return this.moduleMapping.has(account + '::' + name);
|
10
15
|
}
|
16
|
+
// protected abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[]
|
11
17
|
toStructWithTag(val) {
|
12
18
|
return val;
|
13
19
|
}
|
@@ -195,7 +201,7 @@ export class AbstractMoveCoder {
|
|
195
201
|
}
|
196
202
|
encodeCallArgs(args, func) {
|
197
203
|
const f = this.getMoveFunction(func);
|
198
|
-
return this.encodeArray(args, this.getMeaningfulFunctionParams(f.params));
|
204
|
+
return this.encodeArray(args, this.adapter.getMeaningfulFunctionParams(f.params));
|
199
205
|
}
|
200
206
|
decodeCallResult(res, func) {
|
201
207
|
const f = this.getMoveFunction(func);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"abstract-move-coder.js","sourceRoot":"","sources":["../../src/move/abstract-move-coder.ts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,CAAA;IAC3E,CAAC;IAEO,oBAAoB,CAC1B,UAAqC;QAErC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACrD,MAAM,aAAa,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAA;QAE1E,IAAI,SAAS,GAAG,SAAS,CAAA;QACzB,IAAI;YACF,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAA;SAC/E;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA;YACnE,OAAO,SAAS,CAAA;SACjB;QACD,OAAO;YACL,GAAG,UAAU;YACb,YAAY,EAAE,SAAS;YACvB,cAAc,EAAE,aAAa;SACS,CAAA;IAC1C,CAAC;CACF","sourcesContent":["import { moduleQname, SPLITTER, VECTOR_STR } from './utils.js'\nimport { parseMoveType, TypeDescriptor } from './types.js'\nimport { InternalMoveFunction, InternalMoveModule, InternalMoveStruct } from './internal-models.js'\nimport { bytesToBigInt } from '../utils/index.js'\n\nexport type StructWithTag<Base> = {\n type: string\n data: Base\n}\n\nexport type DecodedStructWithTag<B, T> = StructWithTag<B> & {\n data_decoded: T\n type_arguments: string[]\n}\n\nexport abstract class AbstractMoveCoder<StructType> {\n private moduleMapping = new Map<string, InternalMoveModule>()\n private typeMapping = new Map<string, InternalMoveStruct>()\n private funcMapping = new Map<string, InternalMoveFunction>()\n\n contains(account: string, name: string) {\n return this.moduleMapping.has(account + '::' + name)\n }\n\n protected abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[]\n\n protected toStructWithTag(val: StructType): StructWithTag<StructType> {\n return val as any\n }\n\n protected loadInternal(module: InternalMoveModule) {\n if (this.contains(module.address, module.name)) {\n return\n }\n this.moduleMapping.set(moduleQname(module), module)\n\n for (const struct of module.structs) {\n // TODO move to util\n const key = [module.address, module.name, struct.name].join(SPLITTER)\n this.typeMapping.set(key, struct)\n }\n\n for (const func of module.exposedFunctions) {\n // if (!func.isEntry) {\n // continue\n // }\n const key = [module.address, module.name, func.name].join(SPLITTER)\n this.funcMapping.set(key, func)\n }\n }\n\n protected decodeBigInt(data: any): bigint {\n if (Array.isArray(data)) {\n // Only sui function need this, strange\n const bytes = data as number[]\n return bytesToBigInt(new Uint8Array(bytes.slice().reverse()))\n } else {\n return BigInt(data)\n }\n }\n\n protected encodeBigInt(data: bigint): any {\n return '0x' + data.toString(16)\n }\n\n getMoveStruct(type: string): InternalMoveStruct {\n const struct = this.typeMapping.get(type)\n if (!struct) {\n throw new Error('Failed to load type' + type + ' type are not imported anywhere')\n }\n return struct\n }\n\n getMoveFunction(type: string): InternalMoveFunction {\n const func = this.funcMapping.get(type)\n if (!func) {\n throw new Error('Failed to load function ' + type + ' type are not imported anywhere')\n }\n return func\n }\n\n decode(data: any, type: TypeDescriptor): any {\n // process simple type\n if (type.reference) {\n return data\n }\n switch (type.qname) {\n case 'signer': // TODO check this, aptos only\n case 'address':\n case 'Address':\n case '0x1::string::String':\n case 'bool':\n case 'Bool':\n case 'u8':\n case 'U8':\n case 'u16':\n case 'U16':\n case 'u32':\n case 'U32':\n return data\n case 'u64':\n case 'U64':\n case 'u128':\n case 'U128':\n return this.decodeBigInt(data)\n }\n\n // process vector\n if (type.qname === VECTOR_STR) {\n // vector<u8> as hex string\n if (type.typeArgs[0].qname === 'u8' || type.typeArgs[0].qname === 'U8') {\n return data\n }\n\n const res = []\n for (const entry of data) {\n res.push(this.decode(entry, type.typeArgs[0]))\n }\n return res\n }\n\n // Process complex type\n const struct = this.getMoveStruct(type.qname)\n\n const typeCtx = new Map<string, TypeDescriptor>()\n for (const [idx, typeArg] of type.typeArgs.entries()) {\n typeCtx.set('T' + idx, typeArg)\n }\n\n const typedData: any = {}\n\n for (const field of struct.fields) {\n let filedType = field.type\n filedType = filedType.applyTypeArgs(typeCtx)\n const value = this.decode(data[field.name], filedType)\n typedData[field.name] = value\n }\n return typedData\n }\n\n encode(data: any, type: TypeDescriptor): any {\n // process simple type\n if (type.reference) {\n return data\n }\n switch (type.qname) {\n case 'signer': // TODO check this, aptos only\n case 'address':\n case 'Address':\n case '0x2::object::ID':\n case '0x2::coin::Coin':\n case '0x1::string::String':\n case 'bool':\n case 'Bool':\n case 'u8':\n case 'U8':\n case 'u16':\n case 'U16':\n case 'u32':\n case 'U32':\n return data\n case 'u64':\n case 'U64':\n case 'u128':\n case 'U128':\n case 'u256':\n case 'U256':\n return this.encodeBigInt(data)\n }\n\n // process vector\n if (type.qname === VECTOR_STR) {\n // vector<u8> as hex string\n if (type.typeArgs[0].qname === 'u8' || type.typeArgs[0].qname === 'U8') {\n return data\n }\n\n const res = []\n for (const entry of data) {\n res.push(this.encode(entry, type.typeArgs[0]))\n }\n return res\n }\n\n // Process complex type\n const struct = this.getMoveStruct(type.qname)\n\n const typeCtx = new Map<string, TypeDescriptor>()\n for (const [idx, typeArg] of type.typeArgs.entries()) {\n typeCtx.set('T' + idx, typeArg)\n }\n\n const typedData: any = {}\n\n for (const field of struct.fields) {\n let filedType = field.type\n filedType = filedType.applyTypeArgs(typeCtx)\n const value = this.encode(data[field.name], filedType)\n typedData[field.name] = value\n }\n return typedData\n }\n\n decodeArray(entries: any[], types: TypeDescriptor[]): any[] {\n const entriesDecoded: any[] = []\n for (const [idx, arg] of entries.entries()) {\n // TODO consider apply payload.type_arguments, but this might be hard since we don't code gen for them\n const argType = types[idx]\n try {\n entriesDecoded.push(this.decode(arg, argType))\n } catch (e) {\n console.error(e, 'Decoding error for ', JSON.stringify(arg), 'using type', argType)\n return entries\n }\n }\n return entriesDecoded\n }\n\n encodeArray(entriesDecoded: any[], types: TypeDescriptor[]): any[] {\n const entries: any[] = []\n for (const [idx, arg] of entriesDecoded.entries()) {\n // TODO consider apply payload.type_arguments, but this might be hard since we don't code gen for them\n const argType = types[idx]\n try {\n entries.push(this.encode(arg, argType))\n } catch (e) {\n throw Error('Decoding error for ' + JSON.stringify(arg) + 'using type' + argType + e.toString())\n }\n }\n return entries\n }\n\n encodeCallArgs(args: any[], func: string): any[] {\n const f = this.getMoveFunction(func)\n return this.encodeArray(args, this.getMeaningfulFunctionParams(f.params))\n }\n\n decodeCallResult(res: any[], func: string): any[] {\n const f = this.getMoveFunction(func)\n return this.decodeArray(res, f.return)\n }\n\n protected filterAndDecodeStruct(typeQname: string, structs: StructType[]): any {\n if (!structs) {\n return []\n }\n const withTags = structs.map((s) => this.toStructWithTag(s))\n return this.filterAndDecodeStructWithTags(typeQname, withTags)\n }\n\n private filterAndDecodeStructWithTags<T>(\n typeQname: string,\n structsWithTags: StructWithTag<StructType>[]\n ): DecodedStructWithTag<StructType, T>[] {\n if (!structsWithTags) {\n return []\n }\n const results: DecodedStructWithTag<StructType, T>[] = []\n for (const resource of structsWithTags) {\n if (typeQname.includes('<')) {\n if (resource.type !== typeQname) {\n continue\n }\n } else if (resource.type.split('<')[0] !== typeQname) {\n continue\n }\n const result = this.decodedStructWithTag(resource)\n if (result) {\n results.push(result as DecodedStructWithTag<StructType, T>)\n }\n }\n return results\n }\n\n protected decodedStruct<T>(typeStruct: StructType): DecodedStructWithTag<StructType, T> | undefined {\n return this.decodedStructWithTag(this.toStructWithTag(typeStruct)) as any\n }\n\n private decodedStructWithTag<T>(\n typeStruct: StructWithTag<StructType>\n ): DecodedStructWithTag<StructType, T> | undefined {\n const typeDescriptor = parseMoveType(typeStruct.type)\n const typeArguments = typeDescriptor.typeArgs.map((t) => t.getSignature())\n\n let dataTyped = undefined\n try {\n dataTyped = this.decode(this.toStructWithTag(typeStruct.data), typeDescriptor)\n } catch (e) {\n console.error('Decoding error for ', JSON.stringify(typeStruct), e)\n return undefined\n }\n return {\n ...typeStruct,\n data_decoded: dataTyped,\n type_arguments: typeArguments,\n } as DecodedStructWithTag<StructType, T>\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"abstract-move-coder.js","sourceRoot":"","sources":["../../src/move/abstract-move-coder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAkB,MAAM,YAAY,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAajD,MAAM,OAAgB,iBAAiB;IAC7B,aAAa,GAAG,IAAI,GAAG,EAA8B,CAAA;IACrD,WAAW,GAAG,IAAI,GAAG,EAA8B,CAAA;IACnD,WAAW,GAAG,IAAI,GAAG,EAAgC,CAAA;IAC7D,OAAO,CAAS;IAChB,OAAO,CAAoC;IAE3C,YAAsB,OAAgB;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ,CAAC,OAAe,EAAE,IAAY;QACpC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;IACtD,CAAC;IAED,6FAA6F;IAEnF,eAAe,CAAC,GAAe;QACvC,OAAO,GAAU,CAAA;IACnB,CAAC;IAES,YAAY,CAAC,MAA0B;QAC/C,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;YAC9C,OAAM;SACP;QACD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;QAEnD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;YACnC,oBAAoB;YACpB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CA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I,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAA;YAClD,IAAI,MAAM,EAAE;gBACV,OAAO,CAAC,IAAI,CAAC,MAA6C,CAAC,CAAA;aAC5D;SACF;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAES,aAAa,CAAI,UAAsB;QAC/C,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAQ,CAAA;IAC3E,CAAC;IAEO,oBAAoB,CAC1B,UAAqC;QAErC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACrD,MAAM,aAAa,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAA;QAE1E,IAAI,SAAS,GAAG,SAAS,CAAA;QACzB,IAAI;YACF,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAA;SAC/E;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA;YACnE,OAAO,SAAS,CAAA;SACjB;QACD,OAAO;YACL,GAAG,UAAU;YACb,YAAY,EAAE,SAAS;YACvB,cAAc,EAAE,aAAa;SACS,CAAA;IAC1C,CAAC;CACF","sourcesContent":["import { moduleQname, SPLITTER, VECTOR_STR } from './utils.js'\nimport { parseMoveType, TypeDescriptor } from './types.js'\nimport { InternalMoveFunction, InternalMoveModule, InternalMoveStruct } from './internal-models.js'\nimport { bytesToBigInt } from '../utils/index.js'\nimport { ChainAdapter } from './chain-adapter.js'\n\nexport type StructWithTag<Base> = {\n type: string\n data: Base\n}\n\nexport type DecodedStructWithTag<B, T> = StructWithTag<B> & {\n data_decoded: T\n type_arguments: string[]\n}\n\nexport abstract class AbstractMoveCoder<Network, ModuleTypes, StructType> {\n private moduleMapping = new Map<string, InternalMoveModule>()\n private typeMapping = new Map<string, InternalMoveStruct>()\n private funcMapping = new Map<string, InternalMoveFunction>()\n network: Network\n adapter: ChainAdapter<Network, ModuleTypes>\n\n protected constructor(network: Network) {\n this.network = network\n }\n\n contains(account: string, name: string) {\n return this.moduleMapping.has(account + '::' + name)\n }\n\n // protected abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[]\n\n protected toStructWithTag(val: StructType): StructWithTag<StructType> {\n return val as any\n }\n\n protected loadInternal(module: InternalMoveModule) {\n if (this.contains(module.address, module.name)) {\n return\n }\n this.moduleMapping.set(moduleQname(module), module)\n\n for (const struct of module.structs) {\n // TODO move to util\n const key = [module.address, module.name, struct.name].join(SPLITTER)\n this.typeMapping.set(key, struct)\n }\n\n for (const func of module.exposedFunctions) {\n // if (!func.isEntry) {\n // continue\n // }\n const key = [module.address, module.name, func.name].join(SPLITTER)\n this.funcMapping.set(key, func)\n }\n }\n\n protected decodeBigInt(data: any): bigint {\n if (Array.isArray(data)) {\n // Only sui function need this, strange\n const bytes = data as number[]\n return bytesToBigInt(new Uint8Array(bytes.slice().reverse()))\n } else {\n return BigInt(data)\n }\n }\n\n protected encodeBigInt(data: bigint): any {\n return '0x' + data.toString(16)\n }\n\n getMoveStruct(type: string): InternalMoveStruct {\n const struct = this.typeMapping.get(type)\n if (!struct) {\n throw new Error('Failed to load type' + type + ' type are not imported anywhere')\n }\n return struct\n }\n\n getMoveFunction(type: string): InternalMoveFunction {\n const func = this.funcMapping.get(type)\n if (!func) {\n throw new Error('Failed to load function ' + type + ' type are not imported anywhere')\n }\n return func\n }\n\n decode(data: any, type: TypeDescriptor): any {\n // process simple type\n if (type.reference) {\n return data\n }\n switch (type.qname) {\n case 'signer': // TODO check this, aptos only\n case 'address':\n case 'Address':\n case '0x1::string::String':\n case 'bool':\n case 'Bool':\n case 'u8':\n case 'U8':\n case 'u16':\n case 'U16':\n case 'u32':\n case 'U32':\n return data\n case 'u64':\n case 'U64':\n case 'u128':\n case 'U128':\n return this.decodeBigInt(data)\n }\n\n // process vector\n if (type.qname === VECTOR_STR) {\n // vector<u8> as hex string\n if (type.typeArgs[0].qname === 'u8' || type.typeArgs[0].qname === 'U8') {\n return data\n }\n\n const res = []\n for (const entry of data) {\n res.push(this.decode(entry, type.typeArgs[0]))\n }\n return res\n }\n\n // Process complex type\n const struct = this.getMoveStruct(type.qname)\n\n const typeCtx = new Map<string, TypeDescriptor>()\n for (const [idx, typeArg] of type.typeArgs.entries()) {\n typeCtx.set('T' + idx, typeArg)\n }\n\n const typedData: any = {}\n\n for (const field of struct.fields) {\n let filedType = field.type\n filedType = filedType.applyTypeArgs(typeCtx)\n const value = this.decode(data[field.name], filedType)\n typedData[field.name] = value\n }\n return typedData\n }\n\n encode(data: any, type: TypeDescriptor): any {\n // process simple type\n if (type.reference) {\n return data\n }\n switch (type.qname) {\n case 'signer': // TODO check this, aptos only\n case 'address':\n case 'Address':\n case '0x2::object::ID':\n case '0x2::coin::Coin':\n case '0x1::string::String':\n case 'bool':\n case 'Bool':\n case 'u8':\n case 'U8':\n case 'u16':\n case 'U16':\n case 'u32':\n case 'U32':\n return data\n case 'u64':\n case 'U64':\n case 'u128':\n case 'U128':\n case 'u256':\n case 'U256':\n return this.encodeBigInt(data)\n }\n\n // process vector\n if (type.qname === VECTOR_STR) {\n // vector<u8> as hex string\n if (type.typeArgs[0].qname === 'u8' || type.typeArgs[0].qname === 'U8') {\n return data\n }\n\n const res = []\n for (const entry of data) {\n res.push(this.encode(entry, type.typeArgs[0]))\n }\n return res\n }\n\n // Process complex type\n const struct = this.getMoveStruct(type.qname)\n\n const typeCtx = new Map<string, TypeDescriptor>()\n for (const [idx, typeArg] of type.typeArgs.entries()) {\n typeCtx.set('T' + idx, typeArg)\n }\n\n const typedData: any = {}\n\n for (const field of struct.fields) {\n let filedType = field.type\n filedType = filedType.applyTypeArgs(typeCtx)\n const value = this.encode(data[field.name], filedType)\n typedData[field.name] = value\n }\n return typedData\n }\n\n decodeArray(entries: any[], types: TypeDescriptor[]): any[] {\n const entriesDecoded: any[] = []\n for (const [idx, arg] of entries.entries()) {\n // TODO consider apply payload.type_arguments, but this might be hard since we don't code gen for them\n const argType = types[idx]\n try {\n entriesDecoded.push(this.decode(arg, argType))\n } catch (e) {\n console.error(e, 'Decoding error for ', JSON.stringify(arg), 'using type', argType)\n return entries\n }\n }\n return entriesDecoded\n }\n\n encodeArray(entriesDecoded: any[], types: TypeDescriptor[]): any[] {\n const entries: any[] = []\n for (const [idx, arg] of entriesDecoded.entries()) {\n // TODO consider apply payload.type_arguments, but this might be hard since we don't code gen for them\n const argType = types[idx]\n try {\n entries.push(this.encode(arg, argType))\n } catch (e) {\n throw Error('Decoding error for ' + JSON.stringify(arg) + 'using type' + argType + e.toString())\n }\n }\n return entries\n }\n\n encodeCallArgs(args: any[], func: string): any[] {\n const f = this.getMoveFunction(func)\n return this.encodeArray(args, this.adapter.getMeaningfulFunctionParams(f.params))\n }\n\n decodeCallResult(res: any[], func: string): any[] {\n const f = this.getMoveFunction(func)\n return this.decodeArray(res, f.return)\n }\n\n protected filterAndDecodeStruct(typeQname: string, structs: StructType[]): any {\n if (!structs) {\n return []\n }\n const withTags = structs.map((s) => this.toStructWithTag(s))\n return this.filterAndDecodeStructWithTags(typeQname, withTags)\n }\n\n private filterAndDecodeStructWithTags<T>(\n typeQname: string,\n structsWithTags: StructWithTag<StructType>[]\n ): DecodedStructWithTag<StructType, T>[] {\n if (!structsWithTags) {\n return []\n }\n const results: DecodedStructWithTag<StructType, T>[] = []\n for (const resource of structsWithTags) {\n if (typeQname.includes('<')) {\n if (resource.type !== typeQname) {\n continue\n }\n } else if (resource.type.split('<')[0] !== typeQname) {\n continue\n }\n const result = this.decodedStructWithTag(resource)\n if (result) {\n results.push(result as DecodedStructWithTag<StructType, T>)\n }\n }\n return results\n }\n\n protected decodedStruct<T>(typeStruct: StructType): DecodedStructWithTag<StructType, T> | undefined {\n return this.decodedStructWithTag(this.toStructWithTag(typeStruct)) as any\n }\n\n private decodedStructWithTag<T>(\n typeStruct: StructWithTag<StructType>\n ): DecodedStructWithTag<StructType, T> | undefined {\n const typeDescriptor = parseMoveType(typeStruct.type)\n const typeArguments = typeDescriptor.typeArgs.map((t) => t.getSignature())\n\n let dataTyped = undefined\n try {\n dataTyped = this.decode(this.toStructWithTag(typeStruct.data), typeDescriptor)\n } catch (e) {\n console.error('Decoding error for ', JSON.stringify(typeStruct), e)\n return undefined\n }\n return {\n ...typeStruct,\n data_decoded: dataTyped,\n type_arguments: typeArguments,\n } as DecodedStructWithTag<StructType, T>\n }\n}\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { InternalMoveModule, InternalMoveStruct } from './internal-models.js';
|
2
|
+
import { TypeDescriptor } from './types.js';
|
3
|
+
export declare abstract class ChainAdapter<NetworkType, ModuleTypes> {
|
4
|
+
abstract fetchModules(account: string, network: NetworkType): Promise<ModuleTypes>;
|
5
|
+
abstract fetchModules(account: string, network: NetworkType): Promise<ModuleTypes>;
|
6
|
+
abstract toInternalModules(modules: ModuleTypes): InternalMoveModule[];
|
7
|
+
abstract getEventStructs(module: InternalMoveModule): Map<string, InternalMoveStruct>;
|
8
|
+
abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[];
|
9
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"chain-adapter.js","sourceRoot":"","sources":["../../src/move/chain-adapter.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,YAAY;CAUjC","sourcesContent":["import { InternalMoveModule, InternalMoveStruct } from './internal-models.js'\nimport { TypeDescriptor } from './types.js'\n\nexport abstract class ChainAdapter<NetworkType, ModuleTypes> {\n abstract fetchModules(account: string, network: NetworkType): Promise<ModuleTypes>\n\n abstract fetchModules(account: string, network: NetworkType): Promise<ModuleTypes>\n abstract toInternalModules(modules: ModuleTypes): InternalMoveModule[]\n // Get the structs that represent Events\n abstract getEventStructs(module: InternalMoveModule): Map<string, InternalMoveStruct>\n // Get the parameters that actually have arguments in runtime\n // Aptos first signer and Sui's last TxContext are no use\n abstract getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[]\n}\n"]}
|
package/lib/move/index.d.ts
CHANGED
package/lib/move/index.js
CHANGED
package/lib/move/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/move/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA","sourcesContent":["export * from './filter.js'\nexport * from './types.js'\nexport * from './utils.js'\nexport * from './account.js'\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/move/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA","sourcesContent":["export * from './filter.js'\nexport * from './types.js'\nexport * from './utils.js'\nexport * from './account.js'\nexport * from './chain-adapter.js'\n"]}
|
package/lib/sui/builtin/0x1.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"0x1.js","sourceRoot":"","sources":["../../../src/sui/builtin/0x1.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,oBAAoB;AACpB,oBAAoB;AAKpB,OAAO,EAEL,gBAAgB,EAEhB,gBAAgB,EAEhB,UAAU,GAGX,MAAM,iBAAiB,CAAC;AAMzB,MAAa,KAAM,SAAQ,gBAAgB;IACzC,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD,MAAM,CAAC,eAAe,GAAmB;QACvC,OAAO,EAAE,KAAK;QACd,OAAO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,WAGpB,CAAA;AAMH,CAAC,EAVgB,SAAS,KAAT,SAAS,QAUzB;AAID,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,6lnBAA6lnB,CAC9lnB,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,KAAgB;IAC3C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QACtC,KAAK,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAC;KACtB;AACH,CAAC;AAED,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\n/* Generated modules for account 0x1 */\n\nimport { CallFilter } from \"@sentio/sdk/move\";\nimport {\n MoveCoder,\n defaultMoveCoder,\n SuiBindOptions,\n SuiBaseProcessor,\n TypedEventInstance,\n SuiNetwork,\n TypedFunctionPayload,\n SuiContext,\n} from \"@sentio/sdk/sui\";\nimport { MoveFetchConfig } from \"@sentio/protos\";\nimport { SuiAddress, ModuleClient } from \"@sentio/sdk/sui\";\n\nexport namespace address {}\n\nexport class ascii extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"ascii\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): ascii {\n return new ascii({ ...ascii.DEFAULT_OPTIONS, ...options });\n }\n\n onEventChar(\n func: (event: ascii.CharInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): ascii {\n this.onMoveEvent(\n func,\n {\n type: \"ascii::Char\",\n },\n fetchConfig\n );\n return this;\n }\n\n onEventString(\n func: (event: ascii.StringInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): ascii {\n this.onMoveEvent(\n func,\n {\n type: \"ascii::String\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace ascii {\n export class Char {\n static TYPE_QNAME = \"0x1::ascii::Char\";\n byte: number;\n }\n\n export interface CharInstance extends TypedEventInstance<Char> {\n data_decoded: Char;\n type_arguments: [];\n }\n\n export class String {\n static TYPE_QNAME = \"0x1::ascii::String\";\n bytes: number[];\n }\n\n export interface StringInstance extends TypedEventInstance<String> {\n data_decoded: String;\n type_arguments: [];\n }\n}\n\nexport namespace bcs {}\n\nexport class bit_vector extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"bit_vector\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): bit_vector {\n return new bit_vector({ ...bit_vector.DEFAULT_OPTIONS, ...options });\n }\n\n onEventBitVector(\n func: (event: bit_vector.BitVectorInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): bit_vector {\n this.onMoveEvent(\n func,\n {\n type: \"bit_vector::BitVector\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace bit_vector {\n export class BitVector {\n static TYPE_QNAME = \"0x1::bit_vector::BitVector\";\n length: bigint;\n bit_field: Boolean[];\n }\n\n export interface BitVectorInstance extends TypedEventInstance<BitVector> {\n data_decoded: BitVector;\n type_arguments: [];\n }\n}\n\nexport namespace debug {}\n\nexport class fixed_point32 extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"fixed_point32\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): fixed_point32 {\n return new fixed_point32({ ...fixed_point32.DEFAULT_OPTIONS, ...options });\n }\n\n onEventFixedPoint32(\n func: (event: fixed_point32.FixedPoint32Instance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): fixed_point32 {\n this.onMoveEvent(\n func,\n {\n type: \"fixed_point32::FixedPoint32\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace fixed_point32 {\n export class FixedPoint32 {\n static TYPE_QNAME = \"0x1::fixed_point32::FixedPoint32\";\n value: bigint;\n }\n\n export interface FixedPoint32Instance\n extends TypedEventInstance<FixedPoint32> {\n data_decoded: FixedPoint32;\n type_arguments: [];\n }\n}\n\nexport namespace hash {}\n\nexport namespace option {\n export type Option<T> = T | undefined;\n}\n\nexport class string_ extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"string\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): string_ {\n return new string_({ ...string_.DEFAULT_OPTIONS, ...options });\n }\n\n onEventString(\n func: (event: string_.StringInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): string_ {\n this.onMoveEvent(\n func,\n {\n type: \"string::String\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace string_ {\n export class String {\n static TYPE_QNAME = \"0x1::string::String\";\n bytes: number[];\n }\n\n export interface StringInstance extends TypedEventInstance<String> {\n data_decoded: String;\n type_arguments: [];\n }\n}\n\nexport class type_name extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"type_name\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): type_name {\n return new type_name({ ...type_name.DEFAULT_OPTIONS, ...options });\n }\n\n onEventTypeName(\n func: (event: type_name.TypeNameInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): type_name {\n this.onMoveEvent(\n func,\n {\n type: \"type_name::TypeName\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace type_name {\n export class TypeName {\n static TYPE_QNAME = \"0x1::type_name::TypeName\";\n name: ascii.String;\n }\n\n export interface TypeNameInstance extends TypedEventInstance<TypeName> {\n data_decoded: TypeName;\n type_arguments: [];\n }\n}\n\nexport namespace vector {}\n\nconst MODULES = JSON.parse(\n '{\"address\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"address\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[],\"return\":[\"U64\"]}}},\"ascii\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"ascii\",\"friends\":[],\"structs\":{\"Char\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"byte\",\"type\":\"U8\"}]},\"String\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"bytes\",\"type\":{\"Vector\":\"U8\"}}]}},\"exposedFunctions\":{\"all_characters_printable\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"Bool\"]},\"as_bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[{\"Reference\":{\"Vector\":\"U8\"}}]},\"byte\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}],\"return\":[\"U8\"]},\"char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U8\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}]},\"into_bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[{\"Vector\":\"U8\"}]},\"is_printable_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U8\"],\"return\":[\"Bool\"]},\"is_valid_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U8\"],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"pop_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}]},\"push_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}],\"return\":[]},\"string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"try_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]}}]}}},\"bcs\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"bcs\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"to_bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"TypeParameter\":0}}],\"return\":[{\"Vector\":\"U8\"}]}}},\"bit_vector\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"bit_vector\",\"friends\":[],\"structs\":{\"BitVector\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"length\",\"type\":\"U64\"},{\"name\":\"bit_field\",\"type\":{\"Vector\":\"Bool\"}}]}},\"exposedFunctions\":{\"is_index_set\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"longest_set_sequence_starting_at\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[\"U64\"]},\"new\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}]},\"set\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[]},\"shift_left\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[]},\"unset\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[]}}},\"debug\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"debug\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"print\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"TypeParameter\":0}}],\"return\":[]},\"print_stack_trace\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[],\"return\":[]}}},\"fixed_point32\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"fixed_point32\",\"friends\":[],\"structs\":{\"FixedPoint32\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"value\",\"type\":\"U64\"}]}},\"exposedFunctions\":{\"create_from_rational\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\",\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}]},\"create_from_raw_value\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}]},\"divide_u64\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\",{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"U64\"]},\"get_raw_value\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"U64\"]},\"is_zero\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"Bool\"]},\"multiply_u64\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\",{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"U64\"]}}},\"hash\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"hash\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"sha2_256\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Vector\":\"U8\"}]},\"sha3_256\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Vector\":\"U8\"}]}}},\"option\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"option\",\"friends\":[],\"structs\":{\"Option\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[{\"constraints\":{\"abilities\":[]},\"isPhantom\":false}],\"fields\":[{\"name\":\"vec\",\"type\":{\"Vector\":{\"TypeParameter\":0}}}]}},\"exposedFunctions\":{\"borrow\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[{\"Reference\":{\"TypeParameter\":0}}]},\"borrow_mut\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[{\"MutableReference\":{\"TypeParameter\":0}}]},\"borrow_with_default\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[{\"Reference\":{\"TypeParameter\":0}}]},\"contains\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[\"Bool\"]},\"destroy_none\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}],\"return\":[]},\"destroy_some\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}],\"return\":[{\"TypeParameter\":0}]},\"destroy_with_default\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[\"Drop\"]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}},{\"TypeParameter\":0}],\"return\":[{\"TypeParameter\":0}]},\"extract\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[{\"TypeParameter\":0}]},\"fill\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[]},\"get_with_default\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[\"Copy\",\"Drop\"]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[{\"TypeParameter\":0}]},\"is_none\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[\"Bool\"]},\"is_some\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[\"Bool\"]},\"none\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}]},\"some\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"TypeParameter\":0}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}]},\"swap\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[{\"TypeParameter\":0}]},\"swap_or_fill\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}]},\"to_vec\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}],\"return\":[{\"Vector\":{\"TypeParameter\":0}}]}}},\"string\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"string\",\"friends\":[],\"structs\":{\"String\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"bytes\",\"type\":{\"Vector\":\"U8\"}}]}},\"exposedFunctions\":{\"append\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[]},\"append_utf8\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Vector\":\"U8\"}],\"return\":[]},\"bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[{\"Reference\":{\"Vector\":\"U8\"}}]},\"from_ascii\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]},\"index_of\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"insert\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},\"U64\",{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[]},\"is_empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"sub_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},\"U64\",\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]},\"to_ascii\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"try_utf8\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]}}]},\"utf8\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]}}},\"type_name\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"type_name\",\"friends\":[],\"structs\":{\"TypeName\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"name\",\"type\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}]}},\"exposedFunctions\":{\"borrow_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}}],\"return\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}]},\"get\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}]},\"get_address\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"get_module\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"into_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]}}},\"vector\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"vector\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"append\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},{\"Vector\":{\"TypeParameter\":0}}],\"return\":[]},\"borrow\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"Reference\":{\"TypeParameter\":0}}]},\"borrow_mut\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"MutableReference\":{\"TypeParameter\":0}}]},\"contains\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[\"Bool\"]},\"destroy_empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Vector\":{\"TypeParameter\":0}}],\"return\":[]},\"empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[],\"return\":[{\"Vector\":{\"TypeParameter\":0}}]},\"index_of\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[\"Bool\",\"U64\"]},\"insert\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},{\"TypeParameter\":0},\"U64\"],\"return\":[]},\"is_empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[\"U64\"]},\"pop_back\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[{\"TypeParameter\":0}]},\"push_back\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},{\"TypeParameter\":0}],\"return\":[]},\"remove\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"TypeParameter\":0}]},\"reverse\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[]},\"singleton\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"TypeParameter\":0}],\"return\":[{\"Vector\":{\"TypeParameter\":0}}]},\"swap\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\",\"U64\"],\"return\":[]},\"swap_remove\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"TypeParameter\":0}]}}}}'\n);\n\nexport function loadAllTypes(coder: MoveCoder) {\n for (const m of Object.values(MODULES)) {\n coder.load(m as any);\n }\n}\n\nloadAllTypes(def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/C,OAAO,IAAI,SAAS,CAAC,EAAE,GAAG,SAAS,CAAC,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,eAAe,CACb,IAAkE,EAClE,WAAsC;QAEtC,IAAI,CAAC,WAAW,CACd,IAAI,EACJ;YACE,IAAI,EAAE,qBAAqB;SAC5B,EACD,WAAW,CACZ,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;;SAzBU,SAAS;AA4BtB,WAAiB,SAAS;IACxB,MAAa,QAAQ;QACnB,MAAM,CAAC,UAAU,GAAG,0BAA0B,CAAC;QAC/C,IAAI,CAAe;;IAFR,kBAAQ,WAGpB,CAAA;AAMH,CAAC,EAVgB,SAAS,KAAT,SAAS,QAUzB;AAID,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,6lnBAA6lnB,CAC9lnB,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,KAAgB;IAC3C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QACtC,KAAK,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAC;KACtB;AACH,CAAC;AAED,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpD,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC","sourcesContent":["/* Autogenerated file. Do not edit manually. */\n/* tslint:disable */\n/* eslint-disable */\n\n/* Generated modules for account 0x1 */\n\nimport { CallFilter } from \"@sentio/sdk/move\";\nimport {\n MoveCoder,\n defaultMoveCoder,\n SuiBindOptions,\n SuiBaseProcessor,\n TypedEventInstance,\n SuiNetwork,\n TypedFunctionPayload,\n SuiContext,\n} from \"@sentio/sdk/sui\";\nimport { MoveFetchConfig } from \"@sentio/protos\";\nimport { SuiAddress, ModuleClient } from \"@sentio/sdk/sui\";\n\nexport namespace address {}\n\nexport class ascii extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"ascii\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): ascii {\n return new ascii({ ...ascii.DEFAULT_OPTIONS, ...options });\n }\n\n onEventChar(\n func: (event: ascii.CharInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): ascii {\n this.onMoveEvent(\n func,\n {\n type: \"ascii::Char\",\n },\n fetchConfig\n );\n return this;\n }\n\n onEventString(\n func: (event: ascii.StringInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): ascii {\n this.onMoveEvent(\n func,\n {\n type: \"ascii::String\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace ascii {\n export class Char {\n static TYPE_QNAME = \"0x1::ascii::Char\";\n byte: number;\n }\n\n export interface CharInstance extends TypedEventInstance<Char> {\n data_decoded: Char;\n type_arguments: [];\n }\n\n export class String {\n static TYPE_QNAME = \"0x1::ascii::String\";\n bytes: number[];\n }\n\n export interface StringInstance extends TypedEventInstance<String> {\n data_decoded: String;\n type_arguments: [];\n }\n}\n\nexport namespace bcs {}\n\nexport class bit_vector extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"bit_vector\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): bit_vector {\n return new bit_vector({ ...bit_vector.DEFAULT_OPTIONS, ...options });\n }\n\n onEventBitVector(\n func: (event: bit_vector.BitVectorInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): bit_vector {\n this.onMoveEvent(\n func,\n {\n type: \"bit_vector::BitVector\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace bit_vector {\n export class BitVector {\n static TYPE_QNAME = \"0x1::bit_vector::BitVector\";\n length: bigint;\n bit_field: Boolean[];\n }\n\n export interface BitVectorInstance extends TypedEventInstance<BitVector> {\n data_decoded: BitVector;\n type_arguments: [];\n }\n}\n\nexport namespace debug {}\n\nexport class fixed_point32 extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"fixed_point32\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): fixed_point32 {\n return new fixed_point32({ ...fixed_point32.DEFAULT_OPTIONS, ...options });\n }\n\n onEventFixedPoint32(\n func: (event: fixed_point32.FixedPoint32Instance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): fixed_point32 {\n this.onMoveEvent(\n func,\n {\n type: \"fixed_point32::FixedPoint32\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace fixed_point32 {\n export class FixedPoint32 {\n static TYPE_QNAME = \"0x1::fixed_point32::FixedPoint32\";\n value: bigint;\n }\n\n export interface FixedPoint32Instance\n extends TypedEventInstance<FixedPoint32> {\n data_decoded: FixedPoint32;\n type_arguments: [];\n }\n}\n\nexport namespace hash {}\n\nexport namespace option {\n export type Option<T> = T | undefined;\n}\n\nexport class string_ extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"string\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): string_ {\n return new string_({ ...string_.DEFAULT_OPTIONS, ...options });\n }\n\n onEventString(\n func: (event: string_.StringInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): string_ {\n this.onMoveEvent(\n func,\n {\n type: \"string::String\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace string_ {\n export class String {\n static TYPE_QNAME = \"0x1::string::String\";\n bytes: number[];\n }\n\n export interface StringInstance extends TypedEventInstance<String> {\n data_decoded: String;\n type_arguments: [];\n }\n}\n\nexport class type_name extends SuiBaseProcessor {\n constructor(options: SuiBindOptions) {\n super(\"type_name\", options);\n }\n static DEFAULT_OPTIONS: SuiBindOptions = {\n address: \"0x1\",\n network: SuiNetwork.MAIN_NET,\n };\n\n static bind(options: Partial<SuiBindOptions> = {}): type_name {\n return new type_name({ ...type_name.DEFAULT_OPTIONS, ...options });\n }\n\n onEventTypeName(\n func: (event: type_name.TypeNameInstance, ctx: SuiContext) => void,\n fetchConfig?: Partial<MoveFetchConfig>\n ): type_name {\n this.onMoveEvent(\n func,\n {\n type: \"type_name::TypeName\",\n },\n fetchConfig\n );\n return this;\n }\n}\n\nexport namespace type_name {\n export class TypeName {\n static TYPE_QNAME = \"0x1::type_name::TypeName\";\n name: ascii.String;\n }\n\n export interface TypeNameInstance extends TypedEventInstance<TypeName> {\n data_decoded: TypeName;\n type_arguments: [];\n }\n}\n\nexport namespace vector {}\n\nconst MODULES = JSON.parse(\n '{\"address\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"address\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[],\"return\":[\"U64\"]}}},\"ascii\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"ascii\",\"friends\":[],\"structs\":{\"Char\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"byte\",\"type\":\"U8\"}]},\"String\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"bytes\",\"type\":{\"Vector\":\"U8\"}}]}},\"exposedFunctions\":{\"all_characters_printable\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"Bool\"]},\"as_bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[{\"Reference\":{\"Vector\":\"U8\"}}]},\"byte\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}],\"return\":[\"U8\"]},\"char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U8\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}]},\"into_bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[{\"Vector\":\"U8\"}]},\"is_printable_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U8\"],\"return\":[\"Bool\"]},\"is_valid_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U8\"],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"pop_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}]},\"push_char\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"Char\",\"typeArguments\":[]}}],\"return\":[]},\"string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"try_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]}}]}}},\"bcs\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"bcs\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"to_bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"TypeParameter\":0}}],\"return\":[{\"Vector\":\"U8\"}]}}},\"bit_vector\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"bit_vector\",\"friends\":[],\"structs\":{\"BitVector\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"length\",\"type\":\"U64\"},{\"name\":\"bit_field\",\"type\":{\"Vector\":\"Bool\"}}]}},\"exposedFunctions\":{\"is_index_set\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"longest_set_sequence_starting_at\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[\"U64\"]},\"new\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}]},\"set\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[]},\"shift_left\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[]},\"unset\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"bit_vector\",\"name\":\"BitVector\",\"typeArguments\":[]}}},\"U64\"],\"return\":[]}}},\"debug\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"debug\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"print\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"TypeParameter\":0}}],\"return\":[]},\"print_stack_trace\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[],\"return\":[]}}},\"fixed_point32\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"fixed_point32\",\"friends\":[],\"structs\":{\"FixedPoint32\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"value\",\"type\":\"U64\"}]}},\"exposedFunctions\":{\"create_from_rational\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\",\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}]},\"create_from_raw_value\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}]},\"divide_u64\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\",{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"U64\"]},\"get_raw_value\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"U64\"]},\"is_zero\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"Bool\"]},\"multiply_u64\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[\"U64\",{\"Struct\":{\"address\":\"0x1\",\"module\":\"fixed_point32\",\"name\":\"FixedPoint32\",\"typeArguments\":[]}}],\"return\":[\"U64\"]}}},\"hash\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"hash\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"sha2_256\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Vector\":\"U8\"}]},\"sha3_256\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Vector\":\"U8\"}]}}},\"option\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"option\",\"friends\":[],\"structs\":{\"Option\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[{\"constraints\":{\"abilities\":[]},\"isPhantom\":false}],\"fields\":[{\"name\":\"vec\",\"type\":{\"Vector\":{\"TypeParameter\":0}}}]}},\"exposedFunctions\":{\"borrow\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[{\"Reference\":{\"TypeParameter\":0}}]},\"borrow_mut\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[{\"MutableReference\":{\"TypeParameter\":0}}]},\"borrow_with_default\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[{\"Reference\":{\"TypeParameter\":0}}]},\"contains\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[\"Bool\"]},\"destroy_none\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}],\"return\":[]},\"destroy_some\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}],\"return\":[{\"TypeParameter\":0}]},\"destroy_with_default\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[\"Drop\"]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}},{\"TypeParameter\":0}],\"return\":[{\"TypeParameter\":0}]},\"extract\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[{\"TypeParameter\":0}]},\"fill\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[]},\"get_with_default\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[\"Copy\",\"Drop\"]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[{\"TypeParameter\":0}]},\"is_none\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[\"Bool\"]},\"is_some\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}}],\"return\":[\"Bool\"]},\"none\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}]},\"some\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"TypeParameter\":0}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}]},\"swap\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[{\"TypeParameter\":0}]},\"swap_or_fill\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}},{\"TypeParameter\":0}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}]},\"to_vec\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"TypeParameter\":0}]}}],\"return\":[{\"Vector\":{\"TypeParameter\":0}}]}}},\"string\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"string\",\"friends\":[],\"structs\":{\"String\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"bytes\",\"type\":{\"Vector\":\"U8\"}}]}},\"exposedFunctions\":{\"append\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[]},\"append_utf8\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Vector\":\"U8\"}],\"return\":[]},\"bytes\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[{\"Reference\":{\"Vector\":\"U8\"}}]},\"from_ascii\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]},\"index_of\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"insert\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"MutableReference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},\"U64\",{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[]},\"is_empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}}],\"return\":[\"U64\"]},\"sub_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}},\"U64\",\"U64\"],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]},\"to_ascii\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"try_utf8\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"option\",\"name\":\"Option\",\"typeArguments\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]}}]},\"utf8\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Vector\":\"U8\"}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"string\",\"name\":\"String\",\"typeArguments\":[]}}]}}},\"type_name\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"type_name\",\"friends\":[],\"structs\":{\"TypeName\":{\"abilities\":{\"abilities\":[\"Copy\",\"Drop\",\"Store\"]},\"typeParameters\":[],\"fields\":[{\"name\":\"name\",\"type\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}]}},\"exposedFunctions\":{\"borrow_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}}],\"return\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}}]},\"get\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}]},\"get_address\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"get_module\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Reference\":{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]},\"into_string\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[],\"parameters\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"type_name\",\"name\":\"TypeName\",\"typeArguments\":[]}}],\"return\":[{\"Struct\":{\"address\":\"0x1\",\"module\":\"ascii\",\"name\":\"String\",\"typeArguments\":[]}}]}}},\"vector\":{\"fileFormatVersion\":6,\"address\":\"0x1\",\"name\":\"vector\",\"friends\":[],\"structs\":{},\"exposedFunctions\":{\"append\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},{\"Vector\":{\"TypeParameter\":0}}],\"return\":[]},\"borrow\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"Reference\":{\"TypeParameter\":0}}]},\"borrow_mut\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"MutableReference\":{\"TypeParameter\":0}}]},\"contains\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[\"Bool\"]},\"destroy_empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Vector\":{\"TypeParameter\":0}}],\"return\":[]},\"empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[],\"return\":[{\"Vector\":{\"TypeParameter\":0}}]},\"index_of\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}},{\"Reference\":{\"TypeParameter\":0}}],\"return\":[\"Bool\",\"U64\"]},\"insert\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},{\"TypeParameter\":0},\"U64\"],\"return\":[]},\"is_empty\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[\"Bool\"]},\"length\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"Reference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[\"U64\"]},\"pop_back\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[{\"TypeParameter\":0}]},\"push_back\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},{\"TypeParameter\":0}],\"return\":[]},\"remove\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"TypeParameter\":0}]},\"reverse\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}}],\"return\":[]},\"singleton\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"TypeParameter\":0}],\"return\":[{\"Vector\":{\"TypeParameter\":0}}]},\"swap\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\",\"U64\"],\"return\":[]},\"swap_remove\":{\"visibility\":\"Public\",\"isEntry\":false,\"typeParameters\":[{\"abilities\":[]}],\"parameters\":[{\"MutableReference\":{\"Vector\":{\"TypeParameter\":0}}},\"U64\"],\"return\":[{\"TypeParameter\":0}]}}}}'\n);\n\nexport function loadAllTypes(coder: MoveCoder) {\n for (const m of Object.values(MODULES)) {\n coder.load(m as any);\n }\n}\n\nloadAllTypes(defaultMoveCoder(SuiNetwork.MAIN_NET));\nloadAllTypes(defaultMoveCoder(SuiNetwork.TEST_NET));\n"]}
|
package/lib/sui/builtin/0x2.js
CHANGED