@suilend/sdk 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +1,27 @@
1
- import { BcsType, TypeTag, BcsStruct, BcsEnum, BcsTuple } from '@mysten/sui/bcs';
2
- import { TransactionArgument } from '@mysten/sui/transactions';
3
- import { ClientWithCoreApi, SuiClientTypes } from '@mysten/sui/client';
1
+ import { BcsEnum, BcsStruct, BcsTuple, BcsType, TypeTag } from "@mysten/sui/bcs";
2
+ import { ClientWithCoreApi, SuiClientTypes } from "@mysten/sui/client";
3
+ import { TransactionArgument } from "@mysten/sui/transactions";
4
4
  export type RawTransactionArgument<T> = T | TransactionArgument;
5
- export interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
5
+ export interface GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, "content"> = {}> extends SuiClientTypes.GetObjectOptions<Include> {
6
6
  client: ClientWithCoreApi;
7
7
  }
8
- export interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
8
+ export interface GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, "content"> = {}> extends SuiClientTypes.GetObjectsOptions<Include> {
9
9
  client: ClientWithCoreApi;
10
10
  }
11
11
  export declare function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null;
12
12
  export declare function normalizeMoveArguments(args: unknown[] | object, argTypes: readonly (string | null)[], parameterNames?: string[]): TransactionArgument[];
13
13
  export declare class MoveStruct<T extends Record<string, BcsType<any>>, const Name extends string = string> extends BcsStruct<T, Name> {
14
- get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
14
+ get<Include extends Omit<SuiClientTypes.ObjectInclude, "content" | "json"> = {}>({ objectId, ...options }: GetOptions<Include>): Promise<SuiClientTypes.Object<Include & {
15
15
  content: true;
16
16
  json: true;
17
17
  }> & {
18
- json: BcsStruct<T>['$inferType'];
18
+ json: BcsStruct<T>["$inferType"];
19
19
  }>;
20
- getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
20
+ getMany<Include extends Omit<SuiClientTypes.ObjectInclude, "content" | "json"> = {}>({ client, ...options }: GetManyOptions<Include>): Promise<Array<SuiClientTypes.Object<Include & {
21
21
  content: true;
22
22
  json: true;
23
23
  }> & {
24
- json: BcsStruct<T>['$inferType'];
24
+ json: BcsStruct<T>["$inferType"];
25
25
  }>>;
26
26
  }
27
27
  export declare class MoveEnum<T extends Record<string, BcsType<any> | null>, const Name extends string> extends BcsEnum<T, Name> {
@@ -18,57 +18,60 @@ var __rest = (this && this.__rest) || function (s, e) {
18
18
  }
19
19
  return t;
20
20
  };
