@cetusprotocol/aggregator-sdk 0.4.0 → 0.4.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.
Files changed (102) hide show
  1. package/README.md +19 -8
  2. package/dist/index.d.mts +14 -3
  3. package/dist/index.d.ts +14 -3
  4. package/dist/index.js +25 -27
  5. package/dist/index.mjs +26 -28
  6. package/package.json +1 -1
  7. package/dist/src/api.d.ts +0 -104
  8. package/dist/src/client.d.ts +0 -107
  9. package/dist/src/const.d.ts +0 -8
  10. package/dist/src/errors.d.ts +0 -40
  11. package/dist/src/index.d.ts +0 -9
  12. package/dist/src/math.d.ts +0 -6
  13. package/dist/src/transaction/afsui.d.ts +0 -10
  14. package/dist/src/transaction/aftermath.d.ts +0 -13
  15. package/dist/src/transaction/alphafi.d.ts +0 -7
  16. package/dist/src/transaction/bluefin.d.ts +0 -7
  17. package/dist/src/transaction/bluemove.d.ts +0 -7
  18. package/dist/src/transaction/cetus.d.ts +0 -15
  19. package/dist/src/transaction/deepbook_v2.d.ts +0 -14
  20. package/dist/src/transaction/deepbook_v3.d.ts +0 -12
  21. package/dist/src/transaction/flowx_v2.d.ts +0 -7
  22. package/dist/src/transaction/flowx_v3.d.ts +0 -8
  23. package/dist/src/transaction/haedal.d.ts +0 -6
  24. package/dist/src/transaction/haedal_pmm.d.ts +0 -7
  25. package/dist/src/transaction/index.d.ts +0 -10
  26. package/dist/src/transaction/kriya_v2.d.ts +0 -6
  27. package/dist/src/transaction/kriya_v3.d.ts +0 -7
  28. package/dist/src/transaction/metastable.d.ts +0 -8
  29. package/dist/src/transaction/obric.d.ts +0 -8
  30. package/dist/src/transaction/scallop.d.ts +0 -8
  31. package/dist/src/transaction/steamm.d.ts +0 -6
  32. package/dist/src/transaction/suilend.d.ts +0 -7
  33. package/dist/src/transaction/swap.d.ts +0 -4
  34. package/dist/src/transaction/turbos.d.ts +0 -7
  35. package/dist/src/transaction/volo.d.ts +0 -8
  36. package/dist/src/types/CoinAssist.d.ts +0 -122
  37. package/dist/src/types/sui.d.ts +0 -112
  38. package/dist/src/utils/api.d.ts +0 -1
  39. package/dist/src/utils/coin.d.ts +0 -11
  40. package/dist/src/utils/contracts.d.ts +0 -16
  41. package/dist/src/utils/index.d.ts +0 -5
  42. package/dist/src/utils/msafe.d.ts +0 -2
  43. package/dist/src/utils/transaction.d.ts +0 -3
  44. package/dist/tests/math.test.d.ts +0 -1
  45. package/dist/tests/router/metastable.test.d.ts +0 -2
  46. package/dist/tests/router/obric.test.d.ts +0 -2
  47. package/dist/tests/router/scallop.test.d.ts +0 -2
  48. package/dist/tests/router/steamm.test.d.ts +0 -2
  49. package/dist/tests/router.test.d.ts +0 -2
  50. package/dist/tests/test_data.test.d.ts +0 -18
  51. package/dist/tests/wallet.test.d.ts +0 -1
  52. package/example/package.json +0 -17
  53. package/example/swap.ts +0 -21
  54. package/example/tsconfig.json +0 -12
  55. package/jest.config.mjs +0 -13
  56. package/src/api.ts +0 -320
  57. package/src/client.ts +0 -1081
  58. package/src/const.ts +0 -15
  59. package/src/errors.ts +0 -77
  60. package/src/index.ts +0 -10
  61. package/src/math.ts +0 -66
  62. package/src/transaction/afsui.ts +0 -62
  63. package/src/transaction/aftermath.ts +0 -88
  64. package/src/transaction/alphafi.ts +0 -50
  65. package/src/transaction/bluefin.ts +0 -46
  66. package/src/transaction/bluemove.ts +0 -42
  67. package/src/transaction/cetus.ts +0 -118
  68. package/src/transaction/deepbook_v2.ts +0 -122
  69. package/src/transaction/deepbook_v3.ts +0 -60
  70. package/src/transaction/flowx_v2.ts +0 -42
  71. package/src/transaction/flowx_v3.ts +0 -52
  72. package/src/transaction/haedal.ts +0 -33
  73. package/src/transaction/haedal_pmm.ts +0 -80
  74. package/src/transaction/index.ts +0 -42
  75. package/src/transaction/kriya_v2.ts +0 -37
  76. package/src/transaction/kriya_v3.ts +0 -47
  77. package/src/transaction/metastable.ts +0 -141
  78. package/src/transaction/obric.ts +0 -90
  79. package/src/transaction/scallop.ts +0 -64
  80. package/src/transaction/steamm.ts +0 -77
  81. package/src/transaction/suilend.ts +0 -48
  82. package/src/transaction/swap.ts +0 -162
  83. package/src/transaction/turbos.ts +0 -56
  84. package/src/transaction/volo.ts +0 -53
  85. package/src/types/CoinAssist.ts +0 -217
  86. package/src/types/sui.ts +0 -148
  87. package/src/utils/api.ts +0 -6
  88. package/src/utils/coin.ts +0 -136
  89. package/src/utils/contracts.ts +0 -136
  90. package/src/utils/index.ts +0 -5
  91. package/src/utils/msafe.ts +0 -40
  92. package/src/utils/transaction.ts +0 -20
  93. package/tests/math.test.ts +0 -21
  94. package/tests/router/metastable.test.ts +0 -377
  95. package/tests/router/obric.test.ts +0 -197
  96. package/tests/router/scallop.test.ts +0 -127
  97. package/tests/router/steamm.test.ts +0 -124
  98. package/tests/router.test.ts +0 -373
  99. package/tests/test_data.test.ts +0 -28
  100. package/tests/wallet.test.ts +0 -21
  101. package/tsup.config.ts +0 -23
  102. package/version.mjs +0 -28
