aftermath-ts-sdk 1.3.21-update-dependency-0.1 → 1.3.22-cleanup.0.1
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/general/wallet/wallet.d.ts +2 -7
- package/dist/general/wallet/wallet.d.ts.map +1 -1
- package/dist/general/wallet/wallet.js +6 -19
- package/dist/packages/router/api/routerApi.d.ts +1 -7
- package/dist/packages/router/api/routerApi.d.ts.map +1 -1
- package/dist/packages/router/api/routerApi.js +6 -43
- package/dist/packages/sui/api/suiApi.d.ts +13 -0
- package/dist/packages/sui/api/suiApi.d.ts.map +1 -1
- package/dist/packages/sui/api/suiApi.js +13 -0
- package/dist/packages/sui/sui.d.ts +0 -5
- package/dist/packages/sui/sui.d.ts.map +1 -1
- package/dist/packages/sui/sui.js +1 -15
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiTransactionsBody, Balance, CallerConfig, SuiAddress
|
|
1
|
+
import { ApiTransactionsBody, Balance, CallerConfig, SuiAddress } from "../types/generalTypes";
|
|
2
2
|
import { CoinType, CoinsToBalance } from "../../packages/coin/coinTypes";
|
|
3
3
|
import { Caller } from "../utils/caller";
|
|
4
4
|
import { AftermathApi } from "../providers";
|
|
@@ -84,11 +84,6 @@ export declare class Wallet extends Caller {
|
|
|
84
84
|
* console.log(txHistory.transactions, txHistory.nextCursor);
|
|
85
85
|
* ```
|
|
86
86
|
*/
|
|
87
|
-
getPastTransactions(inputs: ApiTransactionsBody): Promise<
|
|
88
|
-
/**
|
|
89
|
-
* Internal helper to return the `Wallet` provider from `AftermathApi`, throwing
|
|
90
|
-
* an error if the provider is not defined.
|
|
91
|
-
*/
|
|
92
|
-
private useProvider;
|
|
87
|
+
getPastTransactions(inputs: ApiTransactionsBody): Promise<unknown>;
|
|
93
88
|
}
|
|
94
89
|
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../src/general/wallet/wallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../src/general/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,UAAU,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,MAAM;aAShB,OAAO,EAAE,UAAU;IAEnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAV3B;;;;;;OAMG;gBAEc,OAAO,EAAE,UAAU,EACnC,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,EAAE,YAAY,YAAA;IASzC;;;;;;;;;;;;;;;;;OAiBG;IACU,UAAU,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAUrE;;;;;;;;;;;;;;OAcG;IACU,WAAW,CAAC,MAAM,EAAE;QAChC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAItB;;;;;;;;;;;;OAYG;IACU,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC;IAQtD;;;;;;;;;;;;OAYG;IACU,mBAAmB,CAAC,MAAM,EAAE,mBAAmB;CAK5D"}
|
|
@@ -28,20 +28,6 @@ class Wallet extends caller_1.Caller {
|
|
|
28
28
|
super(config, `wallet/${address}`);
|
|
29
29
|
this.address = address;
|
|
30
30
|
this.Provider = Provider;
|
|
31
|
-
// =========================================================================
|
|
32
|
-
// Private Helpers
|
|
33
|
-
// =========================================================================
|
|
34
|
-
/**
|
|
35
|
-
* Internal helper to return the `Wallet` provider from `AftermathApi`, throwing
|
|
36
|
-
* an error if the provider is not defined.
|
|
37
|
-
*/
|
|
38
|
-
this.useProvider = () => {
|
|
39
|
-
var _a;
|
|
40
|
-
const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Wallet();
|
|
41
|
-
if (!provider)
|
|
42
|
-
throw new Error("missing AftermathApi Provider");
|
|
43
|
-
return provider;
|
|
44
|
-
};
|
|
45
31
|
}
|
|
46
32
|
// =========================================================================
|
|
47
33
|
// Balances
|
|
@@ -66,7 +52,10 @@ class Wallet extends caller_1.Caller {
|
|
|
66
52
|
*/
|
|
67
53
|
getBalance(inputs) {
|
|
68
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
|
|
55
|
+
const balances = yield this.fetchApi(`${this.address}/balances/coins`, {
|
|
56
|
+
coins: [inputs.coin],
|
|
57
|
+
});
|
|
58
|
+
return balances[0];
|
|
70
59
|
});
|
|
71
60
|
}
|
|
72
61
|
/**
|
|
@@ -104,9 +93,7 @@ class Wallet extends caller_1.Caller {
|
|
|
104
93
|
*/
|
|
105
94
|
getAllBalances() {
|
|
106
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
return this.
|
|
108
|
-
walletAddress: this.address,
|
|
109
|
-
});
|
|
96
|
+
return this.fetchApi(`${this.address}/balances`);
|
|
110
97
|
});
|
|
111
98
|
}
|
|
112
99
|
// =========================================================================
|
|
@@ -127,7 +114,7 @@ class Wallet extends caller_1.Caller {
|
|
|
127
114
|
*/
|
|
128
115
|
getPastTransactions(inputs) {
|
|
129
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
return this.
|
|
117
|
+
return this.fetchApi(`${this.address}/transactions`, Object.assign({}, inputs));
|
|
131
118
|
});
|
|
132
119
|
}
|
|
133
120
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AftermathApi } from "../../../general/providers/aftermathApi";
|
|
2
|
-
import {
|
|
2
|
+
import { AnyObjectType, RouterAddresses } from "../../../types";
|
|
3
3
|
import { MoveErrors, MoveErrorsInterface } from "../../../general/types/moveErrorsInterface";
|
|
4
4
|
/**
|
|
5
5
|
* RouterApi class provides methods for interacting with the Aftermath Router API.
|
|
@@ -30,12 +30,6 @@ export declare class RouterApi implements MoveErrorsInterface {
|
|
|
30
30
|
* @param {AftermathApi} Provider - The Aftermath API instance.
|
|
31
31
|
*/
|
|
32
32
|
constructor(Provider: AftermathApi);
|
|
33
|
-
/**
|
|
34
|
-
* Fetches trade events for a given user.
|
|
35
|
-
* @param inputs - The inputs for fetching trade events.
|
|
36
|
-
* @returns A Promise that resolves with the fetched trade events.
|
|
37
|
-
*/
|
|
38
|
-
fetchTradeEvents(inputs: UserEventsInputs): Promise<void>;
|
|
39
33
|
private routerTradeEventType;
|
|
40
34
|
}
|
|
41
35
|
//# sourceMappingURL=routerApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/router/api/routerApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"routerApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/router/api/routerApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAGN,aAAa,EACb,eAAe,EACf,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EACN,UAAU,EACV,mBAAmB,EACnB,MAAM,4CAA4C,CAAC;AAEpD;;;GAGG;AACH,qBAAa,SAAU,YAAW,mBAAmB;IAqCxC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAhCrC,gBAAuB,SAAS;;;;;;;;;;;MAW9B;IAMF,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,UAAU,EAAE;QAC3B,WAAW,EAAE,aAAa,CAAC;KAC3B,CAAC;IACF,SAAgB,UAAU,EAAE,UAAU,CAAC;IAMvC;;;;OAIG;gBAC0B,QAAQ,EAAE,YAAY;IA4DnD,OAAO,CAAC,oBAAoB,CAKzB;CACH"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.RouterApi = void 0;
|
|
13
4
|
const eventsApiHelpers_1 = require("../../../general/apiHelpers/eventsApiHelpers");
|
|
@@ -27,6 +18,12 @@ class RouterApi {
|
|
|
27
18
|
constructor(Provider) {
|
|
28
19
|
this.Provider = Provider;
|
|
29
20
|
// =========================================================================
|
|
21
|
+
// Public Methods
|
|
22
|
+
// =========================================================================
|
|
23
|
+
// =========================================================================
|
|
24
|
+
// Events
|
|
25
|
+
// =========================================================================
|
|
26
|
+
// =========================================================================
|
|
30
27
|
// Events
|
|
31
28
|
// =========================================================================
|
|
32
29
|
// =========================================================================
|
|
@@ -72,40 +69,6 @@ class RouterApi {
|
|
|
72
69
|
},
|
|
73
70
|
};
|
|
74
71
|
}
|
|
75
|
-
// =========================================================================
|
|
76
|
-
// Public Methods
|
|
77
|
-
// =========================================================================
|
|
78
|
-
// =========================================================================
|
|
79
|
-
// Events
|
|
80
|
-
// =========================================================================
|
|
81
|
-
/**
|
|
82
|
-
* Fetches trade events for a given user.
|
|
83
|
-
* @param inputs - The inputs for fetching trade events.
|
|
84
|
-
* @returns A Promise that resolves with the fetched trade events.
|
|
85
|
-
*/
|
|
86
|
-
fetchTradeEvents(inputs) {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
throw new Error("move to indexer");
|
|
89
|
-
// return this.Provider.Events().fetchCastEventsWithCursor<
|
|
90
|
-
// RouterTradeEventOnChain,
|
|
91
|
-
// RouterTradeEvent
|
|
92
|
-
// >({
|
|
93
|
-
// cursor: inputs.cursor,
|
|
94
|
-
// limit: inputs.limit,
|
|
95
|
-
// query: {
|
|
96
|
-
// And: [
|
|
97
|
-
// {
|
|
98
|
-
// Sender: inputs.walletAddress,
|
|
99
|
-
// },
|
|
100
|
-
// {
|
|
101
|
-
// MoveEventType: this.eventTypes.routerTrade,
|
|
102
|
-
// },
|
|
103
|
-
// ],
|
|
104
|
-
// },
|
|
105
|
-
// eventFromEventOnChain: RouterApiCasting.routerTradeEventFromOnChain,
|
|
106
|
-
// });
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
72
|
}
|
|
110
73
|
exports.RouterApi = RouterApi;
|
|
111
74
|
// =========================================================================
|
|
@@ -3,6 +3,19 @@ import { AftermathApi } from "../../../general/providers/aftermathApi";
|
|
|
3
3
|
export declare class SuiApi {
|
|
4
4
|
private readonly Provider;
|
|
5
5
|
constructor(Provider: AftermathApi);
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `getSystemState()` method instead.
|
|
8
|
+
* This method will be removed in a future release.
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
12
|
+
* await afSdk.init(); // initialize provider
|
|
13
|
+
*
|
|
14
|
+
* const sui = afSdk.Sui();
|
|
15
|
+
*
|
|
16
|
+
* const systemState = await sui.getSystemState();
|
|
17
|
+
* console.log(systemState.epoch, systemState.validators);
|
|
18
|
+
*/
|
|
6
19
|
fetchSystemState: () => Promise<SuiSystemStateSummary>;
|
|
7
20
|
}
|
|
8
21
|
//# sourceMappingURL=suiApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suiApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/sui/api/suiApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAGvE,qBAAa,MAAM;IASN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"suiApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/sui/api/suiApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAGvE,qBAAa,MAAM;IASN,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAMnD;;;;;;;;;;;;OAYG;IACI,gBAAgB,QAAa,OAAO,CAAC,qBAAqB,CAAC,CAiBhE;CACF"}
|
|
@@ -23,6 +23,19 @@ class SuiApi {
|
|
|
23
23
|
// =========================================================================
|
|
24
24
|
// Inspections
|
|
25
25
|
// =========================================================================
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `getSystemState()` method instead.
|
|
28
|
+
* This method will be removed in a future release.
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
32
|
+
* await afSdk.init(); // initialize provider
|
|
33
|
+
*
|
|
34
|
+
* const sui = afSdk.Sui();
|
|
35
|
+
*
|
|
36
|
+
* const systemState = await sui.getSystemState();
|
|
37
|
+
* console.log(systemState.epoch, systemState.validators);
|
|
38
|
+
*/
|
|
26
39
|
this.fetchSystemState = () => __awaiter(this, void 0, void 0, function* () {
|
|
27
40
|
const systemState = yield this.Provider.provider.getLatestSuiSystemState();
|
|
28
41
|
const activeValidators = systemState.activeValidators.map((validator) => (Object.assign(Object.assign({}, validator), { suiAddress: utils_1.Helpers.addLeadingZeroesToType(validator.suiAddress) })));
|
|
@@ -49,10 +49,5 @@ export declare class Sui extends Caller {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
getSystemState(): Promise<SuiSystemStateSummary>;
|
|
52
|
-
/**
|
|
53
|
-
* Internal helper to return the configured `Sui` provider. Throws an error if
|
|
54
|
-
* no `AftermathApi` provider is defined.
|
|
55
|
-
*/
|
|
56
|
-
private useProvider;
|
|
57
52
|
}
|
|
58
53
|
//# sourceMappingURL=sui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../src/packages/sui/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"sui.d.ts","sourceRoot":"","sources":["../../../src/packages/sui/sui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAA6B,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;GAIG;AACH,qBAAa,GAAI,SAAQ,MAAM;IAoC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IA/B3B;;;;;;OAMG;IACH,gBAAuB,SAAS;;;;;;;MAU9B;IAMF;;;;;OAKG;gBAEF,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,EAAE,YAAY,YAAA;IASzC;;;;;;;;;;;;;;;;OAgBG;IACU,cAAc,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAG7D"}
|
package/dist/packages/sui/sui.js
CHANGED
|
@@ -29,20 +29,6 @@ class Sui extends caller_1.Caller {
|
|
|
29
29
|
constructor(config, Provider) {
|
|
30
30
|
super(config, "sui");
|
|
31
31
|
this.Provider = Provider;
|
|
32
|
-
// =========================================================================
|
|
33
|
-
// Private Helpers
|
|
34
|
-
// =========================================================================
|
|
35
|
-
/**
|
|
36
|
-
* Internal helper to return the configured `Sui` provider. Throws an error if
|
|
37
|
-
* no `AftermathApi` provider is defined.
|
|
38
|
-
*/
|
|
39
|
-
this.useProvider = () => {
|
|
40
|
-
var _a;
|
|
41
|
-
const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Sui();
|
|
42
|
-
if (!provider)
|
|
43
|
-
throw new Error("missing AftermathApi Provider");
|
|
44
|
-
return provider;
|
|
45
|
-
};
|
|
46
32
|
}
|
|
47
33
|
// =========================================================================
|
|
48
34
|
// Chain Info
|
|
@@ -66,7 +52,7 @@ class Sui extends caller_1.Caller {
|
|
|
66
52
|
*/
|
|
67
53
|
getSystemState() {
|
|
68
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
return this.
|
|
55
|
+
return this.fetchApi("system-state");
|
|
70
56
|
});
|
|
71
57
|
}
|
|
72
58
|
}
|