aftermath-ts-sdk 1.2.63 → 1.2.64

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/README.md CHANGED
@@ -1,57 +1,91 @@
1
- # Aftermath TypeScript SDK
1
+ # Aftermath SDK
2
2
 
3
- ## Install
3
+ The Aftermath SDK provides easy access to Aftermath Finance's protocols on the Sui blockchain. Please note that not all of our protocols are on Testnet, but all of them are Mainnet.
4
+
5
+ ## Installation
4
6
 
5
7
  ```bash
6
8
  npm i aftermath-ts-sdk
7
9
  ```
8
10
 
9
- ## Usage
10
-
11
- Create an instance of `Aftermath` for ease of use to make calls to our server, or create an instance of `AftermathApi` for finer control of transaction construction.
12
-
13
- ## Aftermath SDK
11
+ ## Quick Start (Aftermath SDK)
14
12
 
15
- ### 1. Create Aftermath provider
13
+ For most integrations, use the Aftermath SDK for simplified access:
16
14
 
17
- ```ts
18
- const afSdk = new Aftermath("MAINNET"); // "MAINNET" | "TESTNET" | "DEVNET"
19
- ```
20
-
21
- ### 2. Create protocol provider
15
+ ```typescript
16
+ const afSdk = new Aftermath("MAINNET"); // "MAINNET" | "TESTNET"
17
+ await afSdk.init(); // initialize provider
22
18
 
23
- ```ts
19
+ // Access protocols
24
20
  const router = afSdk.Router();
25
21
  const pools = afSdk.Pools();
26
22
  const staking = afSdk.Staking();
27
23
  const farms = afSdk.Farms();
24
+ const dca = afSdk.Dca();
28
25
  ```
29
26
 
30
- ## Aftermath API
27
+ ## Advanced Usage (AftermathApi)
31
28
 
32
- ### 1. Create Aftermath Api provider
29
+ For complex transaction construction, use AftermathApi for direct control:
33
30
 
34
- ```ts
35
- const fullnodeEndpoint = "https://fullnode.mainnet.sui.io";
36
- const addresses = {...};
31
+ ```typescript
32
+ const afSdk = new Aftermath("MAINNET");
33
+ const addresses = afSdk.getAddresses();
37
34
 
38
35
  const afApi = new AftermathApi(
39
36
  new SuiClient({
40
37
  transport: new SuiHTTPTransport({
41
- url: fullnodeEndpoint,
38
+ url: "https://fullnode.mainnet.sui.io",
42
39
  }),
43
40
  }),
44
- addresses,
45
- new IndexerCaller("MAINNET"), // "MAINNET" | "TESTNET" | "DEVNET"
41
+ addresses // Configuration addresses
46
42
  );
47
- ```
48
43
 
49
- ### 2. Create protocol provider
50
-
51
- ```ts
44
+ // Access protocol APIs
52
45
  const poolsApi = afApi.Pools();
53
46
  const stakingApi = afApi.Staking();
54
47
  const farmsApi = afApi.Farms();
55
48
  ```
56
49
 
