zo-sdk 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/BaseAPI.cjs +3 -4
- package/dist/abstract/BaseAPI.cjs.map +1 -1
- package/dist/abstract/BaseAPI.d.cts +13 -13
- package/dist/abstract/BaseAPI.d.cts.map +1 -1
- package/dist/abstract/BaseAPI.d.mts +13 -13
- package/dist/abstract/BaseAPI.d.mts.map +1 -1
- package/dist/abstract/BaseAPI.mjs +3 -4
- package/dist/abstract/BaseAPI.mjs.map +1 -1
- package/dist/abstract/BaseDataAPI.cjs +2 -2
- package/dist/abstract/BaseDataAPI.cjs.map +1 -1
- package/dist/abstract/BaseDataAPI.d.cts +2 -2
- package/dist/abstract/BaseDataAPI.d.cts.map +1 -1
- package/dist/abstract/BaseDataAPI.d.mts +2 -2
- package/dist/abstract/BaseDataAPI.d.mts.map +1 -1
- package/dist/abstract/BaseDataAPI.mjs +2 -2
- package/dist/abstract/BaseDataAPI.mjs.map +1 -1
- package/dist/abstract/index.cjs +3 -3
- package/dist/abstract/index.cjs.map +1 -1
- package/dist/abstract/index.d.cts +1 -1
- package/dist/abstract/index.d.cts.map +1 -1
- package/dist/abstract/index.d.mts +1 -1
- package/dist/abstract/index.d.mts.map +1 -1
- package/dist/abstract/index.mjs +1 -1
- package/dist/abstract/index.mjs.map +1 -1
- package/dist/api.cjs +2 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +2 -1
- package/dist/api.mjs.map +1 -1
- package/dist/bcs.cjs.map +1 -1
- package/dist/bcs.d.cts.map +1 -1
- package/dist/bcs.d.mts.map +1 -1
- package/dist/bcs.mjs.map +1 -1
- package/dist/consts/deployments-slp-mainnet.json +0 -70
- package/dist/consts/deployments-usdz-mainnet.json +1 -133
- package/dist/consts/index.cjs +21 -14
- package/dist/consts/index.cjs.map +1 -1
- package/dist/consts/index.d.cts.map +1 -1
- package/dist/consts/index.d.mts.map +1 -1
- package/dist/consts/index.mjs +21 -14
- package/dist/consts/index.mjs.map +1 -1
- package/dist/factory/SDKFactory.cjs +21 -14
- package/dist/factory/SDKFactory.cjs.map +1 -1
- package/dist/factory/SDKFactory.d.cts +4 -4
- package/dist/factory/SDKFactory.d.cts.map +1 -1
- package/dist/factory/SDKFactory.d.mts +4 -4
- package/dist/factory/SDKFactory.d.mts.map +1 -1
- package/dist/factory/SDKFactory.mjs +22 -15
- package/dist/factory/SDKFactory.mjs.map +1 -1
- package/dist/implementations/SLPAPI.cjs +143 -110
- package/dist/implementations/SLPAPI.cjs.map +1 -1
- package/dist/implementations/SLPAPI.d.cts +49 -47
- package/dist/implementations/SLPAPI.d.cts.map +1 -1
- package/dist/implementations/SLPAPI.d.mts +49 -47
- package/dist/implementations/SLPAPI.d.mts.map +1 -1
- package/dist/implementations/SLPAPI.mjs +143 -110
- package/dist/implementations/SLPAPI.mjs.map +1 -1
- package/dist/implementations/SLPDataAPI.cjs +98 -89
- package/dist/implementations/SLPDataAPI.cjs.map +1 -1
- package/dist/implementations/SLPDataAPI.d.cts +21 -21
- package/dist/implementations/SLPDataAPI.d.cts.map +1 -1
- package/dist/implementations/SLPDataAPI.d.mts +21 -21
- package/dist/implementations/SLPDataAPI.d.mts.map +1 -1
- package/dist/implementations/SLPDataAPI.mjs +98 -89
- package/dist/implementations/SLPDataAPI.mjs.map +1 -1
- package/dist/implementations/USDZAPI.cjs +128 -84
- package/dist/implementations/USDZAPI.cjs.map +1 -1
- package/dist/implementations/USDZAPI.d.cts +46 -45
- package/dist/implementations/USDZAPI.d.cts.map +1 -1
- package/dist/implementations/USDZAPI.d.mts +46 -45
- package/dist/implementations/USDZAPI.d.mts.map +1 -1
- package/dist/implementations/USDZAPI.mjs +128 -84
- package/dist/implementations/USDZAPI.mjs.map +1 -1
- package/dist/implementations/USDZDataAPI.cjs +48 -47
- package/dist/implementations/USDZDataAPI.cjs.map +1 -1
- package/dist/implementations/USDZDataAPI.d.cts +19 -19
- package/dist/implementations/USDZDataAPI.d.cts.map +1 -1
- package/dist/implementations/USDZDataAPI.d.mts +19 -19
- package/dist/implementations/USDZDataAPI.d.mts.map +1 -1
- package/dist/implementations/USDZDataAPI.mjs +49 -48
- package/dist/implementations/USDZDataAPI.mjs.map +1 -1
- package/dist/implementations/ZLPAPI.cjs +137 -89
- package/dist/implementations/ZLPAPI.cjs.map +1 -1
- package/dist/implementations/ZLPAPI.d.cts +50 -48
- package/dist/implementations/ZLPAPI.d.cts.map +1 -1
- package/dist/implementations/ZLPAPI.d.mts +50 -48
- package/dist/implementations/ZLPAPI.d.mts.map +1 -1
- package/dist/implementations/ZLPAPI.mjs +137 -89
- package/dist/implementations/ZLPAPI.mjs.map +1 -1
- package/dist/implementations/ZLPDataAPI.cjs +62 -63
- package/dist/implementations/ZLPDataAPI.cjs.map +1 -1
- package/dist/implementations/ZLPDataAPI.d.cts +19 -19
- package/dist/implementations/ZLPDataAPI.d.cts.map +1 -1
- package/dist/implementations/ZLPDataAPI.d.mts +19 -19
- package/dist/implementations/ZLPDataAPI.d.mts.map +1 -1
- package/dist/implementations/ZLPDataAPI.mjs +63 -64
- package/dist/implementations/ZLPDataAPI.mjs.map +1 -1
- package/dist/implementations/index.cjs +5 -5
- package/dist/implementations/index.cjs.map +1 -1
- package/dist/implementations/index.d.cts +2 -2
- package/dist/implementations/index.d.cts.map +1 -1
- package/dist/implementations/index.d.mts +2 -2
- package/dist/implementations/index.d.mts.map +1 -1
- package/dist/implementations/index.mjs +2 -2
- package/dist/implementations/index.mjs.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces/base.cjs +0 -1
- package/dist/interfaces/base.cjs.map +1 -1
- package/dist/interfaces/base.d.cts +57 -57
- package/dist/interfaces/base.d.cts.map +1 -1
- package/dist/interfaces/base.d.mts +57 -57
- package/dist/interfaces/base.d.mts.map +1 -1
- package/dist/interfaces/base.mjs +1 -1
- package/dist/interfaces/base.mjs.map +1 -1
- package/dist/interfaces/index.d.cts +4 -4
- package/dist/interfaces/index.d.cts.map +1 -1
- package/dist/interfaces/index.d.mts +4 -4
- package/dist/interfaces/index.d.mts.map +1 -1
- package/dist/interfaces/slp.cjs +0 -2
- package/dist/interfaces/slp.cjs.map +1 -1
- package/dist/interfaces/slp.d.cts +5 -5
- package/dist/interfaces/slp.d.cts.map +1 -1
- package/dist/interfaces/slp.d.mts +5 -5
- package/dist/interfaces/slp.d.mts.map +1 -1
- package/dist/interfaces/slp.mjs +1 -2
- package/dist/interfaces/slp.mjs.map +1 -1
- package/dist/interfaces/usdz.d.cts +1 -1
- package/dist/interfaces/usdz.d.cts.map +1 -1
- package/dist/interfaces/usdz.d.mts +1 -1
- package/dist/interfaces/usdz.d.mts.map +1 -1
- package/dist/interfaces/zlp.d.cts +5 -5
- package/dist/interfaces/zlp.d.cts.map +1 -1
- package/dist/interfaces/zlp.d.mts +5 -5
- package/dist/interfaces/zlp.d.mts.map +1 -1
- package/dist/oracle.cjs +12 -2
- package/dist/oracle.cjs.map +1 -1
- package/dist/oracle.d.cts +4 -3
- package/dist/oracle.d.cts.map +1 -1
- package/dist/oracle.d.mts +4 -3
- package/dist/oracle.d.mts.map +1 -1
- package/dist/oracle.mjs +13 -3
- package/dist/oracle.mjs.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +1 -1
- package/dist/utils.mjs.map +1 -1
- package/eslint.config.mjs +18 -0
- package/package.json +16 -15
- package/src/abstract/BaseAPI.ts +55 -49
- package/src/abstract/BaseDataAPI.ts +19 -17
- package/src/abstract/index.ts +1 -1
- package/src/api.ts +3 -1
- package/src/bcs.ts +9 -9
- package/src/consts/deployments-slp-mainnet.json +0 -70
- package/src/consts/deployments-usdz-mainnet.json +1 -133
- package/src/consts/index.ts +22 -15
- package/src/factory/SDKFactory.ts +49 -41
- package/src/implementations/SLPAPI.ts +299 -210
- package/src/implementations/SLPDataAPI.ts +163 -146
- package/src/implementations/USDZAPI.ts +238 -133
- package/src/implementations/USDZDataAPI.ts +79 -74
- package/src/implementations/ZLPAPI.ts +296 -174
- package/src/implementations/ZLPDataAPI.ts +93 -88
- package/src/implementations/index.ts +3 -3
- package/src/index.ts +17 -17
- package/src/interfaces/base.ts +123 -116
- package/src/interfaces/index.ts +14 -17
- package/src/interfaces/slp.ts +20 -19
- package/src/interfaces/usdz.ts +13 -13
- package/src/interfaces/zlp.ts +22 -21
- package/src/oracle.ts +25 -5
- package/src/utils.ts +9 -9
- package/tsconfig.json +1 -1
|
@@ -30,29 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"feeder": {
|
|
32
32
|
"sui": "0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37",
|
|
33
|
-
"
|
|
34
|
-
"eth": "0x9193fd47f9a0ab99b6e365a464c8a9ae30e6150fc37ed2a89c1586631f6fc4ab",
|
|
35
|
-
"nusdc": "0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab",
|
|
36
|
-
"usdt": "0x985e3db9f93f76ee8bace7c3dd5cc676a096accd5d9e09e9ae0fb6e492b14572",
|
|
37
|
-
"suiUsdt": "0x985e3db9f93f76ee8bace7c3dd5cc676a096accd5d9e09e9ae0fb6e492b14572",
|
|
38
|
-
"deep": "0x8c7f3a322b94cc69db2a2ac575cbd94bf5766113324c3a3eceac91e3e88a51ed",
|
|
39
|
-
"wal": "0xeb7e669f74d976c0b99b6ef9801e3a77716a95f1a15754e0f1399ce3fb60973d",
|
|
40
|
-
"xrp": "0x93bfda25cb6b1653a9c769e8216014bd2c06997f3edb479566761fbf2abf6ac2",
|
|
41
|
-
"sol": "0x9d0d275efbd37d8a8855f6f2c761fa5983293dd8ce202ee5196626de8fcd4469",
|
|
42
|
-
"doge": "0xd59a5f5173424ba725a7d033d86f2eadf2745f87a908bd27e1d27339eff598ce",
|
|
43
|
-
"hype": "0x1c047be615eaa5a87afa0e111b20a512dd6c0f4a1f0f691693cf852c1768f35d",
|
|
44
|
-
"ondo": "0xa64a406662db4ecde675fde111033e80629397715afc7fff53064f41dabab42f",
|
|
45
|
-
"trump": "0xd0835474be8cfcc7be4e02fc1bcd85dbdf11a54d061edc302e611ca304f57b14",
|
|
46
|
-
"cetus": "0x24c0247fb22457a719efac7f670cdc79be321b521460bd6bd2ccfa9f80713b14",
|
|
47
|
-
"haedal": "0xbc98681c15de1ca1b80a8e26500d43c77f7113368b024de1bf490afcb0387109",
|
|
48
|
-
"avax": "0x29e37978cb1c9501bda5d7c105f24f0058bc1668637e307fbc290dba48cb918d",
|
|
49
|
-
"bnb": "0x9c6e77f0ecfc46aac395e21c52ccb96518f85acacae743c5b47f4ca5e29826c3",
|
|
50
|
-
"ada": "0xf28e4e40a96948a19805fe76a4da373a262daac47588bac78d73033bce7b5a38",
|
|
51
|
-
"paxg": "0x78394446b806dcd3b26011b1c7fcfab104f95b718299bc98ff730983105bf943",
|
|
52
|
-
"jup": "0xb804ada6f77feb30a73fbed7fc53dc66ff25133dee0815109d4267e43b2e6bdd",
|
|
53
|
-
"aave": "0x4d1862d9ca2ad1f054f606220c22e0bcf37330d57bb82baa2063fd8193fc24ae",
|
|
54
|
-
"fartcoin": "0x330c38d9af008421306242945f9308dc80c0c6a3e30b289a079fbff5ceeb4696",
|
|
55
|
-
"spx": "0xbfa0e395413d94a7c45a9b987431a313a6e9da2e1b892f1924f64a0aff21e59f"
|
|
33
|
+
"nusdc": "0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab"
|
|
56
34
|
}
|
|
57
35
|
},
|
|
58
36
|
"coins": {
|
|
@@ -61,120 +39,10 @@
|
|
|
61
39
|
"module": "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI",
|
|
62
40
|
"metadata": "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"
|
|
63
41
|
},
|
|
64
|
-
"btc": {
|
|
65
|
-
"decimals": 8,
|
|
66
|
-
"module": "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN",
|
|
67
|
-
"metadata": "0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd"
|
|
68
|
-
},
|
|
69
|
-
"eth": {
|
|
70
|
-
"decimals": 8,
|
|
71
|
-
"module": "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
|
|
72
|
-
"metadata": "0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f"
|
|
73
|
-
},
|
|
74
42
|
"nusdc": {
|
|
75
43
|
"decimals": 6,
|
|
76
44
|
"module": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
77
45
|
"metadata": "0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6"
|
|
78
|
-
},
|
|
79
|
-
"usdt": {
|
|
80
|
-
"decimals": 6,
|
|
81
|
-
"module": "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
|
|
82
|
-
"metadata": "0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c"
|
|
83
|
-
},
|
|
84
|
-
"suiUsdt": {
|
|
85
|
-
"decimals": 6,
|
|
86
|
-
"module": "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT",
|
|
87
|
-
"metadata": "0xda61b33ac61ed4c084bbda65a2229459ed4eb2185729e70498538f0688bec3cc"
|
|
88
|
-
},
|
|
89
|
-
"deep": {
|
|
90
|
-
"decimals": 6,
|
|
91
|
-
"module": "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
|
|
92
|
-
"metadata": "0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0"
|
|
93
|
-
},
|
|
94
|
-
"wal": {
|
|
95
|
-
"decimals": 9,
|
|
96
|
-
"module": "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
|
|
97
|
-
"metadata": "0xcf8a31804ae40cb3e7183fe57320f87467a7750d4fa701bca1ffbb1edd37781e"
|
|
98
|
-
},
|
|
99
|
-
"xrp": {
|
|
100
|
-
"decimals": 6,
|
|
101
|
-
"module": "0x8592d41b28815030c40cae43bf30a3f75657e57e6028a05c1b56e5f236b1416e::xrp::XRP",
|
|
102
|
-
"metadata": "0x69004e9f9a4981fdee2f3050cf99c7d2f2a7e45b871da2cc056a850e6bf818b3"
|
|
103
|
-
},
|
|
104
|
-
"sol": {
|
|
105
|
-
"decimals": 8,
|
|
106
|
-
"module": "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN",
|
|
107
|
-
"metadata": "0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e"
|
|
108
|
-
},
|
|
109
|
-
"doge": {
|
|
110
|
-
"decimals": 8,
|
|
111
|
-
"module": "0xe364a361406e7ab4ea4ec17cc4840b18737dd20bd7124a82130aa21422b8fc20::doge::DOGE",
|
|
112
|
-
"metadata": "0xf3da270f549dd26d1d2dd251961d46919d3abb3044a98ef0fd7dd914d3cc9159"
|
|
113
|
-
},
|
|
114
|
-
"hype": {
|
|
115
|
-
"decimals": 8,
|
|
116
|
-
"module": "0xea2748c16bb45cac2d2602d6ad25089d24a814abc9495c0210b8b856617c4e66::hype::HYPE",
|
|
117
|
-
"metadata": "0xc23c06733cab74bd55febf4f7f8a26234385974b048b95a254d2cbd7fde256b2"
|
|
118
|
-
},
|
|
119
|
-
"ondo": {
|
|
120
|
-
"decimals": 8,
|
|
121
|
-
"module": "0xfe7d492e5c3fd9c88ac859d4d37179e301ce78104da40e44ea7bb38911d4ae0a::ondo::ONDO",
|
|
122
|
-
"metadata": "0xa340ffa4f80fc2b4df43f469fb5088b396c20624ee6b54024052977f49be9f82"
|
|
123
|
-
},
|
|
124
|
-
"trump": {
|
|
125
|
-
"decimals": 6,
|
|
126
|
-
"module": "0xbac9a286efdb3520c76c2cbff789ad42c0834c857c3a249915b10d8b5bf8afac::trump::TRUMP",
|
|
127
|
-
"metadata": "0xdea3d7c4b12833a89edd5f04921e800a6e34f9e8256dc514979855d5084212ba"
|
|
128
|
-
},
|
|
129
|
-
"cetus": {
|
|
130
|
-
"decimals": 9,
|
|
131
|
-
"module": "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS",
|
|
132
|
-
"metadata": "0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da"
|
|
133
|
-
},
|
|
134
|
-
"haedal": {
|
|
135
|
-
"decimals": 9,
|
|
136
|
-
"module": "0x3a304c7feba2d819ea57c3542d68439ca2c386ba02159c740f7b406e592c62ea::haedal::HAEDAL",
|
|
137
|
-
"metadata": "0xcc89fcc22f0d13de3688b94fa16d64a22079186a941914280c67101ff754263c"
|
|
138
|
-
},
|
|
139
|
-
"aave": {
|
|
140
|
-
"decimals": 8,
|
|
141
|
-
"module": "0x398e363d2b93ecb615ca36687657d71bd5cb590b5ebd6c3033ad6956a62b1ca4::aave::AAVE",
|
|
142
|
-
"metadata": "0x0d9fbea2ed02fffc738a5c0bb61ec09cfd5388ac3095a1f0abc99b30a64cb45e"
|
|
143
|
-
},
|
|
144
|
-
"ada": {
|
|
145
|
-
"decimals": 8,
|
|
146
|
-
"module": "0xe0195a3d560e332aba28b4a3aa91c9430c76cc4be0cc43a46015879597b6d338::ada::ADA",
|
|
147
|
-
"metadata": "0x8a87d822e41044f8285127674c0fff2c0598d473dc75f6695ef729bf4caeef27"
|
|
148
|
-
},
|
|
149
|
-
"avax": {
|
|
150
|
-
"decimals": 8,
|
|
151
|
-
"module": "0xdbb90a6e799340738f9a500f955d9053eb54c1011691e27f58cb98762b290c81::avax::AVAX",
|
|
152
|
-
"metadata": "0x33dfac0409b0c134ef11e76f0e71839cb43f957315c69e678398abadc21e3160"
|
|
153
|
-
},
|
|
154
|
-
"fartcoin": {
|
|
155
|
-
"decimals": 9,
|
|
156
|
-
"module": "0xebda4656236c29b3a4472f35ae6a4a27e17b65259611d549b5b260e2f8e5abe2::fartcoin::FARTCOIN",
|
|
157
|
-
"metadata": "0x7a5a0e1dd1d9d8776b5312fd3f14e91d36ee02e97874df768b3b2cd16794ea17"
|
|
158
|
-
},
|
|
159
|
-
"jup": {
|
|
160
|
-
"decimals": 8,
|
|
161
|
-
"module": "0x31095ed9f80427b69635cde750237c3bd98aa806efd31306e13c50ae0b12a500::jup::JUP",
|
|
162
|
-
"metadata": "0x487f2f60529f8dbc41cff75e2f5cf8ebafb86e09f97c5c6df6a8cf7cbbdc04e6"
|
|
163
|
-
},
|
|
164
|
-
"paxg": {
|
|
165
|
-
"decimals": 8,
|
|
166
|
-
"module": "0xa613dcbd506ac7c0f5fd5574e26eaa53c2279bfcbae7e4541af98d697ef9a786::paxg::PAXG",
|
|
167
|
-
"metadata": "0x9ae44fdc2ddd13581c26d913d9fa43e47dd66a347cb7bb6f93036efd2eec9ab4"
|
|
168
|
-
},
|
|
169
|
-
"spx": {
|
|
170
|
-
"decimals": 9,
|
|
171
|
-
"module": "0x9f08c77e89af768d7ee5accf8b66b07d606a84b5939e6896a1ae92d519523eac::spx::SPX",
|
|
172
|
-
"metadata": "0x0400c0f644c94372c3784eba220402cba968659b7e16d640e455b4c72c5cc02c"
|
|
173
|
-
},
|
|
174
|
-
"bnb": {
|
|
175
|
-
"decimals": 8,
|
|
176
|
-
"module": "0x10cb719b69a7f529600e7238460944c3932f98a2a95b48a0728ac3bbb9c95534::bnb::BNB",
|
|
177
|
-
"metadata": "0xcfa4b4e79c836c7c278b7a8675e6fcc8356d6701871371b364fc4af01ac7fba7"
|
|
178
46
|
}
|
|
179
47
|
}
|
|
180
48
|
}
|
package/src/consts/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { reverseKeyValue } from '../utils'
|
|
2
|
-
import zlpMainnetJson from './deployments-zlp-mainnet.json'
|
|
3
|
-
import zlpTestnetJson from './deployments-zlp-testnet.json'
|
|
4
|
-
import usdzMainnetJson from './deployments-usdz-mainnet.json'
|
|
5
|
-
import usdzTestnetJson from './deployments-usdz-testnet.json'
|
|
6
2
|
import slpMainnetJson from './deployments-slp-mainnet.json'
|
|
7
3
|
import slpTestnetJson from './deployments-slp-testnet.json'
|
|
4
|
+
import usdzMainnetJson from './deployments-usdz-mainnet.json'
|
|
5
|
+
import usdzTestnetJson from './deployments-usdz-testnet.json'
|
|
6
|
+
import zlpMainnetJson from './deployments-zlp-mainnet.json'
|
|
7
|
+
import zlpTestnetJson from './deployments-zlp-testnet.json'
|
|
8
8
|
import PriceIdToObjectIdMainnet from './price_id_to_object_id.mainnet.json'
|
|
9
9
|
import PriceIdToObjectIdTestnet from './price_id_to_object_id.testnet.json'
|
|
10
10
|
|
|
@@ -90,7 +90,7 @@ export interface IConsts {
|
|
|
90
90
|
upgradeCap: string
|
|
91
91
|
adminCap: string
|
|
92
92
|
pool: string
|
|
93
|
-
}
|
|
93
|
+
}
|
|
94
94
|
zoLootbox: {
|
|
95
95
|
package: string
|
|
96
96
|
upgradedPackage: string
|
|
@@ -146,7 +146,7 @@ export interface IConsts {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
function toCamelCase(str: string): string {
|
|
149
|
-
return str.
|
|
149
|
+
return str.replaceAll(/_([a-z])/g, (_: string, letter: string) => letter.toUpperCase())
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
function parse(obj: any): any {
|
|
@@ -155,11 +155,12 @@ function parse(obj: any): any {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
if (Array.isArray(obj)) {
|
|
158
|
-
return obj.map(parse)
|
|
158
|
+
return obj.map(element => parse(element))
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
const newObj: any = {}
|
|
162
162
|
|
|
163
|
+
// eslint-disable-next-line guard-for-in
|
|
163
164
|
for (const key in obj) {
|
|
164
165
|
const camelCaseKey = toCamelCase(key)
|
|
165
166
|
newObj[camelCaseKey] = parse(obj[key])
|
|
@@ -189,28 +190,34 @@ export function getConsts(network: string, lpToken: LPToken = LPToken.ZLP): ICon
|
|
|
189
190
|
case Network.TESTNET: {
|
|
190
191
|
let testnetDeployment
|
|
191
192
|
switch (lpToken) {
|
|
192
|
-
case LPToken.USDZ:
|
|
193
|
+
case LPToken.USDZ: {
|
|
193
194
|
testnetDeployment = usdzTestnetJson
|
|
194
195
|
break
|
|
195
|
-
|
|
196
|
+
}
|
|
197
|
+
case LPToken.SLP: {
|
|
196
198
|
testnetDeployment = slpTestnetJson
|
|
197
199
|
break
|
|
198
|
-
|
|
200
|
+
}
|
|
201
|
+
default: {
|
|
199
202
|
testnetDeployment = zlpTestnetJson
|
|
203
|
+
}
|
|
200
204
|
}
|
|
201
205
|
return { ...parse(testnetDeployment) }
|
|
202
206
|
}
|
|
203
207
|
case Network.MAINNET: {
|
|
204
208
|
let mainnetDeployment
|
|
205
209
|
switch (lpToken) {
|
|
206
|
-
case LPToken.USDZ:
|
|
210
|
+
case LPToken.USDZ: {
|
|
207
211
|
mainnetDeployment = usdzMainnetJson
|
|
208
212
|
break
|
|
209
|
-
|
|
213
|
+
}
|
|
214
|
+
case LPToken.SLP: {
|
|
210
215
|
mainnetDeployment = slpMainnetJson
|
|
211
216
|
break
|
|
212
|
-
|
|
217
|
+
}
|
|
218
|
+
default: {
|
|
213
219
|
mainnetDeployment = zlpMainnetJson
|
|
220
|
+
}
|
|
214
221
|
}
|
|
215
222
|
return { ...parse(mainnetDeployment) }
|
|
216
223
|
}
|
|
@@ -259,7 +266,7 @@ export function getPriceIdToPythFeeder(network: Network): Record<string, string>
|
|
|
259
266
|
}
|
|
260
267
|
|
|
261
268
|
export function getPythFeederToId(network: string): Record<string, string> {
|
|
262
|
-
|
|
269
|
+
const feederToId: Record<string, string> = {}
|
|
263
270
|
|
|
264
271
|
// Iterate through all LP tokens to collect feeder data
|
|
265
272
|
const lpTokens = [LPToken.ZLP, LPToken.SLP, LPToken.USDZ]
|
|
@@ -267,7 +274,7 @@ export function getPythFeederToId(network: string): Record<string, string> {
|
|
|
267
274
|
for (const lpToken of lpTokens) {
|
|
268
275
|
const consts = getConsts(network, lpToken)
|
|
269
276
|
for (const key in consts.pythFeeder.feeder) {
|
|
270
|
-
if (Object.
|
|
277
|
+
if (Object.hasOwn(consts.pythFeeder.feeder, key)) {
|
|
271
278
|
const contract = consts.pythFeeder.feeder[key]
|
|
272
279
|
feederToId[contract] = key
|
|
273
280
|
}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
+
/* eslint-disable unicorn/empty-brace-spaces */
|
|
1
2
|
/**
|
|
2
3
|
* SDK Factory for creating appropriate SDK instances based on LP token type
|
|
3
4
|
* This is the main entry point for the re-architected SDK system
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import type { SuiClient } from '@mysten/sui/client'
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
import type { LPToken, Network } from '../consts'
|
|
8
10
|
import { LPToken as LPTokenEnum } from '../consts'
|
|
11
|
+
// Import concrete implementations
|
|
12
|
+
import {
|
|
13
|
+
SLPAPI,
|
|
14
|
+
SLPDataAPI,
|
|
15
|
+
USDZAPI,
|
|
16
|
+
USDZDataAPI,
|
|
17
|
+
ZLPAPI,
|
|
18
|
+
ZLPDataAPI,
|
|
19
|
+
} from '../implementations'
|
|
9
20
|
import type {
|
|
10
|
-
IBaseDataAPI,
|
|
11
21
|
IBaseAPI,
|
|
22
|
+
IBaseDataAPI,
|
|
12
23
|
ISDKFactory,
|
|
13
|
-
IZLPDataAPI,
|
|
14
|
-
IZLPAPI,
|
|
15
|
-
ISLPDataAPI,
|
|
16
24
|
ISLPAPI,
|
|
25
|
+
ISLPDataAPI,
|
|
26
|
+
IUSDZAPI,
|
|
17
27
|
IUSDZDataAPI,
|
|
18
|
-
|
|
28
|
+
IZLPAPI,
|
|
29
|
+
IZLPDataAPI,
|
|
19
30
|
} from '../interfaces'
|
|
20
31
|
|
|
21
|
-
// Import concrete implementations
|
|
22
|
-
import {
|
|
23
|
-
ZLPDataAPI,
|
|
24
|
-
ZLPAPI,
|
|
25
|
-
SLPDataAPI,
|
|
26
|
-
SLPAPI,
|
|
27
|
-
USDZDataAPI,
|
|
28
|
-
USDZAPI
|
|
29
|
-
} from '../implementations'
|
|
30
|
-
|
|
31
32
|
export class SDKFactory implements ISDKFactory {
|
|
32
33
|
private static instance: SDKFactory
|
|
33
34
|
|
|
@@ -61,26 +62,30 @@ export class SDKFactory implements ISDKFactory {
|
|
|
61
62
|
provider: SuiClient,
|
|
62
63
|
apiEndpoint: string,
|
|
63
64
|
connectionURL: string,
|
|
64
|
-
lpToken: LPToken
|
|
65
|
+
lpToken: LPToken,
|
|
65
66
|
): IBaseDataAPI {
|
|
66
67
|
switch (lpToken) {
|
|
67
|
-
case LPTokenEnum.ZLP:
|
|
68
|
+
case LPTokenEnum.ZLP: {
|
|
68
69
|
if (!this.zlpDataAPIInstance) {
|
|
69
70
|
this.zlpDataAPIInstance = new ZLPDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
70
71
|
}
|
|
71
72
|
return this.zlpDataAPIInstance
|
|
72
|
-
|
|
73
|
+
}
|
|
74
|
+
case LPTokenEnum.SLP: {
|
|
73
75
|
if (!this.slpDataAPIInstance) {
|
|
74
76
|
this.slpDataAPIInstance = new SLPDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
75
77
|
}
|
|
76
78
|
return this.slpDataAPIInstance
|
|
77
|
-
|
|
79
|
+
}
|
|
80
|
+
case LPTokenEnum.USDZ: {
|
|
78
81
|
if (!this.usdzDataAPIInstance) {
|
|
79
82
|
this.usdzDataAPIInstance = new USDZDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
80
83
|
}
|
|
81
84
|
return this.usdzDataAPIInstance
|
|
82
|
-
|
|
85
|
+
}
|
|
86
|
+
default: {
|
|
83
87
|
throw new Error(`Unsupported LP token type: ${lpToken}`)
|
|
88
|
+
}
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
|
|
@@ -92,26 +97,30 @@ export class SDKFactory implements ISDKFactory {
|
|
|
92
97
|
provider: SuiClient,
|
|
93
98
|
apiEndpoint: string,
|
|
94
99
|
connectionURL: string,
|
|
95
|
-
lpToken: LPToken
|
|
100
|
+
lpToken: LPToken,
|
|
96
101
|
): IBaseAPI {
|
|
97
102
|
switch (lpToken) {
|
|
98
|
-
case LPTokenEnum.ZLP:
|
|
103
|
+
case LPTokenEnum.ZLP: {
|
|
99
104
|
if (!this.zlpAPIInstance) {
|
|
100
105
|
this.zlpAPIInstance = new ZLPAPI(network, provider, apiEndpoint, connectionURL)
|
|
101
106
|
}
|
|
102
107
|
return this.zlpAPIInstance
|
|
103
|
-
|
|
108
|
+
}
|
|
109
|
+
case LPTokenEnum.SLP: {
|
|
104
110
|
if (!this.slpAPIInstance) {
|
|
105
111
|
this.slpAPIInstance = new SLPAPI(network, provider, apiEndpoint, connectionURL)
|
|
106
112
|
}
|
|
107
113
|
return this.slpAPIInstance
|
|
108
|
-
|
|
114
|
+
}
|
|
115
|
+
case LPTokenEnum.USDZ: {
|
|
109
116
|
if (!this.usdzAPIInstance) {
|
|
110
117
|
this.usdzAPIInstance = new USDZAPI(network, provider, apiEndpoint, connectionURL)
|
|
111
118
|
}
|
|
112
119
|
return this.usdzAPIInstance
|
|
113
|
-
|
|
120
|
+
}
|
|
121
|
+
default: {
|
|
114
122
|
throw new Error(`Unsupported LP token type: ${lpToken}`)
|
|
123
|
+
}
|
|
115
124
|
}
|
|
116
125
|
}
|
|
117
126
|
|
|
@@ -122,7 +131,7 @@ export class SDKFactory implements ISDKFactory {
|
|
|
122
131
|
network: Network,
|
|
123
132
|
provider: SuiClient,
|
|
124
133
|
apiEndpoint: string,
|
|
125
|
-
connectionURL: string
|
|
134
|
+
connectionURL: string,
|
|
126
135
|
): IZLPDataAPI {
|
|
127
136
|
if (!this.zlpDataAPIInstance) {
|
|
128
137
|
this.zlpDataAPIInstance = new ZLPDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
@@ -137,7 +146,7 @@ export class SDKFactory implements ISDKFactory {
|
|
|
137
146
|
network: Network,
|
|
138
147
|
provider: SuiClient,
|
|
139
148
|
apiEndpoint: string,
|
|
140
|
-
connectionURL: string
|
|
149
|
+
connectionURL: string,
|
|
141
150
|
): IZLPAPI {
|
|
142
151
|
if (!this.zlpAPIInstance) {
|
|
143
152
|
this.zlpAPIInstance = new ZLPAPI(network, provider, apiEndpoint, connectionURL)
|
|
@@ -152,7 +161,7 @@ export class SDKFactory implements ISDKFactory {
|
|
|
152
161
|
network: Network,
|
|
153
162
|
provider: SuiClient,
|
|
154
163
|
apiEndpoint: string,
|
|
155
|
-
connectionURL: string
|
|
164
|
+
connectionURL: string,
|
|
156
165
|
): ISLPDataAPI {
|
|
157
166
|
if (!this.slpDataAPIInstance) {
|
|
158
167
|
this.slpDataAPIInstance = new SLPDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
@@ -167,7 +176,7 @@ export class SDKFactory implements ISDKFactory {
|
|
|
167
176
|
network: Network,
|
|
168
177
|
provider: SuiClient,
|
|
169
178
|
apiEndpoint: string,
|
|
170
|
-
connectionURL: string
|
|
179
|
+
connectionURL: string,
|
|
171
180
|
): ISLPAPI {
|
|
172
181
|
if (!this.slpAPIInstance) {
|
|
173
182
|
this.slpAPIInstance = new SLPAPI(network, provider, apiEndpoint, connectionURL)
|
|
@@ -182,7 +191,7 @@ export class SDKFactory implements ISDKFactory {
|
|
|
182
191
|
network: Network,
|
|
183
192
|
provider: SuiClient,
|
|
184
193
|
apiEndpoint: string,
|
|
185
|
-
connectionURL: string
|
|
194
|
+
connectionURL: string,
|
|
186
195
|
): IUSDZDataAPI {
|
|
187
196
|
if (!this.usdzDataAPIInstance) {
|
|
188
197
|
this.usdzDataAPIInstance = new USDZDataAPI(network, provider, apiEndpoint, connectionURL)
|
|
@@ -197,7 +206,7 @@ export class SDKFactory implements ISDKFactory {
|
|
|
197
206
|
network: Network,
|
|
198
207
|
provider: SuiClient,
|
|
199
208
|
apiEndpoint: string,
|
|
200
|
-
connectionURL: string
|
|
209
|
+
connectionURL: string,
|
|
201
210
|
): IUSDZAPI {
|
|
202
211
|
if (!this.usdzAPIInstance) {
|
|
203
212
|
this.usdzAPIInstance = new USDZAPI(network, provider, apiEndpoint, connectionURL)
|
|
@@ -208,14 +217,14 @@ export class SDKFactory implements ISDKFactory {
|
|
|
208
217
|
/**
|
|
209
218
|
* Validates if a given LP token is supported
|
|
210
219
|
*/
|
|
211
|
-
public isLPTokenSupported(lpToken: string): lpToken is LPToken {
|
|
220
|
+
public static isLPTokenSupported(lpToken: string): lpToken is LPToken {
|
|
212
221
|
return Object.values(LPTokenEnum).includes(lpToken as LPToken)
|
|
213
222
|
}
|
|
214
223
|
|
|
215
224
|
/**
|
|
216
225
|
* Gets all supported LP token types
|
|
217
226
|
*/
|
|
218
|
-
public getSupportedLPTokens(): LPToken[] {
|
|
227
|
+
public static getSupportedLPTokens(): LPToken[] {
|
|
219
228
|
return Object.values(LPTokenEnum)
|
|
220
229
|
}
|
|
221
230
|
|
|
@@ -241,9 +250,9 @@ export class SDKFactory implements ISDKFactory {
|
|
|
241
250
|
provider: SuiClient,
|
|
242
251
|
apiEndpoint: string,
|
|
243
252
|
connectionURL: string,
|
|
244
|
-
includeTrading = true
|
|
253
|
+
includeTrading = true,
|
|
245
254
|
): IBaseDataAPI | IBaseAPI {
|
|
246
|
-
if (!
|
|
255
|
+
if (!SDKFactory.isLPTokenSupported(lpTokenString)) {
|
|
247
256
|
throw new Error(`Unsupported LP token: ${lpTokenString}`)
|
|
248
257
|
}
|
|
249
258
|
|
|
@@ -251,9 +260,8 @@ export class SDKFactory implements ISDKFactory {
|
|
|
251
260
|
|
|
252
261
|
if (includeTrading) {
|
|
253
262
|
return this.createAPI(network, provider, apiEndpoint, connectionURL, lpToken)
|
|
254
|
-
} else {
|
|
255
|
-
return this.createDataAPI(network, provider, apiEndpoint, connectionURL, lpToken)
|
|
256
263
|
}
|
|
264
|
+
return this.createDataAPI(network, provider, apiEndpoint, connectionURL, lpToken)
|
|
257
265
|
}
|
|
258
266
|
}
|
|
259
267
|
|
|
@@ -263,7 +271,7 @@ export function createDataAPI(
|
|
|
263
271
|
provider: SuiClient,
|
|
264
272
|
apiEndpoint: string,
|
|
265
273
|
connectionURL: string,
|
|
266
|
-
lpToken: LPToken
|
|
274
|
+
lpToken: LPToken,
|
|
267
275
|
): IBaseDataAPI {
|
|
268
276
|
return SDKFactory.getInstance().createDataAPI(network, provider, apiEndpoint, connectionURL, lpToken)
|
|
269
277
|
}
|
|
@@ -273,10 +281,10 @@ export function createAPI(
|
|
|
273
281
|
provider: SuiClient,
|
|
274
282
|
apiEndpoint: string,
|
|
275
283
|
connectionURL: string,
|
|
276
|
-
lpToken: LPToken
|
|
284
|
+
lpToken: LPToken,
|
|
277
285
|
): IBaseAPI {
|
|
278
286
|
return SDKFactory.getInstance().createAPI(network, provider, apiEndpoint, connectionURL, lpToken)
|
|
279
287
|
}
|
|
280
288
|
|
|
281
289
|
// Export the singleton instance for direct use
|
|
282
|
-
export const sdkFactory = SDKFactory.getInstance()
|
|
290
|
+
export const sdkFactory = SDKFactory.getInstance()
|