@@ -1,124 +0,0 @@
1
- import { describe, test } from "@jest/globals"
2
- import dotenv from "dotenv"
3
- import { AggregatorClient } from "~/client"
4
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"
5
- import { printTransaction } from "~/utils/transaction"
6
- import BN from "bn.js"
7
- import { fromB64 } from "@mysten/sui/utils"
8
- import { SuiClient } from "@mysten/sui/client"
9
- import { Env } from "~/index"
10
- import { Transaction } from "@mysten/sui/transactions"
11
-
12
- dotenv.config()
13
-
14
- export function buildTestAccount(): Ed25519Keypair {
15
- const mnemonics = process.env.SUI_WALLET_MNEMONICS || ""
16
- const testAccountObject = Ed25519Keypair.deriveKeypair(mnemonics)
17
- return testAccountObject
18
- }
19
-
20
- describe("Test steammfe module", () => {
21
- let client: AggregatorClient
22
- let keypair: Ed25519Keypair
23
-
24
- const T_SUI = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
25
- const T_USDC = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
26
-
27
- beforeAll(() => {
28
- const fullNodeURL = process.env.SUI_RPC!
29
- const aggregatorURL = process.env.CETUS_AGGREGATOR!
30
- const secret = process.env.SUI_WALLET_SECRET!
31
-
32
- if (secret) {
33
- keypair = Ed25519Keypair.fromSecretKey(fromB64(secret).slice(1, 33))
34
- } else {
35
- keypair = buildTestAccount()
36
- }
37
-
38
- const wallet = keypair.getPublicKey().toSuiAddress()
39
- // const wallet =
40
- // "0xb0deeb083fb5738e2d76820a3e59a284adbd56ab1b1d71d606cda8ea71cffe90"
41
-
42
- console.log("wallet: ", wallet)
43
-
44
- const endpoint = aggregatorURL
45
-
46
- const suiClient = new SuiClient({
47
- url: fullNodeURL,
48
- })
49
-
50
- client = new AggregatorClient(endpoint, wallet, suiClient, Env.Mainnet)
51
- })
52
-
53
- test("Find Routers", async () => {
54
- const amounts = ["1000", "1000000", "100000000", "5000000000", "10000000000000"]
55
-
56
- for (const amount of amounts) {
57
- const res = await client.findRouters({
58
- from: T_USDC,
59
- target: T_SUI,
60
- amount: new BN(amount),
61
- byAmountIn: true,
62
- depth: 3,
63
- splitCount: 1,
64
- providers: ["STEAMMFE"],
65
- })
66
-
67
- if (res != null) {
68
- console.log(JSON.stringify(res, null, 2))
69
- }
70
- console.log("amount in", res?.amountIn.toString())
71
- console.log("amount out", res?.amountOut.toString())
72
- }
73
- })
74
-
75
- test("Build Router TX", async () => {
76
- const amount = "10000000"
77
-
78
- const res = await client.findRouters({
79
- from: T_USDC,
80
- target: T_SUI,
81
- amount: new BN(amount),
82
- byAmountIn: true,
83
- depth: 3,
84
- providers: ["STEAMM"],
85
- })
86
-
87
- console.log("amount in", res?.amountIn.toString())
88
- console.log("amount out", res?.amountOut.toString())
89
-
90
- const txb = new Transaction()
91
-
92
- if (res != null) {
93
- console.log(JSON.stringify(res, null, 2))
94
- await client.fastRouterSwap({
95
- routers: res,
96
- txb,
97
- slippage: 0.01,
98
- refreshAllCoins: true,
99
- payDeepFeeAmount: 0,
100
- })
101
-
102
- txb.setSender(client.signer)
103
- const buildTxb = await txb.build({ client: client.client })
104
- // const buildTxb = await txb.getData()
105
-
106
- console.log("buildTxb", buildTxb)
107
-
108
- printTransaction(txb)
109
-
110
- let result = await client.devInspectTransactionBlock(txb)
111
- console.log("🚀 ~ file: router.test.ts:180 ~ test ~ result:", result)
112
- for (const event of result.events) {
113
- console.log("event", JSON.stringify(event, null, 2))
114
- }
115
-
116
- if (result.effects.status.status === "success") {
117
- const result = await client.signAndExecuteTransaction(txb, keypair)
118
- console.log("result", result)
119
- } else {
120
- console.log("result", result)
121
- }
122
- }
123
- }, 600000)
124
- })
@@ -1,373 +0,0 @@
1
- import { describe, test } from "@jest/globals"
2
- import dotenv from "dotenv"
3
- import { AggregatorClient } from "~/client"
4
- import * as testData from "./test_data.test"
5
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"
6
- import { printTransaction } from "~/utils/transaction"
7
- import BN from "bn.js"
8
- import { fromB64 } from "@mysten/sui/utils"
9
- import { SuiClient } from "@mysten/sui/client"
10
- import { Env } from "~/index"
11
- import { Transaction } from "@mysten/sui/transactions"
12
-
13
- dotenv.config()
14
-
15
- export function buildTestAccount(): Ed25519Keypair {
16
- const mnemonics = process.env.SUI_WALLET_MNEMONICS || ""
17
- const testAccountObject = Ed25519Keypair.deriveKeypair(mnemonics)
18
- return testAccountObject
19
- }
20
-
21
- describe("router module", () => {
22
- let client: AggregatorClient
23
- let keypair: Ed25519Keypair
24
-
25
- beforeAll(() => {
26
- const fullNodeURL = process.env.SUI_RPC!
27
- const aggregatorURL = process.env.CETUS_AGGREGATOR!
28
- const secret = process.env.SUI_WALLET_SECRET!
29
-
30
- if (secret) {
31
- keypair = Ed25519Keypair.fromSecretKey(fromB64(secret).slice(1, 33))
32
- } else {
33
- keypair = buildTestAccount()
34
- }
35
-
36
- const wallet = keypair.getPublicKey().toSuiAddress()
37
-
38
- console.log("wallet: ", wallet)
39
-
40
- const endpoint = aggregatorURL
41
-
42
- const suiClient = new SuiClient({
43
- url: fullNodeURL,
44
- })
45
-
46
- client = new AggregatorClient(endpoint, wallet, suiClient, Env.Mainnet)
47
- })
48
-
49
- test("Get coins", () => {
50
- return client.getCoins(testData.M_USDC).then((coins) => {
51
- console.log(coins)
52
- })
53
- })
54
-
55
- test("Downgrade swap in route", async () => {
56
- const amount = 1000000
57
- const byAmountIn = true
58
-
59
- const res: any = await client.swapInPools({
60
- from: testData.M_SUI,
61
- target: testData.M_USDC,
62
- amount: new BN(amount),
63
- byAmountIn,
64
- pools: [
65
- "0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105",
66
- ],
67
- })
68
-
69
- if (res != null) {
70
- console.log(JSON.stringify(res, null, 2))
71
-
72
- console.log("amount in", res.routeData.amountIn.toString())
73
- console.log("amount out", res.routeData.amountOut.toString())
74
-
75
- const txb = new Transaction()
76
- await client.fastRouterSwap({
77
- routers: res.routeData.routes,
78
- byAmountIn,
79
- txb,
80
- slippage: 0.01,
81
- refreshAllCoins: true,
82
- })
83
-
84
- printTransaction(txb)
85
-
86
- let result = await client.devInspectTransactionBlock(txb)
87
- console.log("🚀 ~ file: router.test.ts:114 ~ test ~ result:", result)
88
- }
89
- }, 60000)
90
-
91
- test("Find router", async () => {
92
- const amount = "4239267610000000000"
93
- const res = await client.findRouters({
94
- from: testData.M_SUI,
95
- target: testData.M_USDC,
96
- amount: new BN(amount),
97
- byAmountIn: true,
98
- depth: 3,
99
- splitCount: 1,
100
- providers: ["CETUS"],
101
- })
102
-
103
- if (res != null) {
104
- console.log(JSON.stringify(res, null, 2))
105
- }
106
- console.log("amount in", res?.amountIn.toString())
107
- console.log("amount out", res?.amountOut.toString())
108
- })
109
-
110
- test("Build router tx", async () => {
111
- const byAmountIn = true
112
- const amount = "100000"
113
- const from =
114
- "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
115
- const target = "0x2::sui::SUI"
116
-
117
- const res = await client.findRouters({
118
- from,
119
- target,
120
- amount: new BN(amount),
121
- byAmountIn,
122
- depth: 3,
123
- providers: ["CETUS"],
124
- splitCount: 1,
125
- })
126
-
127
- if (res != null) {
128
- console.log(JSON.stringify(res, null, 2))
129
- }
130
-
131
- console.log("amount in", res?.amountIn.toString())
132
- console.log("amount out", res?.amountOut.toString())
133
-
134
- const txb = new Transaction()
135
-
136
- if (res != null) {
137
- console.log(JSON.stringify(res, null, 2))
138
- await client.fastRouterSwap({
139
- routers: res,
140
- txb,
141
- slippage: 0.01,
142
- refreshAllCoins: true,
143
- payDeepFeeAmount: 0,
144
- })
145
-
146
- printTransaction(txb)
147
-
148
- let result = await client.devInspectTransactionBlock(txb)
149
- console.log("🚀 ~ file: router.test.ts:180 ~ test ~ result:", result)
150
- for (const event of result.events) {
151
- console.log("event", JSON.stringify(event, null, 2))
152
- }
153
-
154
- if (result.effects.status.status === "success") {
155
- // console.log("Sim exec transaction success")
156
- const result = await client.signAndExecuteTransaction(txb, keypair)
157
- console.log("result", result)
158
- } else {
159
- console.log("result", result)
160
- }
161
- }
162
- }, 600000)
163
-
164
- test("By amount out", async () => {
165
- const byAmountIn = false
166
- const amount = "10000000000"
167
-
168
- const from = testData.M_USDC
169
- const target = testData.M_SSWP
170
-
171
- const res = await client.findRouters({
172
- from,
173
- target,
174
- amount: new BN(amount),
175
- byAmountIn,
176
- depth: 3,
177
- providers: ["CETUS"],
178
- })
179
-
180
- console.log("amount in", res?.amountIn.toString())
181
- console.log("amount out", res?.amountOut.toString())
182
-
183
- const txb = new Transaction()
184
- if (res != null) {
185
- console.log(JSON.stringify(res, null, 2))
186
- await client.fastRouterSwap({
187
- routers: res.routes,
188
- byAmountIn,
189
- txb,
190
- slippage: 0.02,
191
- refreshAllCoins: true,
192
- })
193
-
194
- printTransaction(txb)
195
-
196
- let result = await client.devInspectTransactionBlock(txb)
197
-
198
- if (result.effects.status.status === "success") {
199
- console.log("Sim exec transaction success")
200
- // const result = await client.signAndExecuteTransaction(txb, keypair)
201
- // console.log("result", result)
202
- } else {
203
- console.log("result", result)
204
- }
205
- }
206
- }, 600000)
207
-
208
- test("Test Multi Input", async () => {
209
- const amounts = [1000000000, 2000000000, 10000000000000]
210
- const froms = [
211
- testData.M_USDC,
212
- testData.M_SUI,
213
- testData.M_CETUS,
214
- testData.M_NAVI,
215
- ]
216
- const tos = [
217
- testData.M_SUI,
218
- testData.M_USDC,
219
- testData.M_USDC,
220
- testData.M_SUI,
221
- ]
222
-
223
- for (let i = 0; i < froms.length; i++) {
224
- const from = froms[i]
225
- const target = tos[i]
226
- for (const amount of amounts) {
227
- for (const byAmountIn of [true, false]) {
228
- console.log({
229
- from,
230
- target,
231
- amount,
232
- byAmountIn,
233
- })
234
-
235
- const res = await client.findRouters({
236
- from,
237
- target,
238
- amount: new BN(amount),
239
- byAmountIn,
240
- })
241
-
242
- const txb = new Transaction()
243
-
244
- if (res != null) {
245
- await client.fastRouterSwap({
246
- routers: res.routes,
247
- byAmountIn,
248
- slippage: 0.01,
249
- txb,
250
- })
251
-
252
- let result = await client.devInspectTransactionBlock(txb)
253
- // console.log('result', result)
254
-
255
- if (result.effects.status.status === "success") {
256
- console.log("Sim exec transaction success")
257
- // const result = await client.signAndExecuteTransaction(routerTx, keypair)
258
- // console.log('result', result)
259
- } else {
260
- console.log("Sim exec transaction failed")
261
- // console.log('result', result)
262
- }
263
- }
264
- }
265
- }
266
- }
267
- }, 60000000)
268
-
269
- test("Build router with liquidity changes", async () => {
270
- const byAmountIn = true
271
- const amount = "1000000000"
272
-
273
- // const from = M_USDC
274
- // const target = M_SUI
275
-
276
- const from = testData.M_SUI
277
- // const target =
278
- // "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
279
- // const target =
280
- // "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI"
281
-
282
- const target = testData.M_HASUI
283
-
284
- const res = await client.findRouters({
285
- from,
286
- target,
287
- amount: new BN(amount),
288
- byAmountIn,
289
- depth: 2,
290
- providers: [
291
- "CETUS",
292
- // "DEEPBOOK",
293
- // "AFTERMATH",
294
- // "FLOWX",
295
- // "KRIYA",
296
- // "KRIYAV3",
297
- // "TURBOS",
298
- // "FLOWXV3",
299
- ],
300
- liquidityChanges: [
301
- {
302
- poolID:
303
- "0x871d8a227114f375170f149f7e9d45be822dd003eba225e83c05ac80828596bc",
304
- ticklower: 100,
305
- tickUpper: 394,
306
- deltaLiquidity: -5498684,
307
- },
308
- {
309
- poolID:
310
- "0x871d8a227114f375170f149f7e9d45be822dd003eba225e83c05ac80828596bc",
311
- ticklower: 100,
312
- tickUpper: 394,
313
- deltaLiquidity: 986489,
314
- },
315
- ],
316
- })
317
-
318
- if (res != null) {
319
- console.log(JSON.stringify(res, null, 2))
320
- }
321
-
322
- const txb = new Transaction()
323
-
324
- if (res != null) {
325
- console.log(JSON.stringify(res, null, 2))
326
- await client.fastRouterSwap({
327
- routers: res.routes,
328
- byAmountIn,
329
- txb,
330
- slippage: 0.01,
331
- refreshAllCoins: true,
332
- })
333
-
334
- printTransaction(txb)
335
-
336
- let result = await client.devInspectTransactionBlock(txb)
337
- console.log("🚀 ~ file: router.test.ts:180 ~ test ~ result:", result)
338
-
339
- // if (result.effects.status.status === "success") {
340
- // console.log("Sim exec transaction success")
341
- // const result = await client.signAndExecuteTransaction(txb, keypair)
342
- // // console.log("result", result)
343
- // } else {
344
- // console.log("result", result)
345
- // }
346
- }
347
- }, 600000)
348
-
349
- test("Get deepbook v3 config", async () => {
350
- const config = await client.getDeepbookV3Config()
351
- console.log("config", config)
352
- }, 60000)
353
-
354
- test("Find router", async () => {
355
- const amount = "4239267610000000000"
356
- const res = await client.findRouters({
357
- from: "0x2::sui::SUI",
358
- target:
359
- "0x188c6239bda71ba5751990cc0271e91b6362c67bccf7aa381e018db7fe39c6d7::BUILD::BUILD",
360
- amount: new BN(amount),
361
- byAmountIn: true,
362
- depth: 3,
363
- splitCount: 1,
364
- providers: ["CETUS"],
365
- })
366
-
367
- if (res != null) {
368
- console.log(JSON.stringify(res, null, 2))
369
- }
370
- console.log("amount in", res?.amountIn.toString())
371
- console.log("amount out", res?.amountOut.toString())
372
- })
373
- })
@@ -1,28 +0,0 @@
1
- // Testnet
2
- export const T_USDC = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdc::USDC"
3
- export const T_USDT = "0x26b3bc67befc214058ca78ea9a2690298d731a2d4309485ec3d40198063c4abc::usdt::USDT"
4
- export const T_DEEP = "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"
5
- export const T_DBUSDC = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC"
6
- export const T_DBUSDT = "0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT"
7
-
8
- // Mainnet
9
- export const M_USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
10
- export const M_wUSDC =
11
- "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
12
- export const M_CETUS =
13
- "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS"
14
- export const M_NAVI =
15
- "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX"
16
- export const M_SUI = "0x2::sui::SUI"
17
- export const M_VSUI =
18
- "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
19
- export const M_VAPOR =
20
- "0xa1f2c11169f32165ad4efb4468ec5bdfc880cd66b22094024b32ab7b76d14d30::vapor::VAPOR"
21
- export const M_HASUI =
22
- "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI"
23
- export const M_SSWP =
24
- "0x361dd589b98e8fcda9a7ee53b85efabef3569d00416640d2faa516e3801d7ffc::TOKEN::TOKEN"
25
- export const M_MICHI = "0x50d796fde5709a97883e29e00bf511d66f2656de958ea0c2ce4c1147cdd20a23::MICHI::MICHI"
26
- export const M_SSUI = "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI"
27
- export const M_SHaSUI = "0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI"
28
- export const M_ETH = "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH"
@@ -1,21 +0,0 @@
1
- import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519"
2
-
3
- describe("router module", () => {
4
- const keystoreSecret = [
5
- "0xd36441c734b1967dd4e65956d0b3e7e5dccc8c92306ad71419e6741b4a7ce6c9",
6
- ]
7
-
8
- test("Parse public key", () => {
9
- for (const secret of keystoreSecret) {
10
- const byte = Buffer.from(secret, "base64")
11
- const u8Array = new Uint8Array(byte)
12
- const keypair = Ed25519Keypair.fromSecretKey(u8Array.slice(1, 33))
13
- console.log(
14
- "\nsecret:",
15
- secret,
16
- "\nkeypair public key: ",
17
- keypair.toSuiAddress()
18
- )
19
- }
20
- })
21
- })
package/tsup.config.ts DELETED
@@ -1,23 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
- import { exec } from 'child_process'
3
-
4
- export default defineConfig((options) => ({
5
- entry: {
6
- index: './src/index.ts',
7
- },
8
- format: ['esm', 'cjs'],
9
- dts: false,
10
- clean: !options.watch,
11
- treeshake: true,
12
- splitting: true,
13
- onSuccess: async () => {
14
- exec('tsc --emitDeclarationOnly --declaration', (err, stdout) => {
15
- if (err) {
16
- console.error(stdout)
17
- if (!options.watch) {
18
- process.exit(1)
19
- }
20
- }
21
- })
22
- },
23
- }))
package/version.mjs DELETED
@@ -1,28 +0,0 @@
1
- // Don't sync to github
2
-
3
- import fs from 'fs';
4
-
5
- const packageJsonPath = './package.json';
6
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
7
-
8
- const newVersion = `0.0.0-experimental-${getCurrentDateTimeString()}`;
9
- packageJson.version = newVersion;
10
-
11
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');
12
-
13
- console.log(`Version updated to ${newVersion}`);
14
-
15
- function getCurrentDateTimeString() {
16
- const now = new Date();
17
-
18
- const year = now.getFullYear();
19
- const month = String(now.getMonth() + 1).padStart(2, '0');
20
- const day = String(now.getDate()).padStart(2, '0');
21
- const hours = String(now.getHours()).padStart(2, '0');
22
- const minutes = String(now.getMinutes()).padStart(2, '0');
23
- const seconds = String(now.getSeconds()).padStart(2, '0');
24
-
25
- const dateTimeString = `${year}${month}${day}${hours}${minutes}${seconds}`;
26
-
27
- return dateTimeString;
28
- }