57
- Find the complete documentation for using our router, AMM pools, liquid staking, and more in our [GitBook](https://docs.aftermath.finance/aftermath-typescript-sdk/getting-started).
50
+ ## Available Protocols
51
+
52
+ ### Pools (AMM)
53
+
54
+ - Automated Market Maker pools for trading
55
+ - Support for stable and uncorrelated assets
56
+ - Up to 8 assets per pool
57
+ - [View Pools Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/pools)
58
+
59
+ ### Router
60
+
61
+ - Smart order routing across multiple pools
62
+ - Optimal trade execution via split routes
63
+ - [View Router Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/router)
64
+
65
+ ### Staking
66
+
67
+ - Liquid staking for SUI tokens
68
+ - Earn yield with afSUI
69
+ - [View Staking Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/liquid-staking)
70
+
71
+ ### Farms
72
+
73
+ - Yield farming opportunities
74
+ - Stake LP tokens and earn rewards
75
+ - [View Farms Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/farms)
76
+
77
+ ### DCA (Dollar-Cost Averaging)
78
+
79
+ - Automated periodic investments
80
+ - Reduce impact of market volatility
81
+ - [View DCA Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/DCA)
82
+
83
+ ## Rate Limits
84
+
85
+ Default rate limit: 1000 requests per 10 seconds
86
+
87
+ For higher limits, contact us via:
88
+
89
+ - [Telegram](https://t.me/aftermath_fi)
90
+ - [Discord](https://discord.gg/VFqMUqKHF3)
91
+ - [X/Twitter](https://x.com/AftermathFi)
@@ -1 +1 @@
1
- {"version":3,"file":"coinApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/coin/api/coinApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,yBAAyB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAY,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,qBAAa,OAAO;IAKP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAM5C,qBAAqB,WAAkB;QAC7C,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;QACnC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,yBAAyB,CAAC,CAcpC;IAEK,sBAAsB,WAAkB;QAC9C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,WAAW,EAAE,OAAO,EAAE,CAAC;QACvB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,yBAAyB,EAAE,CAAC,CA8BtC;IAGK,aAAa,WAAkB;QACrC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;KAEnB,KAAG,QAAQ,UAAU,EAAE,CAAC,CAiCvB;IAMF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAyE7B;CACF"}
1
+ {"version":3,"file":"coinApi.d.ts","sourceRoot":"","sources":["../../../../src/packages/coin/api/coinApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,yBAAyB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAY,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,qBAAa,OAAO;IAKP,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAM5C,qBAAqB,WAAkB;QAC7C,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;QACnC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,yBAAyB,CAAC,CAcpC;IAEK,sBAAsB,WAAkB;QAC9C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,WAAW,EAAE,OAAO,EAAE,CAAC;QACvB,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,yBAAyB,EAAE,CAAC,CA8BtC;IAGK,aAAa,WAAkB;QACrC,aAAa,EAAE,UAAU,CAAC;QAC1B,QAAQ,EAAE,QAAQ,CAAC;KAEnB,KAAG,QAAQ,UAAU,EAAE,CAAC,CAiCvB;IAMF,OAAO,CAAC,MAAM,CAAC,gBAAgB,CA+E7B;CACF"}
@@ -107,31 +107,39 @@ CoinApi.coinWithAmountTx = (inputs) => {
107
107
  const coinObjectIds = coinData.map((data) => data.coinObjectId);
108
108
  const mergedCoinObjectId = coinObjectIds[0];
109
109
  if (coinObjectIds.length > 1) {
110
- // tx.mergeCoins(tx.object(mergedCoinObjectId), [
111
- // ...coinObjectIds.slice(1).map((coinId) => tx.object(coinId)),
112
- // ]);
113
110
  // TODO: fix this (v1)
114
- tx.add({
115
- $kind: "MergeCoins",
116
- MergeCoins: {
117
- destination: tx.object(mergedCoinObjectId),
118
- sources: [
119
- ...coinObjectIds
120
- .slice(1)
121
- .map((coinId) => tx.object(coinId)),
122
- ],
123
- },
124
- });
111
+ if (isSponsoredTx) {
112
+ tx.add({
113
+ $kind: "MergeCoins",
114
+ MergeCoins: {
115
+ destination: tx.object(mergedCoinObjectId),
116
+ sources: [
117
+ ...coinObjectIds
118
+ .slice(1)
119
+ .map((coinId) => tx.object(coinId)),
120
+ ],
121
+ },
122
+ });
123
+ }
124
+ else {
125
+ tx.mergeCoins(tx.object(mergedCoinObjectId), [
126
+ ...coinObjectIds
127
+ .slice(1)
128
+ .map((coinId) => tx.object(coinId)),
129
+ ]);
130
+ }
125
131
  }
126
132
  // return tx.add({
127
133
  // kind: "SplitCoins",
128
134
  // coin: tx.object(mergedCoinObjectId),
129
135
  // amounts: [tx.pure(coinAmount)],
130
136
  // });
131
- return transactionsApiHelpers_1.TransactionsApiHelpers.splitCoinTx({
132
- tx,
133
- coinId: mergedCoinObjectId,
134
- amount: coinAmount,
135
- coinType,
136
- });
137
+ return isSponsoredTx
138
+ ? transactionsApiHelpers_1.TransactionsApiHelpers.splitCoinTx({
139
+ tx,
140
+ coinId: mergedCoinObjectId,
141
+ amount: coinAmount,
142
+ coinType,
143
+ })
144
+ : tx.splitCoins(mergedCoinObjectId, [coinAmount]);
137
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aftermath-ts-sdk",
3
- "version": "1.2.63",
3
+ "version": "1.2.64",
4
4
  "description": "Aftermath TypeScript SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",