@sodax/types 2.1.0-rc.6 → 2.1.0-rc.8
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/backend/backendBridgeApiV2.d.ts +6 -0
- package/dist/chains/chain-keys.d.ts +3 -2
- package/dist/chains/chain-keys.js +1 -0
- package/dist/chains/chains.d.ts +360 -9
- package/dist/chains/chains.js +93 -2
- package/dist/chains/tokens.d.ts +514 -6
- package/dist/chains/tokens.js +258 -3
- package/dist/common/constants.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/moneyMarket/moneyMarket.d.ts +386 -0
- package/dist/moneyMarket/moneyMarket.js +29 -1
- package/dist/sodax-config/sodax-config.d.ts +812 -32
- package/dist/sui/core.d.ts +37 -0
- package/dist/sui/core.js +25 -0
- package/dist/sui/index.d.ts +2 -0
- package/dist/sui/index.js +2 -0
- package/dist/sui/sui.d.ts +15 -1
- package/dist/sui/transport.d.ts +26 -0
- package/dist/sui/transport.js +1 -0
- package/dist/swap/swap.d.ts +523 -40
- package/dist/swap/swap.js +42 -8
- package/package.json +3 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SuiExecutionResult, SuiExecutionStatus, SuiPaginatedCoins } from './sui.js';
|
|
2
|
+
/**
|
|
3
|
+
* Structural mirrors of the `client.core` responses in `@mysten/sui` 2.x, kept local so
|
|
4
|
+
* `@sodax/types` stays dependency-free. Bump them in lockstep with the workspace catalog.
|
|
5
|
+
*/
|
|
6
|
+
export type SuiCoreCoin = {
|
|
7
|
+
objectId: string;
|
|
8
|
+
version: string;
|
|
9
|
+
digest: string;
|
|
10
|
+
balance: string;
|
|
11
|
+
};
|
|
12
|
+
export type SuiCoreListCoinsResponse = {
|
|
13
|
+
objects: SuiCoreCoin[];
|
|
14
|
+
hasNextPage: boolean;
|
|
15
|
+
cursor: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type SuiCoreExecutionStatus = {
|
|
18
|
+
success: true;
|
|
19
|
+
error: null;
|
|
20
|
+
} | {
|
|
21
|
+
success: false;
|
|
22
|
+
error: {
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type SuiCoreCommandResult = {
|
|
27
|
+
returnValues: {
|
|
28
|
+
bcs: Uint8Array;
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* `listCoins` reports `type` as the full `0x2::coin::Coin<T>` tag, so `coinType` echoes the
|
|
33
|
+
* filter the caller queried with rather than unwrapping it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toSuiPaginatedCoins(response: SuiCoreListCoinsResponse, coinType: string): SuiPaginatedCoins;
|
|
36
|
+
export declare function toSuiExecutionResult(command: SuiCoreCommandResult): SuiExecutionResult;
|
|
37
|
+
export declare function toSuiExecutionStatus(status: SuiCoreExecutionStatus): SuiExecutionStatus;
|
package/dist/sui/core.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `listCoins` reports `type` as the full `0x2::coin::Coin<T>` tag, so `coinType` echoes the
|
|
3
|
+
* filter the caller queried with rather than unwrapping it.
|
|
4
|
+
*/
|
|
5
|
+
export function toSuiPaginatedCoins(response, coinType) {
|
|
6
|
+
return {
|
|
7
|
+
data: response.objects.map(coin => ({
|
|
8
|
+
balance: coin.balance,
|
|
9
|
+
coinObjectId: coin.objectId,
|
|
10
|
+
coinType,
|
|
11
|
+
digest: coin.digest,
|
|
12
|
+
version: coin.version,
|
|
13
|
+
})),
|
|
14
|
+
hasNextPage: response.hasNextPage,
|
|
15
|
+
nextCursor: response.cursor,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function toSuiExecutionResult(command) {
|
|
19
|
+
return {
|
|
20
|
+
returnValues: command.returnValues.map(value => [Array.from(value.bcs), '']),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export function toSuiExecutionStatus(status) {
|
|
24
|
+
return status.success ? { status: 'success' } : { status: 'failure', error: status.error.message };
|
|
25
|
+
}
|
package/dist/sui/index.d.ts
CHANGED
package/dist/sui/index.js
CHANGED
package/dist/sui/sui.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type SuiArgument = 'GasCoin' | {
|
|
|
20
20
|
};
|
|
21
21
|
export interface SuiExecutionResult {
|
|
22
22
|
mutableReferenceOutputs?: [SuiArgument, number[], string][];
|
|
23
|
+
/** `[bcsBytes, moveTypeTag]`. The type tag is always `''`: Sui's core client returns bytes only. */
|
|
23
24
|
returnValues?: [number[], string][];
|
|
24
25
|
}
|
|
25
26
|
export interface SuiCoinStruct {
|
|
@@ -27,7 +28,8 @@ export interface SuiCoinStruct {
|
|
|
27
28
|
coinObjectId: string;
|
|
28
29
|
coinType: string;
|
|
29
30
|
digest: string;
|
|
30
|
-
|
|
31
|
+
/** Absent over gRPC — Sui's `Coin` message does not carry it. */
|
|
32
|
+
previousTransaction?: string;
|
|
31
33
|
version: string;
|
|
32
34
|
}
|
|
33
35
|
export interface SuiPaginatedCoins {
|
|
@@ -93,13 +95,25 @@ export type SuiTransactionEffects = {
|
|
|
93
95
|
transactionDigest: string;
|
|
94
96
|
gasObject: SuiOwnedObjectRef;
|
|
95
97
|
dependencies?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* Object-change buckets. All absent over gRPC: the effects message carries one flat
|
|
100
|
+
* `changedObjects` list keyed by `inputState` / `outputState` / `idOperation`, and the
|
|
101
|
+
* transport does not re-derive the buckets from it.
|
|
102
|
+
*/
|
|
96
103
|
created?: SuiOwnedObjectRef[];
|
|
104
|
+
/** Absent over gRPC — see `created`. */
|
|
97
105
|
mutated?: SuiOwnedObjectRef[];
|
|
106
|
+
/** Absent over gRPC — see `created`. */
|
|
98
107
|
deleted?: SuiObjectRef[];
|
|
108
|
+
/** Absent over gRPC — see `created`. */
|
|
99
109
|
wrapped?: SuiObjectRef[];
|
|
110
|
+
/** Absent over gRPC — see `created`. */
|
|
100
111
|
unwrapped?: SuiOwnedObjectRef[];
|
|
112
|
+
/** Absent over gRPC — see `created`. */
|
|
101
113
|
unwrappedThenDeleted?: SuiObjectRef[];
|
|
114
|
+
/** Absent over gRPC — see `created`. */
|
|
102
115
|
sharedObjects?: SuiObjectRef[];
|
|
116
|
+
/** Absent over gRPC — see `created`. */
|
|
103
117
|
modifiedAtVersions?: SuiTransactionEffectsModifiedAtVersions[];
|
|
104
118
|
eventsDigest?: string | null;
|
|
105
119
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SuiGasEstimate } from '../common/common.js';
|
|
2
|
+
import type { SuiExecutionResult, SuiPaginatedCoins, SuiRawTransactionReceipt, SuiTransaction } from './sui.js';
|
|
3
|
+
export type SuiWaitForTransactionParams = {
|
|
4
|
+
digest: string;
|
|
5
|
+
timeoutMs: number;
|
|
6
|
+
pollingIntervalMs: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sui reads in `@sodax/types` vocabulary, implemented by `SuiGrpcTransport` in `@sodax/sdk`. It
|
|
10
|
+
* speaks `SuiTransaction` rather than a `@mysten/sui` `Transaction` so this package stays
|
|
11
|
+
* dependency-free and the SDK's published `.d.ts` — which has no node10 resolution fallback —
|
|
12
|
+
* never names the vendor client.
|
|
13
|
+
*/
|
|
14
|
+
export interface SuiTransport {
|
|
15
|
+
readonly endpoint: string;
|
|
16
|
+
getCoins(owner: string, coinType: string, limit?: number): Promise<SuiPaginatedCoins>;
|
|
17
|
+
/**
|
|
18
|
+
* The sender is applied to the transaction the node simulates, which may be a rebuilt copy of the
|
|
19
|
+
* one passed in — do not rely on your instance coming back mutated.
|
|
20
|
+
*/
|
|
21
|
+
simulate(tx: SuiTransaction, sender: string): Promise<SuiExecutionResult>;
|
|
22
|
+
/** Same sender rule as {@link SuiTransport.simulate}. */
|
|
23
|
+
estimateGas(tx: SuiTransaction, sender: string): Promise<SuiGasEstimate>;
|
|
24
|
+
fetchLatestPackageId(objectId: string): Promise<string>;
|
|
25
|
+
waitForTransaction(params: SuiWaitForTransactionParams): Promise<SuiRawTransactionReceipt>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|