@sentio/sdk-bundle 2.41.1 → 2.41.2
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/builtin/0x1.d.ts +47 -0
- package/lib/aptos/builtin/0x1.d.ts.map +1 -1
- package/lib/aptos/builtin/0x1.js +1 -1
- package/lib/aptos/builtin/0x3.js +1 -1
- package/lib/aptos/builtin/index.js +1 -1
- package/lib/aptos/codegen/index.js +1 -1
- package/lib/aptos/codegen/index.js.map +1 -1
- package/lib/aptos/ext/index.js +1 -1
- package/lib/aptos/index.js +1 -1
- package/lib/chunk-4BXAHA3X.js +6 -0
- package/lib/chunk-4BXAHA3X.js.map +1 -0
- package/lib/{chunk-OBRJRXIU.js → chunk-6GBBRUCQ.js} +2 -2
- package/lib/{chunk-BJV226SY.js → chunk-7C7JTEPD.js} +2 -2
- package/lib/{chunk-BJV226SY.js.map → chunk-7C7JTEPD.js.map} +1 -1
- package/lib/{chunk-QDD4GOGS.js → chunk-E5HXKQGH.js} +2 -2
- package/lib/{chunk-RDRQUUED.js → chunk-FIYTXSME.js} +2 -2
- package/lib/{chunk-RDRQUUED.js.map → chunk-FIYTXSME.js.map} +1 -1
- package/lib/{chunk-OD4OZRJP.js → chunk-FN65HFOF.js} +2 -2
- package/lib/{chunk-TOIWKQ7V.js → chunk-FQ65UWWO.js} +2 -2
- package/lib/{chunk-TOIWKQ7V.js.map → chunk-FQ65UWWO.js.map} +1 -1
- package/lib/{chunk-LHCTFLPI.js → chunk-LJHDU2VC.js} +2 -2
- package/lib/{chunk-MFBM2O66.js → chunk-OJBUITSA.js} +2 -2
- package/lib/{chunk-F3YPXS5A.js → chunk-RTIGRFG6.js} +1 -1
- package/lib/{chunk-F3YPXS5A.js.map → chunk-RTIGRFG6.js.map} +1 -1
- package/lib/{chunk-AZ3ASLNE.js → chunk-XRETVDPO.js} +2 -2
- package/lib/eth/codegen/index.js +1 -1
- package/lib/move/index.js +1 -1
- package/lib/sui/builtin/0x1.js +1 -1
- package/lib/sui/builtin/0x2.js +1 -1
- package/lib/sui/builtin/0x3.js +1 -1
- package/lib/sui/builtin/index.js +1 -1
- package/lib/sui/codegen/index.js +1 -1
- package/lib/sui/codegen/index.js.map +1 -1
- package/lib/sui/ext/index.js +1 -1
- package/lib/sui/index.js +1 -1
- package/lib/testing/index.js +1 -1
- package/package.json +2 -2
- package/src/aptos/abis/0x1.json +210 -8
- package/src/aptos/builtin/0x1.ts +111 -1
- package/lib/chunk-UWNTLPFS.js +0 -6
- package/lib/chunk-UWNTLPFS.js.map +0 -1
- /package/lib/{chunk-OBRJRXIU.js.map → chunk-6GBBRUCQ.js.map} +0 -0
- /package/lib/{chunk-QDD4GOGS.js.map → chunk-E5HXKQGH.js.map} +0 -0
- /package/lib/{chunk-OD4OZRJP.js.map → chunk-FN65HFOF.js.map} +0 -0
- /package/lib/{chunk-LHCTFLPI.js.map → chunk-LJHDU2VC.js.map} +0 -0
- /package/lib/{chunk-MFBM2O66.js.map → chunk-OJBUITSA.js.map} +0 -0
- /package/lib/{chunk-AZ3ASLNE.js.map → chunk-XRETVDPO.js.map} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a,i as f,m as i,u as p,y as c}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a,i as f,m as i,u as p,y as c}from"./chunk-RTIGRFG6.js";function l(t){return{address:t.address,exposedFunctions:Object.entries(t.exposedFunctions).map(([e,r])=>d(e,r)),name:t.name,structs:Object.entries(t.structs).map(([e,r])=>g(e,r))}}function d(t,e){let r;switch(e.visibility){case"Private":r=c.PRIVATE;break;case"Public":r=c.PUBLIC;break;case"Friend":r=c.FRIEND;break;default:throw Error("No visibility for function"+t)}return{typeParams:e.typeParameters.map(s=>({constraints:s.abilities})),isEntry:e.isEntry,name:t,params:e.parameters.map(n),return:e.return.map(n),visibility:r}}function g(t,e){return{abilities:e.abilities.abilities,fields:e.fields.map(y),typeParams:e.typeParameters.map(r=>({constraints:r.constraints.abilities})),isNative:!1,name:t}}function y(t){return{name:t.name,type:n(t.type)}}function n(t){if(typeof t=="string")return new i(t);if("Struct"in t){let e=[t.Struct.address,t.Struct.module,t.Struct.name].join(a),r=t.Struct.typeArguments.map(n);return new i(e,r)}if("Vector"in t)return new i("Vector",[n(t.Vector)]);if("TypeParameter"in t)return new i("T"+t.TypeParameter);if("Reference"in t){let e=n(t.Reference);return e.reference=!0,e}if("MutableReference"in t){let e=n(t.MutableReference);return e.reference=!0,e.mutable=!0,e}throw new Error("Unexpected sui type")}var m=class extends p{async getChainId(){return this.client.getChainIdentifier()}client;constructor(e){super(),this.client=e}async fetchModule(e,r){return await this.client.getNormalizedMoveModule({package:e,module:r})}async fetchModules(e){let r=await this.client.getNormalizedMoveModulesByPackage({package:e});return Object.values(r)}getMeaningfulFunctionParams(e){return e}toInternalModules(e){return Object.values(e).map(l)}getAllEventStructs(e){let r=new Map;for(let s of e){let b=f(s);for(let o of s.structs){let u=new Set(o.abilities);u.has("Drop")&&u.has("Copy")&&r.set(b+a+o.name,o)}}return r}getType(e){return e.type}getData(e){if(e===void 0)throw Error("val is undefined");return"parsedJson"in e?e.parsedJson:e.dataType==="moveObject"||"fields"in e&&"type"in e&&Object.keys(e).length===2?e.fields:e}};export{l as a,m as b};
|
|
3
|
+
//# sourceMappingURL=chunk-7C7JTEPD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/@typemove+sui@1.6.
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/@typemove+sui@1.6.3_svelte@4.2.18_typescript@5.5.2/node_modules/@typemove/sui/src/to-internal.ts","../../../node_modules/.pnpm/@typemove+sui@1.6.3_svelte@4.2.18_typescript@5.5.2/node_modules/@typemove/sui/src/sui-chain-adapter.ts"],"sourcesContent":["import type {\n SuiMoveNormalizedField,\n SuiMoveNormalizedFunction,\n SuiMoveNormalizedModule,\n SuiMoveNormalizedStruct,\n SuiMoveNormalizedType,\n} from '@mysten/sui.js/client'\nimport {\n InternalMoveFunction,\n InternalMoveFunctionVisibility,\n InternalMoveModule,\n InternalMoveStruct,\n InternalMoveStructField,\n SPLITTER,\n TypeDescriptor,\n} from '@typemove/move'\n\nexport function toInternalModule(module: SuiMoveNormalizedModule): InternalMoveModule {\n return {\n address: module.address,\n exposedFunctions: Object.entries(module.exposedFunctions).map(([n, f]) => toInternalFunction(n, f)),\n name: module.name,\n structs: Object.entries(module.structs).map(([n, s]) => toInternalStruct(n, s)),\n }\n}\n\nfunction toInternalFunction(name: string, func: SuiMoveNormalizedFunction): InternalMoveFunction {\n let visibility\n switch (func.visibility) {\n case 'Private':\n visibility = InternalMoveFunctionVisibility.PRIVATE\n break\n case 'Public':\n visibility = InternalMoveFunctionVisibility.PUBLIC\n break\n case 'Friend':\n visibility = InternalMoveFunctionVisibility.FRIEND\n break\n default:\n throw Error('No visibility for function' + name)\n }\n return {\n typeParams: func.typeParameters.map((p: any) => {\n return { constraints: p.abilities }\n }),\n isEntry: func.isEntry,\n name: name,\n params: func.parameters.map(toTypeDescriptor),\n return: func.return.map(toTypeDescriptor),\n visibility: visibility,\n }\n}\n\nfunction toInternalStruct(name: string, struct: SuiMoveNormalizedStruct): InternalMoveStruct {\n return {\n abilities: struct.abilities.abilities,\n fields: struct.fields.map(toInternalField),\n typeParams: struct.typeParameters.map((p: any) => {\n return { constraints: p.constraints.abilities }\n }),\n isNative: false,\n name: name,\n }\n}\n\nfunction toInternalField(module: SuiMoveNormalizedField): InternalMoveStructField {\n return {\n name: module.name,\n type: toTypeDescriptor(module.type),\n }\n}\n\nfunction toTypeDescriptor(normalizedType: SuiMoveNormalizedType): TypeDescriptor {\n if (typeof normalizedType === 'string') {\n return new TypeDescriptor(normalizedType)\n }\n\n if ('Struct' in normalizedType) {\n const qname = [normalizedType.Struct.address, normalizedType.Struct.module, normalizedType.Struct.name].join(\n SPLITTER\n )\n\n const args = normalizedType.Struct.typeArguments.map(toTypeDescriptor)\n\n return new TypeDescriptor(qname, args)\n }\n\n if ('Vector' in normalizedType) {\n return new TypeDescriptor('Vector', [toTypeDescriptor(normalizedType.Vector)])\n }\n if ('TypeParameter' in normalizedType) {\n return new TypeDescriptor('T' + normalizedType.TypeParameter)\n }\n\n if ('Reference' in normalizedType) {\n const res = toTypeDescriptor(normalizedType.Reference)\n res.reference = true\n return res\n }\n\n if ('MutableReference' in normalizedType) {\n const res = toTypeDescriptor(normalizedType.MutableReference)\n res.reference = true\n res.mutable = true\n return res\n }\n\n throw new Error('Unexpected sui type')\n}\n","import { toInternalModule } from './to-internal.js'\nimport {\n InternalMoveModule,\n InternalMoveStruct,\n ChainAdapter,\n moduleQname,\n SPLITTER,\n TypeDescriptor\n} from '@typemove/move'\n\nimport { SuiMoveNormalizedModule, SuiEvent, SuiMoveObject, SuiClient } from '@mysten/sui.js/client'\n\nexport class SuiChainAdapter extends ChainAdapter<\n // SuiNetwork,\n SuiMoveNormalizedModule,\n SuiEvent | SuiMoveObject\n> {\n async getChainId() {\n return this.client.getChainIdentifier()\n }\n // static INSTANCE = new SuiChainAdapter()\n\n client: SuiClient\n constructor(client: SuiClient) {\n super()\n this.client = client\n }\n\n async fetchModule(\n account: string,\n module: string\n // network: SuiNetwork\n ): Promise<SuiMoveNormalizedModule> {\n return await this.client.getNormalizedMoveModule({ package: account, module })\n }\n\n async fetchModules(\n account: string\n // network: SuiNetwork\n ): Promise<SuiMoveNormalizedModule[]> {\n const modules = await this.client.getNormalizedMoveModulesByPackage({\n package: account\n })\n return Object.values(modules)\n }\n\n getMeaningfulFunctionParams(params: TypeDescriptor[]): TypeDescriptor[] {\n return params\n // if (params.length === 0) {\n // return params\n // }\n // return params.slice(0, params.length - 1)\n }\n\n toInternalModules(modules: SuiMoveNormalizedModule[]): InternalMoveModule[] {\n return Object.values(modules).map(toInternalModule)\n }\n\n getAllEventStructs(modules: InternalMoveModule[]): Map<string, InternalMoveStruct> {\n const eventMap = new Map<string, InternalMoveStruct>()\n\n for (const module of modules) {\n const qname = moduleQname(module)\n\n for (const struct of module.structs) {\n const abilities = new Set(struct.abilities)\n if (abilities.has('Drop') && abilities.has('Copy')) {\n eventMap.set(qname + SPLITTER + struct.name, struct)\n }\n }\n }\n return eventMap\n }\n\n getType(base: SuiEvent | SuiMoveObject): string {\n return base.type\n }\n\n getData(val: SuiEvent | SuiMoveObject) {\n // if (val.parsedJson) {\n // return val.parsedJson as any\n // }\n if (val === undefined) {\n throw Error('val is undefined')\n }\n if ('parsedJson' in val) {\n return val.parsedJson as any\n }\n // if (SuiParsedData.is(val)) {\n // return val.fields as any\n // }\n if (val.dataType === 'moveObject') {\n return val.fields as any\n }\n // if (SuiMoveObject.is(val)) {\n // return val.fields as any\n // }\n // This may not be perfect, just think everything has\n if ('fields' in val) {\n if ('type' in val && Object.keys(val).length === 2) {\n return val.fields as any\n }\n }\n return val as any\n }\n // validateAndNormalizeAddress(address: string) {\n // return validateAndNormalizeAddress(address)\n // }\n}\n\n// function getRpcEndpoint(network: SuiNetwork): string {\n// switch (network) {\n// case SuiNetwork.TEST_NET:\n// return 'https://fullnode.testnet.sui.io/'\n// }\n// return 'https://fullnode.mainnet.sui.io/'\n// }\n\nfunction getRpcClient(endpoint: string): SuiClient {\n return new SuiClient({ url: endpoint })\n}\n"],"mappings":";+DAiBM,SAAUA,EAAiBC,EAA+B,CAC9D,MAAO,CACL,QAASA,EAAO,QAChB,iBAAkB,OAAO,QAAQA,EAAO,gBAAgB,EAAE,IAAI,CAAC,CAACC,EAAGC,CAAC,IAAMC,EAAmBF,EAAGC,CAAC,CAAC,EAClG,KAAMF,EAAO,KACb,QAAS,OAAO,QAAQA,EAAO,OAAO,EAAE,IAAI,CAAC,CAACC,EAAGG,CAAC,IAAMC,EAAiBJ,EAAGG,CAAC,CAAC,EAElF,CAEA,SAASD,EAAmBG,EAAcC,EAA+B,CACvE,IAAIC,EACJ,OAAQD,EAAK,WAAY,CACvB,IAAK,UACHC,EAAaC,EAA+B,QAC5C,MACF,IAAK,SACHD,EAAaC,EAA+B,OAC5C,MACF,IAAK,SACHD,EAAaC,EAA+B,OAC5C,MACF,QACE,MAAM,MAAM,6BAA+BH,CAAI,CACnD,CACA,MAAO,CACL,WAAYC,EAAK,eAAe,IAAKG,IAC5B,CAAE,YAAaA,EAAE,SAAS,EAClC,EACD,QAASH,EAAK,QACd,KAAMD,EACN,OAAQC,EAAK,WAAW,IAAII,CAAgB,EAC5C,OAAQJ,EAAK,OAAO,IAAII,CAAgB,EACxC,WAAYH,EAEhB,CAEA,SAASH,EAAiBC,EAAcM,EAA+B,CACrE,MAAO,CACL,UAAWA,EAAO,UAAU,UAC5B,OAAQA,EAAO,OAAO,IAAIC,CAAe,EACzC,WAAYD,EAAO,eAAe,IAAKF,IAC9B,CAAE,YAAaA,EAAE,YAAY,SAAS,EAC9C,EACD,SAAU,GACV,KAAMJ,EAEV,CAEA,SAASO,EAAgBb,EAA8B,CACrD,MAAO,CACL,KAAMA,EAAO,KACb,KAAMW,EAAiBX,EAAO,IAAI,EAEtC,CAEA,SAASW,EAAiBG,EAAqC,CAC7D,GAAI,OAAOA,GAAmB,SAC5B,OAAO,IAAIC,EAAeD,CAAc,EAG1C,GAAI,WAAYA,EAAgB,CAC9B,IAAME,EAAQ,CAACF,EAAe,OAAO,QAASA,EAAe,OAAO,OAAQA,EAAe,OAAO,IAAI,EAAE,KACtGG,CAAQ,EAGJC,EAAOJ,EAAe,OAAO,cAAc,IAAIH,CAAgB,EAErE,OAAO,IAAII,EAAeC,EAAOE,CAAI,EAGvC,GAAI,WAAYJ,EACd,OAAO,IAAIC,EAAe,SAAU,CAACJ,EAAiBG,EAAe,MAAM,CAAC,CAAC,EAE/E,GAAI,kBAAmBA,EACrB,OAAO,IAAIC,EAAe,IAAMD,EAAe,aAAa,EAG9D,GAAI,cAAeA,EAAgB,CACjC,IAAMK,EAAMR,EAAiBG,EAAe,SAAS,EACrD,OAAAK,EAAI,UAAY,GACTA,EAGT,GAAI,qBAAsBL,EAAgB,CACxC,IAAMK,EAAMR,EAAiBG,EAAe,gBAAgB,EAC5D,OAAAK,EAAI,UAAY,GAChBA,EAAI,QAAU,GACPA,EAGT,MAAM,IAAI,MAAM,qBAAqB,CACvC,CChGM,IAAOC,EAAP,cAA+BC,CAIpC,CACC,MAAM,YAAU,CACd,OAAO,KAAK,OAAO,mBAAkB,CACvC,CAGA,OACA,YAAYC,EAAiB,CAC3B,MAAK,EACL,KAAK,OAASA,CAChB,CAEA,MAAM,YACJC,EACAC,GAGA,OAAO,MAAM,KAAK,OAAO,wBAAwB,CAAE,QAASD,EAAS,OAAAC,CAAM,CAAE,CAC/E,CAEA,MAAM,aACJD,GAGA,IAAME,EAAU,MAAM,KAAK,OAAO,kCAAkC,CAClE,QAASF,EACV,EACD,OAAO,OAAO,OAAOE,CAAO,CAC9B,CAEA,4BAA4BC,EAAwB,CAClD,OAAOA,CAKT,CAEA,kBAAkBD,EAAkC,CAClD,OAAO,OAAO,OAAOA,CAAO,EAAE,IAAIE,CAAgB,CACpD,CAEA,mBAAmBF,EAA6B,CAC9C,IAAMG,EAAW,IAAI,IAErB,QAAWJ,KAAUC,EAAS,CAC5B,IAAMI,EAAQC,EAAYN,CAAM,EAEhC,QAAWO,KAAUP,EAAO,QAAS,CACnC,IAAMQ,EAAY,IAAI,IAAID,EAAO,SAAS,EACtCC,EAAU,IAAI,MAAM,GAAKA,EAAU,IAAI,MAAM,GAC/CJ,EAAS,IAAIC,EAAQI,EAAWF,EAAO,KAAMA,CAAM,GAIzD,OAAOH,CACT,CAEA,QAAQM,EAA8B,CACpC,OAAOA,EAAK,IACd,CAEA,QAAQC,EAA6B,CAInC,GAAIA,IAAQ,OACV,MAAM,MAAM,kBAAkB,EAEhC,MAAI,eAAgBA,EACXA,EAAI,WAKTA,EAAI,WAAa,cAOjB,WAAYA,GACV,SAAUA,GAAO,OAAO,KAAKA,CAAG,EAAE,SAAW,EACxCA,EAAI,OAGRA,CACT","names":["toInternalModule","module","n","f","toInternalFunction","s","toInternalStruct","name","func","visibility","InternalMoveFunctionVisibility","p","toTypeDescriptor","struct","toInternalField","normalizedType","TypeDescriptor","qname","SPLITTER","args","res","SuiChainAdapter","ChainAdapter","client","account","module","modules","params","toInternalModule","eventMap","qname","moduleQname","struct","abilities","SPLITTER","base","val"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{g as r}from"./chunk-FSSXDSFO.js";import{a as l}from"./chunk-F2HFFA4Z.js";import{j as b}from"./chunk-COUICS5S.js";import{a as i,d as m}from"./chunk-F3YPXS5A.js";import{a as u}from"./chunk-2YDOSUNU.js";import{e as p}from"./chunk-LLHU72AA.js";var d=p(u(),1);var a=new Map;async function E(){let o=w.coinlist;try{o=(await(await l("https://raw.githubusercontent.com/solflare-wallet/sui-coinlist/master/sui-coinlist.json")).json()).coinlist}catch{console.warn("Can't not fetch newest coin list, use default list")}I(o)}function I(o){for(let e of o){if(e.address.startsWith("0x2::coin::Coin")||e.network!=="mainnet")continue;let s="native";e.name.includes("Celer")&&(s="Celer"),e.name.includes("LayerZero")&&(s="LayerZero"),e.name.includes("Wormhole")&&(s="Wormhole"),a.set(e.address,{token_type:{type:e.address,account_address:e.address.split("::")[0]},symbol:e.symbol,decimals:e.decimals,bridge:s})}}function N(){return a}function k(o){let[e,s,n]=o.split(i),t=[m(e),s,n].join(i);return a.has(t)}function B(o){let e=a.get(o);if(!e){let s=o.split("::");return{token_type:{type:o,account_address:s[0]},symbol:s[2],decimals:8,bridge:"native"}}return e}var g=new Map;async function R(o,e){let s=a.get(o);if(!s){e=e||d.SuiChainId.SUI_MAINNET;let n=e+"_"+o,t=g.get(n);t||(t=r(e).getCoinMetadata({coinType:o}),g.set(n,t));let c=await t;if(c===null)throw Error("Coin not existed "+n);let f=o.split(i);return{token_type:{type:o,account_address:f[0]},symbol:c.symbol,decimals:c.decimals,bridge:"native"}}return s}async function h(o,e){if(!k(o))return 0;let s=new Date(e/1e3);try{return await b(d.SuiChainId.SUI_MAINNET,o,s)||0}catch(n){throw console.log(JSON.stringify(n)),n}}async function D(o,e,s){let n=await h(e.token_type.type,s);return o.scaleDown(e.decimals).multipliedBy(n)}var w={name:"Sui Coin List",timestamp:"2022-12-01T13:34:30.145Z",logoURI:"https://s2.coinmarketcap.com/static/img/coins/128x128/20947.png",coinlist:[{network:"mainnet",address:"0x2::coin::Coin<0x2::sui::SUI>",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"testnet",address:"0x2::coin::Coin<0x2::sui::SUI>",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"devnet",address:"0x2::coin::Coin<0x2::sui::SUI>",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"mainnet",address:"0x2::sui::SUI",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"testnet",address:"0x2::sui::SUI",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"devnet",address:"0x2::sui::SUI",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST",symbol:"TEST",name:"Test Token",logoURI:"https://suiswap.app/images/token/suiswap-test.svg",tags:[],decimals:8,extensions:{}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT",symbol:"USDT",name:"Tether",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png",tags:[],decimals:8,extensions:{coingeckoId:"tether"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC",symbol:"USDC",name:"USD Coin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL",symbol:"SOL",name:"Solana",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",decimals:8,extensions:{coingeckoId:"solana"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC",symbol:"BTC",name:"Bitcoin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"bitcoin"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI",symbol:"DAI",name:"DAI",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"dai"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB",symbol:"BNB",name:"BNB",logoURI:"https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png",decimals:8,tags:[],extensions:{coingeckoId:"binancecoin"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH",symbol:"ETH",name:"Ethereum",logoURI:"https://assets.coingecko.com/coins/images/279/large/ethereum.png",decimals:8,tags:[],extensions:{coingeckoId:"ethereum"}},{network:"testnet",address:"0x31b14985adb91360ed90a5786cb0956c83e7f275a8ae6123f38adab9d2b792b1::usdc::USDC",symbol:"USDC",name:"USD Coin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST",symbol:"TEST",name:"Test Token",logoURI:"https://suiswap.app/images/token/suiswap-test.svg",tags:[],decimals:8,extensions:{}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT",symbol:"USDT",name:"Tether",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png",tags:[],decimals:8,extensions:{coingeckoId:"tether"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC",symbol:"USDC",name:"USD Coin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL",symbol:"SOL",name:"Solana",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",decimals:8,extensions:{coingeckoId:"solana"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC",symbol:"BTC",name:"Bitcoin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"bitcoin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI",symbol:"DAI",name:"DAI",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"dai"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB",symbol:"BNB",name:"BNB",logoURI:"https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png",decimals:8,tags:[],extensions:{coingeckoId:"binancecoin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH",symbol:"ETH",name:"Ethereum",logoURI:"https://assets.coingecko.com/coins/images/279/large/ethereum.png",decimals:8,tags:[],extensions:{coingeckoId:"ethereum"}},{network:"mainnet",address:"0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",symbol:"wETH",name:"Wrapped Ethereum (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/279/large/ethereum.png",tags:[],extensions:{coingeckoId:"ethereum"}},{network:"mainnet",address:"0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",symbol:"wUSDT",name:"Tether (Wormhole)",decimals:6,logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png",tags:[],extensions:{coingeckoId:"tether"}},{network:"mainnet",address:"0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",symbol:"wUSDC",name:"USD Coin (Wormhole)",decimals:6,logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"mainnet",address:"0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN",symbol:"wCELO",name:"Celo (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg",tags:[],extensions:{coingeckoId:"celo"}},{network:"mainnet",address:"0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN",symbol:"wMATIC",name:"Wrapped Matic (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png",tags:[],extensions:{coingeckoId:"matic-network"}},{network:"mainnet",address:"0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN",symbol:"wBNB",name:"Wrapped BNB (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png",tags:[],extensions:{coingeckoId:"binancecoin"}},{network:"mainnet",address:"0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",symbol:"wBTC",name:"Wrapped Bitcoin (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/1/large/bitcoin.png",tags:[],extensions:{coingeckoId:"bitcoin"}},{network:"mainnet",address:"0x1e8b532cca6569cab9f9b9ebc73f8c13885012ade714729aa3b450e0339ac766::coin::COIN",symbol:"wAVAX",name:"Wrapped AVAX (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/12559/large/Avalanche_Circle_RedWhite_Trans.png",tags:[],extensions:{coingeckoId:"avalanche-2"}},{network:"mainnet",address:"0x6081300950a4f1e2081580e919c210436a1bed49080502834950d31ee55a2396::coin::COIN",symbol:"wFTM",name:"Wrapped Fantom (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/4001/large/Fantom_round.png",tags:[],extensions:{coingeckoId:"fantom"}},{network:"mainnet",address:"0x66f87084e49c38f76502d17f87d17f943f183bb94117561eb573e075fdc5ff75::coin::COIN",symbol:"wGLMR",name:"Wrapped GLMR (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/22459/large/glmr.png",tags:[],extensions:{coingeckoId:"moonbeam"}},{network:"mainnet",address:"0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",symbol:"wSOL",name:"Wrapped Solana (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/4128/large/solana.png",tags:[],extensions:{coingeckoId:"solana"}},{network:"mainnet",address:"0xb231fcda8bbddb31f2ef02e6161444aec64a514e2c89279584ac9806ce9cf037::coin::COIN",symbol:"wUSDCsol",name:"USD Coin Solana (Wormhole)",decimals:6,logoURI:"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",tags:[],extensions:{coingeckoId:"usd-coin"}}]};export{E as a,N as b,k as c,B as d,R as e,h as f,D as g};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{g as r}from"./chunk-FSSXDSFO.js";import{a as l}from"./chunk-F2HFFA4Z.js";import{j as b}from"./chunk-COUICS5S.js";import{a as i,d as m}from"./chunk-RTIGRFG6.js";import{a as u}from"./chunk-2YDOSUNU.js";import{e as p}from"./chunk-LLHU72AA.js";var d=p(u(),1);var a=new Map;async function E(){let o=w.coinlist;try{o=(await(await l("https://raw.githubusercontent.com/solflare-wallet/sui-coinlist/master/sui-coinlist.json")).json()).coinlist}catch{console.warn("Can't not fetch newest coin list, use default list")}I(o)}function I(o){for(let e of o){if(e.address.startsWith("0x2::coin::Coin")||e.network!=="mainnet")continue;let s="native";e.name.includes("Celer")&&(s="Celer"),e.name.includes("LayerZero")&&(s="LayerZero"),e.name.includes("Wormhole")&&(s="Wormhole"),a.set(e.address,{token_type:{type:e.address,account_address:e.address.split("::")[0]},symbol:e.symbol,decimals:e.decimals,bridge:s})}}function N(){return a}function k(o){let[e,s,n]=o.split(i),t=[m(e),s,n].join(i);return a.has(t)}function B(o){let e=a.get(o);if(!e){let s=o.split("::");return{token_type:{type:o,account_address:s[0]},symbol:s[2],decimals:8,bridge:"native"}}return e}var g=new Map;async function R(o,e){let s=a.get(o);if(!s){e=e||d.SuiChainId.SUI_MAINNET;let n=e+"_"+o,t=g.get(n);t||(t=r(e).getCoinMetadata({coinType:o}),g.set(n,t));let c=await t;if(c===null)throw Error("Coin not existed "+n);let f=o.split(i);return{token_type:{type:o,account_address:f[0]},symbol:c.symbol,decimals:c.decimals,bridge:"native"}}return s}async function h(o,e){if(!k(o))return 0;let s=new Date(e/1e3);try{return await b(d.SuiChainId.SUI_MAINNET,o,s)||0}catch(n){throw console.log(JSON.stringify(n)),n}}async function D(o,e,s){let n=await h(e.token_type.type,s);return o.scaleDown(e.decimals).multipliedBy(n)}var w={name:"Sui Coin List",timestamp:"2022-12-01T13:34:30.145Z",logoURI:"https://s2.coinmarketcap.com/static/img/coins/128x128/20947.png",coinlist:[{network:"mainnet",address:"0x2::coin::Coin<0x2::sui::SUI>",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"testnet",address:"0x2::coin::Coin<0x2::sui::SUI>",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"devnet",address:"0x2::coin::Coin<0x2::sui::SUI>",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"mainnet",address:"0x2::sui::SUI",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"testnet",address:"0x2::sui::SUI",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"devnet",address:"0x2::sui::SUI",symbol:"SUI",name:"Sui Coin",decimals:9,logoURI:"https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg",tags:[],extensions:{coingeckoId:"sui"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST",symbol:"TEST",name:"Test Token",logoURI:"https://suiswap.app/images/token/suiswap-test.svg",tags:[],decimals:8,extensions:{}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT",symbol:"USDT",name:"Tether",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png",tags:[],decimals:8,extensions:{coingeckoId:"tether"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC",symbol:"USDC",name:"USD Coin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL",symbol:"SOL",name:"Solana",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",decimals:8,extensions:{coingeckoId:"solana"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC",symbol:"BTC",name:"Bitcoin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"bitcoin"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI",symbol:"DAI",name:"DAI",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"dai"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB",symbol:"BNB",name:"BNB",logoURI:"https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png",decimals:8,tags:[],extensions:{coingeckoId:"binancecoin"}},{network:"testnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH",symbol:"ETH",name:"Ethereum",logoURI:"https://assets.coingecko.com/coins/images/279/large/ethereum.png",decimals:8,tags:[],extensions:{coingeckoId:"ethereum"}},{network:"testnet",address:"0x31b14985adb91360ed90a5786cb0956c83e7f275a8ae6123f38adab9d2b792b1::usdc::USDC",symbol:"USDC",name:"USD Coin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST",symbol:"TEST",name:"Test Token",logoURI:"https://suiswap.app/images/token/suiswap-test.svg",tags:[],decimals:8,extensions:{}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT",symbol:"USDT",name:"Tether",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png",tags:[],decimals:8,extensions:{coingeckoId:"tether"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC",symbol:"USDC",name:"USD Coin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL",symbol:"SOL",name:"Solana",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",decimals:8,extensions:{coingeckoId:"solana"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC",symbol:"BTC",name:"Bitcoin",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"bitcoin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI",symbol:"DAI",name:"DAI",logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png",decimals:8,tags:[],extensions:{coingeckoId:"dai"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB",symbol:"BNB",name:"BNB",logoURI:"https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png",decimals:8,tags:[],extensions:{coingeckoId:"binancecoin"}},{network:"devnet",address:"0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH",symbol:"ETH",name:"Ethereum",logoURI:"https://assets.coingecko.com/coins/images/279/large/ethereum.png",decimals:8,tags:[],extensions:{coingeckoId:"ethereum"}},{network:"mainnet",address:"0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",symbol:"wETH",name:"Wrapped Ethereum (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/279/large/ethereum.png",tags:[],extensions:{coingeckoId:"ethereum"}},{network:"mainnet",address:"0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",symbol:"wUSDT",name:"Tether (Wormhole)",decimals:6,logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png",tags:[],extensions:{coingeckoId:"tether"}},{network:"mainnet",address:"0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",symbol:"wUSDC",name:"USD Coin (Wormhole)",decimals:6,logoURI:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png",tags:[],extensions:{coingeckoId:"usd-coin"}},{network:"mainnet",address:"0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN",symbol:"wCELO",name:"Celo (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg",tags:[],extensions:{coingeckoId:"celo"}},{network:"mainnet",address:"0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN",symbol:"wMATIC",name:"Wrapped Matic (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png",tags:[],extensions:{coingeckoId:"matic-network"}},{network:"mainnet",address:"0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN",symbol:"wBNB",name:"Wrapped BNB (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png",tags:[],extensions:{coingeckoId:"binancecoin"}},{network:"mainnet",address:"0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",symbol:"wBTC",name:"Wrapped Bitcoin (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/1/large/bitcoin.png",tags:[],extensions:{coingeckoId:"bitcoin"}},{network:"mainnet",address:"0x1e8b532cca6569cab9f9b9ebc73f8c13885012ade714729aa3b450e0339ac766::coin::COIN",symbol:"wAVAX",name:"Wrapped AVAX (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/12559/large/Avalanche_Circle_RedWhite_Trans.png",tags:[],extensions:{coingeckoId:"avalanche-2"}},{network:"mainnet",address:"0x6081300950a4f1e2081580e919c210436a1bed49080502834950d31ee55a2396::coin::COIN",symbol:"wFTM",name:"Wrapped Fantom (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/4001/large/Fantom_round.png",tags:[],extensions:{coingeckoId:"fantom"}},{network:"mainnet",address:"0x66f87084e49c38f76502d17f87d17f943f183bb94117561eb573e075fdc5ff75::coin::COIN",symbol:"wGLMR",name:"Wrapped GLMR (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/22459/large/glmr.png",tags:[],extensions:{coingeckoId:"moonbeam"}},{network:"mainnet",address:"0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",symbol:"wSOL",name:"Wrapped Solana (Wormhole)",decimals:8,logoURI:"https://assets.coingecko.com/coins/images/4128/large/solana.png",tags:[],extensions:{coingeckoId:"solana"}},{network:"mainnet",address:"0xb231fcda8bbddb31f2ef02e6161444aec64a514e2c89279584ac9806ce9cf037::coin::COIN",symbol:"wUSDCsol",name:"USD Coin Solana (Wormhole)",decimals:6,logoURI:"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",tags:[],extensions:{coingeckoId:"usd-coin"}}]};export{E as a,N as b,k as c,B as d,R as e,h as f,D as g};
|
|
3
|
+
//# sourceMappingURL=chunk-E5HXKQGH.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a as Te}from"./chunk-QDD4GOGS.js";import{a as Oe,b as Ie}from"./chunk-BJV226SY.js";import{a as Ce,b as be,c as Se,d as ve,f as C,g as w}from"./chunk-FSSXDSFO.js";import{d as Q,e as ge}from"./chunk-H6C4Z7K3.js";import{a as T,d as pe,f as fe,m as he,n as k,o as Z,x as me}from"./chunk-F3YPXS5A.js";import{a as ye}from"./chunk-2YDOSUNU.js";import{D as h,Nc as ue,W as de,Xb as V,fa as le,nc as $,x as L,za as I}from"./chunk-QLKNYTBQ.js";import{e as F,g as O}from"./chunk-LLHU72AA.js";import{ListStateStorage as Me,mergeProcessResults as Ae}from"@sentio/runtime";var u=F($(),1);var x=class extends me{bcs=new Ce(be());constructor(e){super(new Ie(e))}load(e,t){let n=this.moduleMapping.get(e.address+"::"+e.name),r=this.moduleMapping.get(t+"::"+e.name);return n&&r||(n=Oe(e),this.loadInternal(n,t)),n}async decode(e,t){switch(t.qname){case"0x1::ascii::Char":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).byte;return String.fromCharCode(r)}case"0x1::ascii::String":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return new TextDecoder().decode(new Uint8Array(r))}case"0x2::object::ID":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return ve(r)}case"0x2::url::Url":if(e!==void 0&&typeof e!="string")return(await super.decode(e,t)).url;case"0x2::coin::Coin":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).id.id.bytes;return new TextDecoder().decode(new Uint8Array(r))}return e;case"0x2::balance::Balance":return e.value?(await super.decode(e,t)).value:BigInt(e);case"0x1::option::Option":if(e===null)return e;if(e.vec){let r=await super.decode(e,t);return r=r.vec,r.length===0?null:r[0]}return this.decode(e,t.typeArgs[0]);case"Address":return Se(e);case"0x1::string::String":if(typeof e!="string")return new TextDecoder().decode(new Uint8Array(e.bytes));default:return super.decode(e,t)}}decodeEvent(e){return this.decodedStruct(e)}filterAndDecodeEvents(e,t){return typeof e=="string"&&(e=k(e)),this.filterAndDecodeStruct(e,t)}async getDynamicFields(e,t=Z,n=Z){let r=new he("0x2::dynamic_field::Field");return r.typeArgs=[t,n],(await this.filterAndDecodeObjects(r,e)).map(s=>s.data_decoded)}filterAndDecodeObjects(e,t){return this.filterAndDecodeStruct(e,t)}async decodeFunctionPayload(e,t){let n=[e.package,e.module,e.function].join(T),r=await this.getMoveFunction(n),o=this.adapter.getMeaningfulFunctionParams(r.params),s=[];for(let i of e.arguments||[]){let l=i;if("Input"in l){let g=l.Input,p=t[g];p.type==="pure"?s.push(p.value):(p.type==="object"||console.error("unexpected function arg value"),s.push(void 0))}else s.push(void 0)}let a=await this.decodeArray(s,o,!1);return{...e,arguments_decoded:a}}async _registerBCSType(e){if(this.bcs.hasType(e))return;let t=await this.getMoveStruct(e),n={};for(let s of t.fields)n[s.name]=s.type.getNormalizedSignature();let r=e,o=t.typeParams.map((s,a)=>"T"+a).join(", ");o&&(r=r+"<"+o+">"),this.bcs.registerStructType(r,n);for(let s of t.fields)await this.registerBCSTypes(s.type)}bcsRegistered=new Set;async registerBCSTypes(e){let t=e.getNormalizedSignature();if(!this.bcsRegistered.has(t)){this.bcsRegistered.add(t),await this._registerBCSType("0x1::string::String");for(let n of e.dependedTypes())await this._registerBCSType(n)}}async decodeBCS(e,t,n){return await this.registerBCSTypes(e),this.bcs.de(e.getNormalizedSignature(),t,n)}async decodeDevInspectResult(e){let t=[];if(e.results!=null)for(let n of e.results)if(n.returnValues)for(let r of n.returnValues){let o=k(r[1]),s=await this.decodeBCS(o,new Uint8Array(r[0])),a=await this.decodedType(s,o);t.push(a)}else t.push(null);return{...e,results_decoded:t}}};var we=new Map;function j(c=C.MAIN_NET){let e=we.get(c);return e||(e=new x(w(c)),we.set(c,e)),e}var f=class extends Q{moduleName;timestamp;checkpoint;transaction;eventIndex;coder;constructor(e,t,n,r,o,s,a,i){super(i),this.address=n.toLowerCase(),this.network=t,this.moduleName=e,this.timestamp=r,this.checkpoint=o,this.eventIndex=a,this.coder=j(t),s&&(this.transaction=s)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:this.moduleName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:this.transaction?.digest||"",logIndex:this.eventIndex,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},U=class extends Q{timestamp;checkpoint;coder;txDigest;constructor(e,t,n,r,o,s){super(s),this.address=t,this.network=e,this.timestamp=n,this.checkpoint=r,this.txDigest=o,this.coder=j(e)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:"*",blockNumber:this.checkpoint,transactionIndex:-1,transactionHash:this.txDigest,logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},X=class extends ge{address;network;checkpoint;timestamp;coder;contractName="address";constructor(e,t,n,r,o){super(o),this.address=t,this.network=e,this.checkpoint=n,this.timestamp=r,this.coder=j(e)}getChainId(){return this.network}getMetaDataInternal(e,t){return{address:this.address,contractName:this.contractName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:"",logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}getTimestamp(){return this.timestamp.getDate()}},G=class extends X{contractName="object";objectId;constructor(e,t,n,r,o){super(e,t,n,r,o),this.objectId=t}};function xe(c){let e=c.transaction?.data.transaction;if(!e)return[];let t=e.kind==="ProgrammableTransaction"?e:void 0;return t?t.transactions.flatMap(n=>{if("MoveCall"in n){let r=n.MoveCall;return r.package=pe(r.package),[r]}return[]}):[]}var P={resourceChanges:!1,allEvents:!1,inputs:!1};function q(c){return{startCheckpoint:c.startCheckpoint||0n,address:c.address==="*"?"*":fe(c.address),network:c.network||C.MAIN_NET,baseLabels:c.baseLabels}}var ee=class extends Me{},y=ee;O(y,"INSTANCE",new ee);var E=class{moduleName;config;eventHandlers=[];callHandlers=[];objectChangeHandlers=[];coder;constructor(e,t){this.moduleName=e,this.config=q(t),y.INSTANCE.addValue(this),this.coder=j(this.config.network)}getChainId(){return this.config.network}onMoveEvent(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.type));return this.eventHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"event is null");let l=i.transaction;if(!l.events||!l.events.length)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"no event in the transactions");let g=[];for(let p of l.events){let A=Number(p.id.eventSeq)||0,[ce,N,Y]=k(p.type).qname.split(T);if(!a.has([N,Y].join(T)))continue;let _=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,A,s.config.baseLabels),je=await s.coder.decodeEvent(p);await e(je||p,_),g.push(_.stopAndGetResult())}return Ae(g)},filters:r,fetchConfig:o}),this}onEntryFunctionCall(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.function));return this.callHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"call is null");let l=i.transaction,g=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,0,s.config.baseLabels);if(l){let p=xe(l),A=l.transaction?.data?.transaction;if(!A)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"Unexpected getTransactionKind get empty");let ce=A.kind==="ProgrammableTransaction"?A:void 0;for(let N of p){let Y=[N.module,N.function].join(T);if(!a.has(Y))continue;let _=await s.coder.decodeFunctionPayload(N,ce?.inputs||[]);await e(_,g)}}return g.stopAndGetResult()},filters:r,fetchConfig:o}),this}onEvent(e,t){return this.onMoveEvent(e,{type:""},t),this}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o=this;return this.callHandlers.push({handler:async function(s){if(!s.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"transaction is null");let a=s.transaction,i=new f(o.moduleName,o.config.network,o.config.address,s.timestamp||new Date(0),s.slot,a,0,o.config.baseLabels);return a&&await e(a,i),i.stopAndGetResult()},filters:[{...t,function:""}],fetchConfig:r}),this}onObjectChange(e,t){if(this.config.network===C.TEST_NET)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"object change not supported in testnet");let n=this;return this.objectChangeHandlers.push({handler:async function(r){let o=new U(n.config.network,n.config.address,r.timestamp||new Date(0),r.slot,r.txDigest,n.config.baseLabels);return await e(r.changes,o),o.stopAndGetResult()},type:t}),this}},D=class extends E{static bind(e){return new D("*",e)}},H=class extends E{static bind(e){return new H("*",{...e,address:"*"})}onTransactionBlock(e,t,n){return super.onTransactionBlock(e,t,n)}onObjectChange(e,t){return super.onObjectChange(e,t)}};import{ListStateStorage as Ne}from"@sentio/runtime";var z=F($(),1);var te={owned:!1},ne=class extends Ne{},M=ne;O(M,"INSTANCE",new ne);var R=class{config;ownerType;objectHandlers=[];constructor(e){this.config=q(e),this.ownerType=e.ownerType,M.INSTANCE.addValue(this)}getChainId(){return this.config.network}onInterval(e,t,n,r,o){let s=this;return this.objectHandlers.push({handler:async function(a){let i=new G(s.config.network,s.config.address,a.slot,a.timestamp||new Date(0),s.config.baseLabels);return await s.doHandle(e,a,i),i.stopAndGetResult()},timeIntervalInMinutes:t,checkPointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}},m=class extends R{callHandlers=[];static bind(e){return new m({...e,ownerType:L.ADDRESS})}doHandle(e,t,n){return e(t.objects,n)}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o={fromAndToAddress:{from:"",to:this.config.address},...t},s=this;return this.callHandlers.push({handler:async function(a){if(!a.transaction)throw new z.ServerError(z.Status.INVALID_ARGUMENT,"transaction is null");let i=a.transaction,l=new f("object",s.config.network,s.config.address,a.timestamp||new Date(0),a.slot,i,0,s.config.baseLabels);return i&&await e(i,l),l.stopAndGetResult()},filters:[{...o,function:""}],fetchConfig:r}),this}},b=class extends R{static bind(e){return new b({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){if(!t.self){console.log(`Sui object not existed in ${n.checkpoint}, please specific a start time`);return}return e(t.self,t.objects,n)}},S=class extends R{static bind(e){return new S({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.WRAPPED_OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){return e(t.objects,n)}};import{ListStateStorage as ke}from"@sentio/runtime";var ie=class extends ke{},v=ie;O(v,"INSTANCE",new ie);var B=class{id;objectHandlers=[];binds=new Set;constructor(){this.id=v.INSTANCE.getValues().length,v.INSTANCE.addValue(this)}bind(e,t){e.network=e.network||t.network,e.startCheckpoint=e.startCheckpoint||t.checkpoint;let n=e.objectId||e.address,r=[e.network,n].join("_");if(this.binds.has(r)){console.log(`Same object id can be bind to one template only once, ignore duplicate bind: ${r}`);return}this.binds.add(r);let o=this.createProcessor(e);for(let a of this.objectHandlers)o.onInterval(a.handler,a.timeIntervalInMinutes,a.checkpointInterval,a.type,a.fetchConfig);let s=o.config;t.update({states:{configUpdated:!0}}),ue.INSTANCE.addValue({templateId:this.id,contract:{name:"",chainId:s.network,address:s.address,abi:""},startBlock:s.startCheckpoint,endBlock:0n,baseLabels:s.baseLabels})}onInterval(e,t,n,r,o){return this.objectHandlers.push({handler:e,timeIntervalInMinutes:t,checkpointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}};var re=class extends B{handlers=[];createProcessor(e){let t=m.bind(e);for(let n of this.handlers)t.onTransactionBlock(n.handler,n.filter,n.fetchConfig);return t}onTransactionBlock(e,t,n){return this.handlers.push({handler:e,filter:t,fetchConfig:n}),this}},oe=class extends B{createProcessor(e){return b.bind(e)}},se=class extends B{createProcessor(e){return S.bind(e)}};import{errorString as J,mergeProcessResults as K,Plugin as Pe,PluginManager as Ee,USER_PROCESSOR as De}from"@sentio/runtime";var d=F($(),1);var ae=F(ye(),1);var W=class extends Pe{name="SuiPlugin";handlers={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};async start(e){await Te(),console.log("total instances:",e.templateInstances.length);let t=new Set(Object.values(ae.SuiChainId));for(let n of e.templateInstances){if(!t.has(n.contract?.chainId||""))continue;console.log("start template instance",n.templateId),v.INSTANCE.getValues()[n.templateId].bind({address:n.contract?.address||"",objectId:n.contract?.address||"",network:n.contract?.chainId||C.MAIN_NET,startCheckpoint:n.startBlock||0n,baseLabels:n.baseLabels},He)}}async configure(e){let t={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};for(let n of y.INSTANCE.getValues()){let r=de.fromPartial({transactionConfig:[],processorType:De,contract:{name:n.moduleName,chainId:n.config.network,address:n.config.address,abi:""},startBlock:n.config.startCheckpoint});for(let o of n.eventHandlers){let s=t.suiEventHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({type:i.type,account:i.account||""})),fetchConfig:o.fetchConfig,handlerId:s};r.moveEventConfigs.push(a)}for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}for(let o of n.objectChangeHandlers){let s=t.suiObjectChangeHandlers.push(o.handler)-1,a={type:o.type,handlerId:s};r.moveResourceChangeConfigs.push(a)}e.contractConfigs.push(r)}for(let n of M.INSTANCE.getValues()){let r=le.fromPartial({address:n.config.address,chainId:n.getChainId(),startBlock:n.config.startCheckpoint});for(let o of n.objectHandlers){let s=t.suiObjectHandlers.push(o.handler)-1;r.moveIntervalConfigs.push({intervalConfig:{handlerId:s,minutes:0,minutesInterval:o.timeIntervalInMinutes,slot:0,slotInterval:o.checkPointInterval,fetchConfig:void 0},type:o.type||"",ownerType:n.ownerType,fetchConfig:o.fetchConfig})}if(n instanceof m)for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}e.accountConfigs.push(r)}this.handlers=t}async processSuiEvent(e){if(!e.data?.suiEvent)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Event can't be empty");let t=[],n=e.data.suiEvent;for(let r of e.handlerIds)t.push(this.handlers.suiEventHandlers[r](n).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing event: "+JSON.stringify(n)+`
|
|
2
|
+
import{a as Te}from"./chunk-E5HXKQGH.js";import{a as Oe,b as Ie}from"./chunk-7C7JTEPD.js";import{a as Ce,b as be,c as Se,d as ve,f as C,g as w}from"./chunk-FSSXDSFO.js";import{d as Q,e as ge}from"./chunk-H6C4Z7K3.js";import{a as T,d as pe,f as fe,m as he,n as k,o as Z,x as me}from"./chunk-RTIGRFG6.js";import{a as ye}from"./chunk-2YDOSUNU.js";import{D as h,Nc as ue,W as de,Xb as V,fa as le,nc as $,x as L,za as I}from"./chunk-QLKNYTBQ.js";import{e as F,g as O}from"./chunk-LLHU72AA.js";import{ListStateStorage as Me,mergeProcessResults as Ae}from"@sentio/runtime";var u=F($(),1);var x=class extends me{bcs=new Ce(be());constructor(e){super(new Ie(e))}load(e,t){let n=this.moduleMapping.get(e.address+"::"+e.name),r=this.moduleMapping.get(t+"::"+e.name);return n&&r||(n=Oe(e),this.loadInternal(n,t)),n}async decode(e,t){switch(t.qname){case"0x1::ascii::Char":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).byte;return String.fromCharCode(r)}case"0x1::ascii::String":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return new TextDecoder().decode(new Uint8Array(r))}case"0x2::object::ID":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return ve(r)}case"0x2::url::Url":if(e!==void 0&&typeof e!="string")return(await super.decode(e,t)).url;case"0x2::coin::Coin":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).id.id.bytes;return new TextDecoder().decode(new Uint8Array(r))}return e;case"0x2::balance::Balance":return e.value?(await super.decode(e,t)).value:BigInt(e);case"0x1::option::Option":if(e===null)return e;if(e.vec){let r=await super.decode(e,t);return r=r.vec,r.length===0?null:r[0]}return this.decode(e,t.typeArgs[0]);case"Address":return Se(e);case"0x1::string::String":if(typeof e!="string")return new TextDecoder().decode(new Uint8Array(e.bytes));default:return super.decode(e,t)}}decodeEvent(e){return this.decodedStruct(e)}filterAndDecodeEvents(e,t){return typeof e=="string"&&(e=k(e)),this.filterAndDecodeStruct(e,t)}async getDynamicFields(e,t=Z,n=Z){let r=new he("0x2::dynamic_field::Field");return r.typeArgs=[t,n],(await this.filterAndDecodeObjects(r,e)).map(s=>s.data_decoded)}filterAndDecodeObjects(e,t){return this.filterAndDecodeStruct(e,t)}async decodeFunctionPayload(e,t){let n=[e.package,e.module,e.function].join(T),r=await this.getMoveFunction(n),o=this.adapter.getMeaningfulFunctionParams(r.params),s=[];for(let i of e.arguments||[]){let l=i;if("Input"in l){let g=l.Input,p=t[g];p.type==="pure"?s.push(p.value):(p.type==="object"||console.error("unexpected function arg value"),s.push(void 0))}else s.push(void 0)}let a=await this.decodeArray(s,o,!1);return{...e,arguments_decoded:a}}async _registerBCSType(e){if(this.bcs.hasType(e))return;let t=await this.getMoveStruct(e),n={};for(let s of t.fields)n[s.name]=s.type.getNormalizedSignature();let r=e,o=t.typeParams.map((s,a)=>"T"+a).join(", ");o&&(r=r+"<"+o+">"),this.bcs.registerStructType(r,n);for(let s of t.fields)await this.registerBCSTypes(s.type)}bcsRegistered=new Set;async registerBCSTypes(e){let t=e.getNormalizedSignature();if(!this.bcsRegistered.has(t)){this.bcsRegistered.add(t),await this._registerBCSType("0x1::string::String");for(let n of e.dependedTypes())await this._registerBCSType(n)}}async decodeBCS(e,t,n){return await this.registerBCSTypes(e),this.bcs.de(e.getNormalizedSignature(),t,n)}async decodeDevInspectResult(e){let t=[];if(e.results!=null)for(let n of e.results)if(n.returnValues)for(let r of n.returnValues){let o=k(r[1]),s=await this.decodeBCS(o,new Uint8Array(r[0])),a=await this.decodedType(s,o);t.push(a)}else t.push(null);return{...e,results_decoded:t}}};var we=new Map;function j(c=C.MAIN_NET){let e=we.get(c);return e||(e=new x(w(c)),we.set(c,e)),e}var f=class extends Q{moduleName;timestamp;checkpoint;transaction;eventIndex;coder;constructor(e,t,n,r,o,s,a,i){super(i),this.address=n.toLowerCase(),this.network=t,this.moduleName=e,this.timestamp=r,this.checkpoint=o,this.eventIndex=a,this.coder=j(t),s&&(this.transaction=s)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:this.moduleName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:this.transaction?.digest||"",logIndex:this.eventIndex,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},U=class extends Q{timestamp;checkpoint;coder;txDigest;constructor(e,t,n,r,o,s){super(s),this.address=t,this.network=e,this.timestamp=n,this.checkpoint=r,this.txDigest=o,this.coder=j(e)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:"*",blockNumber:this.checkpoint,transactionIndex:-1,transactionHash:this.txDigest,logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},X=class extends ge{address;network;checkpoint;timestamp;coder;contractName="address";constructor(e,t,n,r,o){super(o),this.address=t,this.network=e,this.checkpoint=n,this.timestamp=r,this.coder=j(e)}getChainId(){return this.network}getMetaDataInternal(e,t){return{address:this.address,contractName:this.contractName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:"",logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}getTimestamp(){return this.timestamp.getDate()}},G=class extends X{contractName="object";objectId;constructor(e,t,n,r,o){super(e,t,n,r,o),this.objectId=t}};function xe(c){let e=c.transaction?.data.transaction;if(!e)return[];let t=e.kind==="ProgrammableTransaction"?e:void 0;return t?t.transactions.flatMap(n=>{if("MoveCall"in n){let r=n.MoveCall;return r.package=pe(r.package),[r]}return[]}):[]}var P={resourceChanges:!1,allEvents:!1,inputs:!1};function q(c){return{startCheckpoint:c.startCheckpoint||0n,address:c.address==="*"?"*":fe(c.address),network:c.network||C.MAIN_NET,baseLabels:c.baseLabels}}var ee=class extends Me{},y=ee;O(y,"INSTANCE",new ee);var E=class{moduleName;config;eventHandlers=[];callHandlers=[];objectChangeHandlers=[];coder;constructor(e,t){this.moduleName=e,this.config=q(t),y.INSTANCE.addValue(this),this.coder=j(this.config.network)}getChainId(){return this.config.network}onMoveEvent(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.type));return this.eventHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"event is null");let l=i.transaction;if(!l.events||!l.events.length)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"no event in the transactions");let g=[];for(let p of l.events){let A=Number(p.id.eventSeq)||0,[ce,N,Y]=k(p.type).qname.split(T);if(!a.has([N,Y].join(T)))continue;let _=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,A,s.config.baseLabels),je=await s.coder.decodeEvent(p);await e(je||p,_),g.push(_.stopAndGetResult())}return Ae(g)},filters:r,fetchConfig:o}),this}onEntryFunctionCall(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.function));return this.callHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"call is null");let l=i.transaction,g=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,0,s.config.baseLabels);if(l){let p=xe(l),A=l.transaction?.data?.transaction;if(!A)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"Unexpected getTransactionKind get empty");let ce=A.kind==="ProgrammableTransaction"?A:void 0;for(let N of p){let Y=[N.module,N.function].join(T);if(!a.has(Y))continue;let _=await s.coder.decodeFunctionPayload(N,ce?.inputs||[]);await e(_,g)}}return g.stopAndGetResult()},filters:r,fetchConfig:o}),this}onEvent(e,t){return this.onMoveEvent(e,{type:""},t),this}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o=this;return this.callHandlers.push({handler:async function(s){if(!s.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"transaction is null");let a=s.transaction,i=new f(o.moduleName,o.config.network,o.config.address,s.timestamp||new Date(0),s.slot,a,0,o.config.baseLabels);return a&&await e(a,i),i.stopAndGetResult()},filters:[{...t,function:""}],fetchConfig:r}),this}onObjectChange(e,t){if(this.config.network===C.TEST_NET)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"object change not supported in testnet");let n=this;return this.objectChangeHandlers.push({handler:async function(r){let o=new U(n.config.network,n.config.address,r.timestamp||new Date(0),r.slot,r.txDigest,n.config.baseLabels);return await e(r.changes,o),o.stopAndGetResult()},type:t}),this}},D=class extends E{static bind(e){return new D("*",e)}},H=class extends E{static bind(e){return new H("*",{...e,address:"*"})}onTransactionBlock(e,t,n){return super.onTransactionBlock(e,t,n)}onObjectChange(e,t){return super.onObjectChange(e,t)}};import{ListStateStorage as Ne}from"@sentio/runtime";var z=F($(),1);var te={owned:!1},ne=class extends Ne{},M=ne;O(M,"INSTANCE",new ne);var R=class{config;ownerType;objectHandlers=[];constructor(e){this.config=q(e),this.ownerType=e.ownerType,M.INSTANCE.addValue(this)}getChainId(){return this.config.network}onInterval(e,t,n,r,o){let s=this;return this.objectHandlers.push({handler:async function(a){let i=new G(s.config.network,s.config.address,a.slot,a.timestamp||new Date(0),s.config.baseLabels);return await s.doHandle(e,a,i),i.stopAndGetResult()},timeIntervalInMinutes:t,checkPointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}},m=class extends R{callHandlers=[];static bind(e){return new m({...e,ownerType:L.ADDRESS})}doHandle(e,t,n){return e(t.objects,n)}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o={fromAndToAddress:{from:"",to:this.config.address},...t},s=this;return this.callHandlers.push({handler:async function(a){if(!a.transaction)throw new z.ServerError(z.Status.INVALID_ARGUMENT,"transaction is null");let i=a.transaction,l=new f("object",s.config.network,s.config.address,a.timestamp||new Date(0),a.slot,i,0,s.config.baseLabels);return i&&await e(i,l),l.stopAndGetResult()},filters:[{...o,function:""}],fetchConfig:r}),this}},b=class extends R{static bind(e){return new b({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){if(!t.self){console.log(`Sui object not existed in ${n.checkpoint}, please specific a start time`);return}return e(t.self,t.objects,n)}},S=class extends R{static bind(e){return new S({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.WRAPPED_OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){return e(t.objects,n)}};import{ListStateStorage as ke}from"@sentio/runtime";var ie=class extends ke{},v=ie;O(v,"INSTANCE",new ie);var B=class{id;objectHandlers=[];binds=new Set;constructor(){this.id=v.INSTANCE.getValues().length,v.INSTANCE.addValue(this)}bind(e,t){e.network=e.network||t.network,e.startCheckpoint=e.startCheckpoint||t.checkpoint;let n=e.objectId||e.address,r=[e.network,n].join("_");if(this.binds.has(r)){console.log(`Same object id can be bind to one template only once, ignore duplicate bind: ${r}`);return}this.binds.add(r);let o=this.createProcessor(e);for(let a of this.objectHandlers)o.onInterval(a.handler,a.timeIntervalInMinutes,a.checkpointInterval,a.type,a.fetchConfig);let s=o.config;t.update({states:{configUpdated:!0}}),ue.INSTANCE.addValue({templateId:this.id,contract:{name:"",chainId:s.network,address:s.address,abi:""},startBlock:s.startCheckpoint,endBlock:0n,baseLabels:s.baseLabels})}onInterval(e,t,n,r,o){return this.objectHandlers.push({handler:e,timeIntervalInMinutes:t,checkpointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}};var re=class extends B{handlers=[];createProcessor(e){let t=m.bind(e);for(let n of this.handlers)t.onTransactionBlock(n.handler,n.filter,n.fetchConfig);return t}onTransactionBlock(e,t,n){return this.handlers.push({handler:e,filter:t,fetchConfig:n}),this}},oe=class extends B{createProcessor(e){return b.bind(e)}},se=class extends B{createProcessor(e){return S.bind(e)}};import{errorString as J,mergeProcessResults as K,Plugin as Pe,PluginManager as Ee,USER_PROCESSOR as De}from"@sentio/runtime";var d=F($(),1);var ae=F(ye(),1);var W=class extends Pe{name="SuiPlugin";handlers={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};async start(e){await Te(),console.log("total instances:",e.templateInstances.length);let t=new Set(Object.values(ae.SuiChainId));for(let n of e.templateInstances){if(!t.has(n.contract?.chainId||""))continue;console.log("start template instance",n.templateId),v.INSTANCE.getValues()[n.templateId].bind({address:n.contract?.address||"",objectId:n.contract?.address||"",network:n.contract?.chainId||C.MAIN_NET,startCheckpoint:n.startBlock||0n,baseLabels:n.baseLabels},He)}}async configure(e){let t={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};for(let n of y.INSTANCE.getValues()){let r=de.fromPartial({transactionConfig:[],processorType:De,contract:{name:n.moduleName,chainId:n.config.network,address:n.config.address,abi:""},startBlock:n.config.startCheckpoint});for(let o of n.eventHandlers){let s=t.suiEventHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({type:i.type,account:i.account||""})),fetchConfig:o.fetchConfig,handlerId:s};r.moveEventConfigs.push(a)}for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}for(let o of n.objectChangeHandlers){let s=t.suiObjectChangeHandlers.push(o.handler)-1,a={type:o.type,handlerId:s};r.moveResourceChangeConfigs.push(a)}e.contractConfigs.push(r)}for(let n of M.INSTANCE.getValues()){let r=le.fromPartial({address:n.config.address,chainId:n.getChainId(),startBlock:n.config.startCheckpoint});for(let o of n.objectHandlers){let s=t.suiObjectHandlers.push(o.handler)-1;r.moveIntervalConfigs.push({intervalConfig:{handlerId:s,minutes:0,minutesInterval:o.timeIntervalInMinutes,slot:0,slotInterval:o.checkPointInterval,fetchConfig:void 0},type:o.type||"",ownerType:n.ownerType,fetchConfig:o.fetchConfig})}if(n instanceof m)for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}e.accountConfigs.push(r)}this.handlers=t}async processSuiEvent(e){if(!e.data?.suiEvent)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Event can't be empty");let t=[],n=e.data.suiEvent;for(let r of e.handlerIds)t.push(this.handlers.suiEventHandlers[r](n).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing event: "+JSON.stringify(n)+`
|
|
3
3
|
`+J(o))}));return K(await Promise.all(t))}async processSuiFunctionCall(e){if(!e.data?.suiCall)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Call can't be empty");let t=e.data.suiCall,n=[];for(let r of e.handlerIds){let o=this.handlers.suiCallHandlers[r](t).catch(s=>{throw new d.ServerError(d.Status.INTERNAL,"error processing call: "+JSON.stringify(t)+`
|
|
4
4
|
`+J(s))});n.push(o)}return K(await Promise.all(n))}async processSuiObject(e){if(!e.data?.suiObject)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Object can't be empty");let t=e.data.suiObject,n=[];for(let r of e.handlerIds)n.push(this.handlers.suiObjectHandlers[r](t).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing object: "+JSON.stringify(t)+`
|
|
5
5
|
`+J(o))}));return K(await Promise.all(n))}async processSuiObjectChange(e){if(!e.data?.suiObjectChange)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Object change can't be empty");let t=e.data.suiObjectChange,n=[];for(let r of e.handlerIds)n.push(this.handlers.suiObjectChangeHandlers[r](t).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing object change: "+JSON.stringify(t)+`
|
|
6
6
|
`+J(o))}));return K(await Promise.all(n))}supportedHandlers=[h.SUI_EVENT,h.SUI_CALL,h.SUI_OBJECT,h.SUI_OBJECT_CHANGE];processBinding(e){switch(e.handlerType){case h.SUI_EVENT:return this.processSuiEvent(e);case h.SUI_CALL:return this.processSuiFunctionCall(e);case h.SUI_OBJECT:return this.processSuiObject(e);case h.SUI_OBJECT_CHANGE:return this.processSuiObjectChange(e);default:throw new d.ServerError(d.Status.INVALID_ARGUMENT,"No handle type registered "+e.handlerType)}}};Ee.INSTANCE.register(new W);var He=new f("",ae.SuiChainId.SUI_MAINNET,"",new Date,0n,{},0,{});export{x as a,j as b,f as c,U as d,X as e,G as f,xe as g,E as h,D as i,H as j,m as k,b as l,S as m,re as n,oe as o,se as p,W as q};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-FIYTXSME.js.map
|