stable-layer-sdk 2.0.0 → 3.0.0
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 +18 -17
- package/dist/cjs/index.cjs +281 -284
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/esm/index.mjs +282 -287
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +12 -8
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ const client = new StableLayerClient({
|
|
|
26
26
|
Deposit USDC to mint stablecoins. The SDK builds a transaction that mints via Stable Layer and deposits into the vault farm.
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
|
-
import {
|
|
29
|
+
import { coinWithBalance, Transaction } from "@mysten/sui/transactions";
|
|
30
30
|
|
|
31
31
|
const tx = new Transaction();
|
|
32
32
|
|
|
@@ -96,9 +96,7 @@ await client.buildClaimTx({
|
|
|
96
96
|
const totalSupply = await client.getTotalSupply();
|
|
97
97
|
|
|
98
98
|
// Total supply for a specific coin type
|
|
99
|
-
const btcUsdcSupply = await client.getTotalSupplyByCoinType(
|
|
100
|
-
"0x6d9fc...::btc_usdc::BtcUSDC",
|
|
101
|
-
);
|
|
99
|
+
const btcUsdcSupply = await client.getTotalSupplyByCoinType("0x6d9fc...::btc_usdc::BtcUSDC");
|
|
102
100
|
```
|
|
103
101
|
|
|
104
102
|
### Signing and Executing
|
|
@@ -106,14 +104,17 @@ const btcUsdcSupply = await client.getTotalSupplyByCoinType(
|
|
|
106
104
|
All `build*` methods return a `Transaction` that you sign and execute with the Sui SDK:
|
|
107
105
|
|
|
108
106
|
```typescript
|
|
109
|
-
import {
|
|
107
|
+
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
110
108
|
import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
|
|
111
109
|
|
|
112
|
-
const suiClient = new
|
|
110
|
+
const suiClient = new SuiGrpcClient({
|
|
111
|
+
network: "mainnet",
|
|
112
|
+
baseUrl: "https://fullnode.mainnet.sui.io:443",
|
|
113
|
+
});
|
|
113
114
|
const keypair = Ed25519Keypair.fromSecretKey(YOUR_PRIVATE_KEY);
|
|
114
115
|
|
|
115
116
|
const tx = new Transaction();
|
|
116
|
-
await client.buildMintTx({ tx
|
|
117
|
+
await client.buildMintTx({ tx /* ... */ });
|
|
117
118
|
|
|
118
119
|
const result = await suiClient.signAndExecuteTransaction({
|
|
119
120
|
transaction: tx,
|
|
@@ -125,21 +126,21 @@ const result = await suiClient.signAndExecuteTransaction({
|
|
|
125
126
|
|
|
126
127
|
### `new StableLayerClient(config)`
|
|
127
128
|
|
|
128
|
-
| Parameter
|
|
129
|
-
|
|
130
|
-
| `config.network` | `"mainnet" \| "testnet"` | Sui network
|
|
131
|
-
| `config.sender`
|
|
129
|
+
| Parameter | Type | Description |
|
|
130
|
+
| ---------------- | ------------------------ | ---------------------- |
|
|
131
|
+
| `config.network` | `"mainnet" \| "testnet"` | Sui network |
|
|
132
|
+
| `config.sender` | `string` | Default sender address |
|
|
132
133
|
|
|
133
134
|
### Transaction Methods
|
|
134
135
|
|
|
135
136
|
All methods accept a `tx` (Transaction) and optional `sender` to override the default. Set `autoTransfer: false` to get the resulting coin back instead of auto-transferring.
|
|
136
137
|
|
|
137
|
-
| Method
|
|
138
|
-
|
|
139
|
-
| `buildMintTx(params)`
|
|
140
|
-
| `buildBurnTx(params)`
|
|
141
|
-
| `buildClaimTx(params)`
|
|
142
|
-
| `getTotalSupply()`
|
|
138
|
+
| Method | Description |
|
|
139
|
+
| -------------------------------- | ----------------------------------------- |
|
|
140
|
+
| `buildMintTx(params)` | Mint stablecoins from USDC |
|
|
141
|
+
| `buildBurnTx(params)` | Burn stablecoins to redeem USDC |
|
|
142
|
+
| `buildClaimTx(params)` | Claim yield farming rewards |
|
|
143
|
+
| `getTotalSupply()` | Get total supply from registry |
|
|
143
144
|
| `getTotalSupplyByCoinType(type)` | Get total supply for a specific coin type |
|
|
144
145
|
|
|
145
146
|
## License
|