21
- import { bcs, TypeTagSerializer, BcsStruct, BcsEnum, BcsTuple, } from '@mysten/sui/bcs';
22
- import { normalizeSuiAddress } from '@mysten/sui/utils';
23
- import { isArgument } from '@mysten/sui/transactions';
24
- const MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');
25
- const SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');
21
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
22
+ import { BcsEnum, BcsStruct, BcsTuple, TypeTagSerializer, bcs, } from "@mysten/sui/bcs";
23
+ import { isArgument } from "@mysten/sui/transactions";
24
+ import { normalizeSuiAddress } from "@mysten/sui/utils";
25
+ const MOVE_STDLIB_ADDRESS = normalizeSuiAddress("0x1");
26
+ const SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress("0x2");
26
27
  export function getPureBcsSchema(typeTag) {
27
- const parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
28
- if ('u8' in parsedTag) {
28
+ const parsedTag = typeof typeTag === "string"
29
+ ? TypeTagSerializer.parseFromStr(typeTag)
30
+ : typeTag;
31
+ if ("u8" in parsedTag) {
29
32
  return bcs.U8;
30
33
  }
31
- else if ('u16' in parsedTag) {
34
+ else if ("u16" in parsedTag) {
32
35
  return bcs.U16;
33
36
  }
34
- else if ('u32' in parsedTag) {
37
+ else if ("u32" in parsedTag) {
35
38
  return bcs.U32;
36
39
  }
37
- else if ('u64' in parsedTag) {
40
+ else if ("u64" in parsedTag) {
38
41
  return bcs.U64;
39
42
  }
40
- else if ('u128' in parsedTag) {
43
+ else if ("u128" in parsedTag) {
41
44
  return bcs.U128;
42
45
  }
43
- else if ('u256' in parsedTag) {
46
+ else if ("u256" in parsedTag) {
44
47
  return bcs.U256;
45
48
  }
46
- else if ('address' in parsedTag) {
49
+ else if ("address" in parsedTag) {
47
50
  return bcs.Address;
48
51
  }
49
- else if ('bool' in parsedTag) {
52
+ else if ("bool" in parsedTag) {
50
53
  return bcs.Bool;
51
54
  }
52
- else if ('vector' in parsedTag) {
55
+ else if ("vector" in parsedTag) {
53
56
  const type = getPureBcsSchema(parsedTag.vector);
54
57
  return type ? bcs.vector(type) : null;
55
58
  }
56
- else if ('struct' in parsedTag) {
59
+ else if ("struct" in parsedTag) {
57
60
  const structTag = parsedTag.struct;
58
61
  const pkg = normalizeSuiAddress(structTag.address);
59
62
  if (pkg === MOVE_STDLIB_ADDRESS) {
60
- if ((structTag.module === 'ascii' || structTag.module === 'string') &&
61
- structTag.name === 'String') {
63
+ if ((structTag.module === "ascii" || structTag.module === "string") &&
64
+ structTag.name === "String") {
62
65
  return bcs.String;
63
66
  }
64
- if (structTag.module === 'option' && structTag.name === 'Option') {
67
+ if (structTag.module === "option" && structTag.name === "Option") {
65
68
  const type = getPureBcsSchema(structTag.typeParams[0]);
66
69
  return type ? bcs.option(type) : null;
67
70
  }
68
71
  }
69
72
  if (pkg === SUI_FRAMEWORK_ADDRESS &&
70
- structTag.module === 'object' &&
71
- (structTag.name === 'ID' || structTag.name === 'UID')) {
73
+ structTag.module === "object" &&
74
+ (structTag.name === "ID" || structTag.name === "UID")) {
72
75
  return bcs.Address;
73
76
  }
74
77
  }
@@ -82,19 +85,19 @@ export function normalizeMoveArguments(args, argTypes, parameterNames) {
82
85
  const normalizedArgs = [];
83
86
  let index = 0;
84
87
  for (const [i, argType] of argTypes.entries()) {
85
- if (argType === '0x2::clock::Clock') {
88
+ if (argType === "0x2::clock::Clock") {
86
89
  normalizedArgs.push((tx) => tx.object.clock());
87
90
  continue;
88
91
  }
89
- if (argType === '0x2::random::Random') {
92
+ if (argType === "0x2::random::Random") {
90
93
  normalizedArgs.push((tx) => tx.object.random());
91
94
  continue;
92
95
  }
93
- if (argType === '0x2::deny_list::DenyList') {
96
+ if (argType === "0x2::deny_list::DenyList") {
94
97
  normalizedArgs.push((tx) => tx.object.denyList());
95
98
  continue;
96
99
  }
97
- if (argType === '0x3::sui_system::SuiSystemState') {
100
+ if (argType === "0x3::sui_system::SuiSystemState") {
98
101
  normalizedArgs.push((tx) => tx.object.system());
99
102
  continue;
100
103
  }
@@ -116,7 +119,7 @@ export function normalizeMoveArguments(args, argTypes, parameterNames) {
116
119
  }
117
120
  }
118
121
  index += 1;
119
- if (typeof arg === 'function' || isArgument(arg)) {
122
+ if (typeof arg === "function" || isArgument(arg)) {
120
123
  normalizedArgs.push(arg);
121
124
  continue;
122
125
  }
@@ -127,7 +130,7 @@ export function normalizeMoveArguments(args, argTypes, parameterNames) {
127
130
  normalizedArgs.push((tx) => tx.pure(bytes));
128
131
  continue;
129
132
  }
130
- else if (typeof arg === 'string') {
133
+ else if (typeof arg === "string") {
131
134
  normalizedArgs.push((tx) => tx.object(arg));
132
135
  continue;
133
136
  }
@@ -161,10 +164,10 @@ export class MoveEnum extends BcsEnum {
161
164
  export class MoveTuple extends BcsTuple {
162
165
  }
163
166
  function stringify(val) {
164
- if (typeof val === 'object') {
167
+ if (typeof val === "object") {
165
168
  return JSON.stringify(val, (val) => val);
166
169
  }
167
- if (typeof val === 'bigint') {
170
+ if (typeof val === "bigint") {
168
171
  return val.toString();
169
172
  }
170
173
  return val;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sdk","version":"3.0.2","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./mmt":"./mmt.js","./strategies":"./strategies.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers/obligation":"./parsers/obligation.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./swap/transaction":"./swap/transaction.js","./swap/quote":"./swap/quote.js","./swap":"./swap/index.js","./utils/simulate":"./utils/simulate.js","./utils/events":"./utils/events.js","./utils/obligation":"./utils/obligation.js","./utils":"./utils/index.js","./lib/constants":"./lib/constants.js","./lib/pythAdapter":"./lib/pythAdapter.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.js","./lib/initialize":"./lib/initialize.js","./lib":"./lib/index.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/strategyOwnerCap":"./lib/strategyOwnerCap.js","./lib/pyth":"./lib/pyth.js","./api/events":"./api/events.js","./api":"./api/index.js","./margin":"./margin/index.js","./margin/utils":"./margin/utils/index.js","./margin/margin/market":"./margin/margin/market.js","./margin/margin/version":"./margin/margin/version.js","./margin/margin/router":"./margin/margin/router.js","./margin/margin/admin_cap":"./margin/margin/admin_cap.js","./margin/margin/permissions":"./margin/margin/permissions.js","./margin/margin/position":"./margin/margin/position.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./margin/margin/deps/sui/vec_set":"./margin/margin/deps/sui/vec_set.js","./margin/margin/deps/std/type_name":"./margin/margin/deps/std/type_name.js","./margin/margin/deps/suilend/lending_market":"./margin/margin/deps/suilend/lending_market.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix src/","prettier":"prettier --write src/","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ./release.js && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/suilend-fe-public.git"},"bugs":{"url":"https://github.com/suilend/suilend-fe-public/issues"},"dependencies":{"@bluefin-exchange/bluefin7k-aggregator-sdk":"^6.0.0","@cetusprotocol/aggregator-sdk":"^1.5.3","@flowx-finance/sdk":"^1.15.0","@suilend/springsui-sdk":"^3.0.1","aftermath-ts-sdk":"^2.0.0","bignumber.js":"^9.1.2","bn.js":"^5.2.2","crypto-js":"^4.2.0","lodash":"^4.17.21","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"@types/bn.js":"^5.2.0","@types/lodash":"^4.17.20","ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"2.0.1","@mysten/sui":"2.15.0","@suilend/sui-fe":"^3.0.1","@pythnetwork/pyth-sui-js":"2.2.0"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1","axios":"<=1.11.0"}}
1
+ {"name":"@suilend/sdk","version":"3.0.4","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./mmt":"./mmt.js","./strategies":"./strategies.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers/obligation":"./parsers/obligation.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./swap/transaction":"./swap/transaction.js","./swap/quote":"./swap/quote.js","./swap":"./swap/index.js","./utils/simulate":"./utils/simulate.js","./utils/events":"./utils/events.js","./utils/obligation":"./utils/obligation.js","./utils":"./utils/index.js","./lib/constants":"./lib/constants.js","./lib/pythAdapter":"./lib/pythAdapter.js","./lib/transactions":"./lib/transactions.js","./lib/types":"./lib/types.js","./lib/initialize":"./lib/initialize.js","./lib":"./lib/index.js","./lib/liquidityMining":"./lib/liquidityMining.js","./lib/strategyOwnerCap":"./lib/strategyOwnerCap.js","./lib/pyth":"./lib/pyth.js","./api/events":"./api/events.js","./api":"./api/index.js","./margin":"./margin/index.js","./margin/utils":"./margin/utils/index.js","./margin/margin/market":"./margin/margin/market.js","./margin/margin/version":"./margin/margin/version.js","./margin/margin/router":"./margin/margin/router.js","./margin/margin/admin_cap":"./margin/margin/admin_cap.js","./margin/margin/permissions":"./margin/margin/permissions.js","./margin/margin/position":"./margin/margin/position.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./margin/margin/deps/sui/vec_set":"./margin/margin/deps/sui/vec_set.js","./margin/margin/deps/std/type_name":"./margin/margin/deps/std/type_name.js","./margin/margin/deps/suilend/lending_market":"./margin/margin/deps/suilend/lending_market.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix src/","prettier":"prettier --write src/","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ./release.js && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/suilend-fe-public.git"},"bugs":{"url":"https://github.com/suilend/suilend-fe-public/issues"},"dependencies":{"@bluefin-exchange/bluefin7k-aggregator-sdk":"^7.3.0","@cetusprotocol/aggregator-sdk":"^1.5.7","@flowx-finance/sdk":"^2.1.0","@suilend/springsui-sdk":"^3.0.4","bignumber.js":"^9.1.2","bn.js":"^5.2.2","crypto-js":"^4.2.0","lodash":"^4.17.21","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"@types/bn.js":"^5.2.0","@types/lodash":"^4.17.20","ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"2.0.1","@mysten/sui":"2.17.0","@suilend/sui-fe":"^3.0.7","@pythnetwork/pyth-sui-js":"2.2.0"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1","axios":"<=1.11.0"}}
package/strategies.js CHANGED
@@ -14,7 +14,7 @@ import BigNumber from "bignumber.js";
14
14
  import { BN } from "bn.js";
15
15
  import { cloneDeep } from "lodash";
16
16
  import { LstClient, SPRING_SUI_UPGRADE_CAP_ID, getLatestPackageId as getLatestSpringSuiPackageId, } from "@suilend/springsui-sdk";
17
- import { API_URL, MAX_U64, MS_PER_YEAR, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, getAllCoins, isSui, mergeAllCoins, } from "@suilend/sui-fe";
17
+ import { API_URL, MAX_U64, MS_PER_YEAR, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, getSpendableCoin, isSui, } from "@suilend/sui-fe";
18
18
  import { getNetAprPercent } from "./lib";
19
19
  import { getRewardsMap } from "./lib/liquidityMining";
20
20
  import { STRATEGY_TYPE_INFO_MAP, StrategyType, strategyBorrow, strategyClaimRewardsAndMergeCoins, strategyDeposit, strategyWithdraw, } from "./lib/strategyOwnerCap";
@@ -48,7 +48,7 @@ export const STRATEGY_TYPE_FLASH_LOAN_OBJ_MAP = {
48
48
  poolId: "0x737ec6a4d3ed0c7e6cc18d8ba04e7ffd4806b726c97efd89867597368c4d06a9", // suiUSDT-USDC 0.001% https://app.mmt.finance/liquidity/0x737ec6a4d3ed0c7e6cc18d8ba04e7ffd4806b726c97efd89867597368c4d06a9
49
49
  coinTypeA: NORMALIZED_suiUSDT_COINTYPE,
50
50
  coinTypeB: NORMALIZED_USDC_COINTYPE,
51
- borrowA: false,
51
+ borrowA: false, // Requires swap from USDT to USDsui
52
52
  feePercent: 0.001,
53
53
  },
54
54
  [StrategyType.eEARN_USDC_LOOPING]: {
@@ -56,7 +56,7 @@ export const STRATEGY_TYPE_FLASH_LOAN_OBJ_MAP = {
56
56
  poolId: "0x737ec6a4d3ed0c7e6cc18d8ba04e7ffd4806b726c97efd89867597368c4d06a9", // suiUSDT-USDC 0.001% https://app.mmt.finance/liquidity/0x737ec6a4d3ed0c7e6cc18d8ba04e7ffd4806b726c97efd89867597368c4d06a9
57
57
  coinTypeA: NORMALIZED_suiUSDT_COINTYPE,
58
58
  coinTypeB: NORMALIZED_USDC_COINTYPE,
59
- borrowA: false,
59
+ borrowA: false, // Requires swap from USDC to eEARN
60
60
  feePercent: 0.001,
61
61
  },
62
62
  [StrategyType.AUSD_sSUI_SUI_LOOPING]: {
@@ -1776,14 +1776,10 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
1776
1776
  // 1.2) LST
1777
1777
  else if (deposit.coinType === ((_c = depositReserves.lst) === null || _c === void 0 ? void 0 : _c.coinType)) {
1778
1778
  // 1.2.1) Split coins
1779
- const allCoinsLst = yield getAllCoins(suiGrpcClient, _address, depositReserves.lst.coinType);
1780
- const mergeCoinLst = mergeAllCoins(depositReserves.lst.coinType, transaction, allCoinsLst);
1781
- const lstCoin = transaction.splitCoins(transaction.object(mergeCoinLst.objectId), [
1782
- BigInt(deposit.depositedAmount
1783
- .times(10 ** LST_DECIMALS)
1784
- .integerValue(BigNumber.ROUND_DOWN)
1785
- .toString()),
1786
- ]);
1779
+ const lstCoin = yield getSpendableCoin(suiGrpcClient, _address, depositReserves.lst.coinType, deposit.depositedAmount
1780
+ .times(10 ** LST_DECIMALS)
1781
+ .integerValue(BigNumber.ROUND_DOWN)
1782
+ .toString(), transaction);
1787
1783
  // 1.2.2) Deposit LST (1x exposure)
1788
1784
  strategyDeposit(strategyType, lstCoin, depositReserves.lst.coinType, strategyOwnerCapId, suilendClient.findReserveArrayIndex(depositReserves.lst.coinType), transaction);
1789
1785
  // 1.2.3) Update state
@@ -1793,14 +1789,10 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
1793
1789
  else {
1794
1790
  const otherReserve = reserveMap[deposit.coinType];
1795
1791
  // 1.3.1) Split coins
1796
- const allCoinsOther = yield getAllCoins(suiGrpcClient, _address, otherReserve.coinType);
1797
- const mergeCoinOther = mergeAllCoins(otherReserve.coinType, transaction, allCoinsOther);
1798
- const otherCoin = transaction.splitCoins(transaction.object(mergeCoinOther.objectId), [
1799
- BigInt(deposit.depositedAmount
1800
- .times(10 ** otherReserve.token.decimals)
1801
- .integerValue(BigNumber.ROUND_DOWN)
1802
- .toString()),
1803
- ]);
1792
+ const otherCoin = yield getSpendableCoin(suiGrpcClient, _address, otherReserve.coinType, deposit.depositedAmount
1793
+ .times(10 ** otherReserve.token.decimals)
1794
+ .integerValue(BigNumber.ROUND_DOWN)
1795
+ .toString(), transaction);
1804
1796
  // 1.3.2) If the deposit coin is the same as the borrow coin, swap to base first
1805
1797
  if (deposit.coinType === borrowReserve.coinType && depositReserve) {
1806
1798
  const routers = yield cetusSdk.findRouters({
@@ -2359,7 +2351,7 @@ export const strategyDepositAdjustWithdrawTx = (
2359
2351
  reserveMap,
2360
2352
  // Strategy
2361
2353
  lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _address, strategyOwnerCapId, obligationId, _deposits, _borrowedAmount, flashLoanBorrowedAmount, transaction, dryRunTransaction) => __awaiter(void 0, void 0, void 0, function* () {
2362
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2354
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
2363
2355
  const strategyInfo = STRATEGY_TYPE_INFO_MAP[strategyType];
2364
2356
  const lst = strategyInfo.depositLstCoinType !== undefined
2365
2357
  ? lstMap[strategyInfo.depositLstCoinType]
@@ -2385,12 +2377,23 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2385
2377
  let borrowedAmount = _borrowedAmount;
2386
2378
  // 1) Flash loan base/LST
2387
2379
  const flashLoanObj = STRATEGY_TYPE_FLASH_LOAN_OBJ_MAP[strategyType];
2388
- if (depositReserve.coinType === ((_b = depositReserves.lst) === null || _b === void 0 ? void 0 : _b.coinType)) {
2380
+ const flashLoanCoinType = flashLoanObj.borrowA
2381
+ ? flashLoanObj.coinTypeA
2382
+ : flashLoanObj.coinTypeB;
2383
+ const flashLoanCoinReserve = (_b = reserveMap[flashLoanCoinType]) !== null && _b !== void 0 ? _b : depositReserve;
2384
+ const needsFlashLoanCoinSwap = flashLoanCoinType !== depositReserve.coinType;
2385
+ if (depositReserve.coinType === ((_c = depositReserves.lst) === null || _c === void 0 ? void 0 : _c.coinType)) {
2389
2386
  // TODO: Account for LST mint fees
2390
2387
  flashLoanBorrowedAmount = flashLoanBorrowedAmount
2391
- .times((_c = lst === null || lst === void 0 ? void 0 : lst.lstToSuiExchangeRate) !== null && _c !== void 0 ? _c : 1)
2388
+ .times((_d = lst === null || lst === void 0 ? void 0 : lst.lstToSuiExchangeRate) !== null && _d !== void 0 ? _d : 1)
2392
2389
  .decimalPlaces(SUI_DECIMALS, BigNumber.ROUND_UP);
2393
2390
  }
2391
+ let flashLoanBorrowAmountForLoan = flashLoanBorrowedAmount;
2392
+ if (needsFlashLoanCoinSwap) {
2393
+ flashLoanBorrowAmountForLoan = flashLoanBorrowAmountForLoan
2394
+ .times(1.01) // Buffer for swap slippage
2395
+ .decimalPlaces(flashLoanCoinReserve.token.decimals, BigNumber.ROUND_UP);
2396
+ }
2394
2397
  let borrowedBalanceA, borrowedBalanceB, receipt;
2395
2398
  if (flashLoanObj.provider === StrategyFlashLoanProvider.MMT) {
2396
2399
  [borrowedBalanceA, borrowedBalanceB, receipt] = transaction.moveCall({
@@ -2399,9 +2402,9 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2399
2402
  arguments: [
2400
2403
  transaction.object(flashLoanObj.poolId),
2401
2404
  transaction.pure.u64(flashLoanObj.borrowA
2402
- ? flashLoanBorrowedAmount
2405
+ ? flashLoanBorrowAmountForLoan
2403
2406
  .times(10 **
2404
- (depositReserve.coinType === ((_d = depositReserves.lst) === null || _d === void 0 ? void 0 : _d.coinType)
2407
+ (depositReserve.coinType === ((_e = depositReserves.lst) === null || _e === void 0 ? void 0 : _e.coinType)
2405
2408
  ? SUI_DECIMALS
2406
2409
  : depositReserve.token.decimals))
2407
2410
  .integerValue(BigNumber.ROUND_DOWN)
@@ -2409,11 +2412,11 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2409
2412
  : 0),
2410
2413
  transaction.pure.u64(flashLoanObj.borrowA
2411
2414
  ? 0
2412
- : flashLoanBorrowedAmount
2415
+ : flashLoanBorrowAmountForLoan
2413
2416
  .times(10 **
2414
- (depositReserve.coinType === ((_e = depositReserves.lst) === null || _e === void 0 ? void 0 : _e.coinType)
2417
+ (depositReserve.coinType === ((_f = depositReserves.lst) === null || _f === void 0 ? void 0 : _f.coinType)
2415
2418
  ? SUI_DECIMALS
2416
- : depositReserve.token.decimals))
2419
+ : flashLoanCoinReserve.token.decimals))
2417
2420
  .integerValue(BigNumber.ROUND_DOWN)
2418
2421
  .toString()),
2419
2422
  transaction.object(MMT_VERSION_OBJECT_ID),
@@ -2426,9 +2429,9 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2426
2429
  // 2) Deposit additional (to get back up to 100% health, so the user can then unloop back down to the max leverage shown in the UI)
2427
2430
  // 2.1) Deposit
2428
2431
  let depositedAmount = flashLoanBorrowedAmount;
2429
- if (depositReserve.coinType === ((_f = depositReserves.lst) === null || _f === void 0 ? void 0 : _f.coinType))
2432
+ if (depositReserve.coinType === ((_g = depositReserves.lst) === null || _g === void 0 ? void 0 : _g.coinType))
2430
2433
  depositedAmount = new BigNumber(depositedAmount.minus(getStrategyLstMintFee(lstMap, depositReserve.coinType, depositedAmount)))
2431
- .times((_g = lst === null || lst === void 0 ? void 0 : lst.suiToLstExchangeRate) !== null && _g !== void 0 ? _g : 1)
2434
+ .times((_h = lst === null || lst === void 0 ? void 0 : lst.suiToLstExchangeRate) !== null && _h !== void 0 ? _h : 1)
2432
2435
  .decimalPlaces(depositReserve.token.decimals, BigNumber.ROUND_DOWN);
2433
2436
  let flashLoanBorrowedCoin = transaction.moveCall({
2434
2437
  target: "0x2::coin::from_balance",
@@ -2437,8 +2440,34 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2437
2440
  ],
2438
2441
  arguments: [flashLoanObj.borrowA ? borrowedBalanceA : borrowedBalanceB],
2439
2442
  });
2440
- if (depositReserve.coinType === ((_h = depositReserves.lst) === null || _h === void 0 ? void 0 : _h.coinType))
2443
+ if (depositReserve.coinType === ((_j = depositReserves.lst) === null || _j === void 0 ? void 0 : _j.coinType))
2441
2444
  flashLoanBorrowedCoin = lst.client.mint(transaction, flashLoanBorrowedCoin);
2445
+ if (needsFlashLoanCoinSwap) {
2446
+ const depositRouters = yield cetusSdk.findRouters({
2447
+ from: flashLoanCoinType,
2448
+ target: depositReserve.coinType,
2449
+ amount: new BN(flashLoanBorrowAmountForLoan
2450
+ .times(10 ** flashLoanCoinReserve.token.decimals)
2451
+ .integerValue(BigNumber.ROUND_DOWN)
2452
+ .toString()),
2453
+ byAmountIn: true,
2454
+ splitCount: 0,
2455
+ });
2456
+ if (!depositRouters)
2457
+ throw new Error("No swap quote found");
2458
+ try {
2459
+ flashLoanBorrowedCoin = (yield cetusSdk.fixableRouterSwapV3({
2460
+ router: depositRouters,
2461
+ inputCoin: flashLoanBorrowedCoin,
2462
+ slippage: 1 / 100,
2463
+ txb: transaction,
2464
+ partner: cetusPartnerId,
2465
+ }));
2466
+ }
2467
+ catch (err) {
2468
+ throw new Error("No swap quote found");
2469
+ }
2470
+ }
2442
2471
  strategyDeposit(strategyType, flashLoanBorrowedCoin, depositReserve.coinType, strategyOwnerCapId, suilendClient.findReserveArrayIndex(depositReserve.coinType), transaction);
2443
2472
  // 2.2) Update state
2444
2473
  deposits = addOrInsertStrategyDeposit(deposits, {
@@ -2463,14 +2492,18 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2463
2492
  const dryRunResults = yield dryRunTransaction(transaction);
2464
2493
  const flashLoanRepayAmount = new BigNumber(bcs
2465
2494
  .u64()
2466
- .parse((_o = (_m = (_l = (_k = (_j = dryRunResults.commandResults) === null || _j === void 0 ? void 0 : _j[receiptDebts.Result]) === null || _k === void 0 ? void 0 : _k.returnValues) === null || _l === void 0 ? void 0 : _l[flashLoanObj.borrowA ? 0 : 1]) === null || _m === void 0 ? void 0 : _m.bcs) !== null && _o !== void 0 ? _o : new Uint8Array([0])))
2467
- .div(10 ** depositReserve.token.decimals)
2468
- .decimalPlaces(depositReserve.token.decimals, BigNumber.ROUND_UP);
2495
+ .parse((_p = (_o = (_m = (_l = (_k = dryRunResults.commandResults) === null || _k === void 0 ? void 0 : _k[receiptDebts.Result]) === null || _l === void 0 ? void 0 : _l.returnValues) === null || _m === void 0 ? void 0 : _m[flashLoanObj.borrowA ? 0 : 1]) === null || _o === void 0 ? void 0 : _o.bcs) !== null && _p !== void 0 ? _p : new Uint8Array([0])))
2496
+ .div(10 ** flashLoanCoinReserve.token.decimals)
2497
+ .decimalPlaces(flashLoanCoinReserve.token.decimals, BigNumber.ROUND_UP);
2469
2498
  // 4.1) Withdraw additional + fee
2470
2499
  let withdrawnAmount = flashLoanRepayAmount;
2471
- if (depositReserve.coinType === ((_p = depositReserves.lst) === null || _p === void 0 ? void 0 : _p.coinType))
2500
+ if (needsFlashLoanCoinSwap)
2501
+ withdrawnAmount = flashLoanRepayAmount
2502
+ .times(1.01) // Buffer for swap slippage
2503
+ .decimalPlaces(depositReserve.token.decimals, BigNumber.ROUND_UP);
2504
+ else if (depositReserve.coinType === ((_q = depositReserves.lst) === null || _q === void 0 ? void 0 : _q.coinType))
2472
2505
  withdrawnAmount = withdrawnAmount
2473
- .div(1 - +((_q = lst === null || lst === void 0 ? void 0 : lst.redeemFeePercent) !== null && _q !== void 0 ? _q : 0) / 100) // Potential rounding issue (max 1 MIST)
2506
+ .div(1 - +((_r = lst === null || lst === void 0 ? void 0 : lst.redeemFeePercent) !== null && _r !== void 0 ? _r : 0) / 100) // Potential rounding issue (max 1 MIST)
2474
2507
  .decimalPlaces(depositReserve.token.decimals, BigNumber.ROUND_UP);
2475
2508
  const { deposits: newDeposits2, borrowedAmount: newBorrowedAmount2, transaction: newTransaction2, withdrawnCoin, } = yield strategyWithdrawTx(reserveMap, lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _address, strategyOwnerCapId, obligationId, deposits, borrowedAmount, {
2476
2509
  coinType: depositReserve.coinType,
@@ -2484,8 +2517,34 @@ lstMap, strategyType, suiGrpcClient, suilendClient, cetusSdk, cetusPartnerId, _a
2484
2517
  transaction = newTransaction2;
2485
2518
  // 4.3) Repay flash loan
2486
2519
  let flashLoanRepayCoin = withdrawnCoin;
2487
- if (depositReserve.coinType === ((_r = depositReserves.lst) === null || _r === void 0 ? void 0 : _r.coinType))
2520
+ if (depositReserve.coinType === ((_s = depositReserves.lst) === null || _s === void 0 ? void 0 : _s.coinType))
2488
2521
  flashLoanRepayCoin = lst.client.redeem(transaction, flashLoanRepayCoin);
2522
+ if (needsFlashLoanCoinSwap) {
2523
+ const repayRouters = yield cetusSdk.findRouters({
2524
+ from: depositReserve.coinType,
2525
+ target: flashLoanCoinType,
2526
+ amount: new BN(withdrawnAmount
2527
+ .times(10 ** depositReserve.token.decimals)
2528
+ .integerValue(BigNumber.ROUND_DOWN)
2529
+ .toString()),
2530
+ byAmountIn: true,
2531
+ splitCount: 0,
2532
+ });
2533
+ if (!repayRouters)
2534
+ throw new Error("No swap quote found");
2535
+ try {
2536
+ flashLoanRepayCoin = (yield cetusSdk.fixableRouterSwapV3({
2537
+ router: repayRouters,
2538
+ inputCoin: flashLoanRepayCoin,
2539
+ slippage: 1 / 100,
2540
+ txb: transaction,
2541
+ partner: cetusPartnerId,
2542
+ }));
2543
+ }
2544
+ catch (err) {
2545
+ throw new Error("No swap quote found");
2546
+ }
2547
+ }
2489
2548
  const flashLoanRepayBalance = transaction.moveCall({
2490
2549
  target: "0x2::coin::into_balance",
2491
2550
  typeArguments: [
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { BluefinXTx, buildTx as buildBluefin7kTransaction, } from "@bluefin-exchange/bluefin7k-aggregator-sdk";
11
11
  import { Coin as FlowXCoin, Commission as FlowXCommission, CommissionType as FlowXCommissionType, TradeBuilder as FlowXTradeBuilder, } from "@flowx-finance/sdk";
12
- import { getAllCoins, isSui, mergeAllCoins } from "@suilend/sui-fe";
13
- import { createJsonRpcAdapter } from "../lib/pythAdapter";
12
+ import { getSpendableCoin } from "@suilend/sui-fe";
14
13
  import { QuoteProvider } from "./quote";
15
14
  const getSwapTransactionWrapper = (provider, getSwapTransaction) => __awaiter(void 0, void 0, void 0, function* () {
16
15
  console.log(`[getSwapTransactionWrapper] fetching transaction for ${provider} quote`);
@@ -28,11 +27,7 @@ export const getSwapTransaction = (suiGrpcClient, address, quote, slippagePercen
28
27
  if (quote.provider === QuoteProvider.CETUS) {
29
28
  return getSwapTransactionWrapper(QuoteProvider.CETUS, () => __awaiter(void 0, void 0, void 0, function* () {
30
29
  if (!coinIn) {
31
- const allCoinsIn = yield getAllCoins(suiGrpcClient, address, quote.in.coinType);
32
- const mergeCoinIn = mergeAllCoins(quote.in.coinType, transaction, allCoinsIn);
33
- [coinIn] = transaction.splitCoins(isSui(quote.in.coinType)
34
- ? transaction.gas
35
- : transaction.object(mergeCoinIn.objectId), [BigInt(quote.quote.amountIn.toString())]);
30
+ coinIn = yield getSpendableCoin(suiGrpcClient, address, quote.in.coinType, quote.quote.amountIn.toString(), transaction);
36
31
  }
37
32
  const coinOut = yield sdkMap[QuoteProvider.CETUS].routerSwap({
38
33
  router: quote.quote,
@@ -77,11 +72,7 @@ export const getSwapTransaction = (suiGrpcClient, address, quote, slippagePercen
77
72
  else if (quote.provider === QuoteProvider.FLOWX) {
78
73
  return getSwapTransactionWrapper(QuoteProvider.FLOWX, () => __awaiter(void 0, void 0, void 0, function* () {
79
74
  if (!coinIn) {
80
- const allCoinsIn = yield getAllCoins(suiGrpcClient, address, quote.in.coinType);
81
- const mergeCoinIn = mergeAllCoins(quote.in.coinType, transaction, allCoinsIn);
82
- [coinIn] = transaction.splitCoins(isSui(quote.in.coinType)
83
- ? transaction.gas
84
- : transaction.object(mergeCoinIn.objectId), [BigInt(quote.quote.amountIn.toString())]);
75
+ coinIn = yield getSpendableCoin(suiGrpcClient, address, quote.in.coinType, quote.quote.amountIn.toString(), transaction);
85
76
  }
86
77
  const trade = new FlowXTradeBuilder("mainnet", quote.quote.routes)
87
78
  .slippage((slippagePercent / 100) * 1e6)
@@ -89,7 +80,7 @@ export const getSwapTransaction = (suiGrpcClient, address, quote, slippagePercen
89
80
  .build();
90
81
  const coinOut = yield trade.swap({
91
82
  coinIn: coinIn,
92
- client: createJsonRpcAdapter(suiGrpcClient),
83
+ client: suiGrpcClient,
93
84
  tx: transaction,
94
85
  });
95
86
  return { transaction, coinOut: coinOut };