{"skill":{"slug":"stable-layer-sdk","displayName":"stable-layer-sdk","summary":"A TypeScript SDK for interacting with Stable Layer on Sui blockchain, supporting minting, burning stablecoins, claiming yield rewards, and querying supply.","description":"# Stable Layer SDK\n\nA TypeScript SDK for interacting with the Stable Layer protocol on the Sui blockchain. It supports minting and burning stablecoins, and claiming yield farming rewards.\n\n## Installation\n\n```bash\nnpm install stable-layer-sdk @mysten/sui @mysten/bcs\n```\n\n## API Reference\n\n### StableLayerClient\n\n```typescript\nimport { StableLayerClient } from \"stable-layer-sdk\";\n\nconst client = new StableLayerClient({\n  network: \"mainnet\" | \"testnet\",\n  sender: \"0xYOUR_SUI_ADDRESS\",\n});\n```\n\n### Transaction Methods\n\n#### `buildMintTx(options)`\n\nMint stablecoins by depositing USDC. Automatically deposits into vault farm.\n\n| Parameter       | Type          | Description                                      |\n| --------------- | ------------- | ------------------------------------------------ |\n| `tx`            | `Transaction` | Sui transaction object                           |\n| `stableCoinType`| `string`      | Target stablecoin type (e.g. `0x...::btc_usdc::BtcUSDC`) |\n| `usdcCoin`      | `Coin`        | Input USDC coin reference                        |\n| `amount`        | `bigint`      | Amount to mint                                   |\n| `autoTransfer`  | `boolean?`    | If `false`, returns the resulting Coin object     |\n\n#### `buildBurnTx(options)`\n\nBurn stablecoins to redeem USDC.\n\n| Parameter       | Type          | Description                          |\n| --------------- | ------------- | ------------------------------------ |\n| `tx`            | `Transaction` | Sui transaction object               |\n| `stableCoinType`| `string`      | Stablecoin type to burn              |\n| `amount`        | `bigint?`     | Specific amount to burn              |\n| `all`           | `boolean?`    | If `true`, burn entire balance       |\n\n#### `buildClaimTx(options)`\n\nClaim accumulated yield farming rewards.\n\n| Parameter       | Type          | Description                          |\n| --------------- | ------------- | ------------------------------------ |\n| `tx`            | `Transaction` | Sui transaction object               |\n| `stableCoinType`| `string`      | Stablecoin type to claim rewards for |\n\n### Query Methods\n\n#### `getTotalSupply()`\n\nReturns the total stablecoin supply across all coin types.\n\n#### `getTotalSupplyByCoinType(type: string)`\n\nReturns the supply for a specific stablecoin type.\n\n## Usage Examples\n\n### Mint Stablecoins\n\n```typescript\nimport { Transaction, coinWithBalance } from \"@mysten/sui/transactions\";\nimport { SuiClient, getFullnodeUrl } from \"@mysten/sui/client\";\nimport { Ed25519Keypair } from \"@mysten/sui/keypairs/ed25519\";\nimport { StableLayerClient } from \"stable-layer-sdk\";\n\nconst client = new StableLayerClient({\n  network: \"mainnet\",\n  sender: \"0xYOUR_ADDRESS\",\n});\n\nconst suiClient = new SuiClient({ url: getFullnodeUrl(\"mainnet\") });\nconst keypair = Ed25519Keypair.fromSecretKey(YOUR_PRIVATE_KEY);\n\nconst tx = new Transaction();\nawait client.buildMintTx({\n  tx,\n  stableCoinType: \"0x6d9fc...::btc_usdc::BtcUSDC\",\n  usdcCoin: coinWithBalance({\n    balance: BigInt(1_000_000),\n    type: \"0xdba34...::usdc::USDC\",\n  })(tx),\n  amount: BigInt(1_000_000),\n});\n\nconst result = await suiClient.signAndExecuteTransaction({\n  transaction: tx,\n  signer: keypair,\n});\n```\n\n### Burn Stablecoins\n\n```typescript\nconst tx = new Transaction();\nawait client.buildBurnTx({\n  tx,\n  stableCoinType: \"0x6d9fc...::btc_usdc::BtcUSDC\",\n  amount: BigInt(500_000),\n});\n\nawait suiClient.signAndExecuteTransaction({ transaction: tx, signer: keypair });\n```\n\n### Claim Rewards\n\n```typescript\nconst tx = new Transaction();\nawait client.buildClaimTx({\n  tx,\n  stableCoinType: \"0x6d9fc...::btc_usdc::BtcUSDC\",\n});\n\nawait suiClient.signAndExecuteTransaction({ transaction: tx, signer: keypair });\n```\n\n### Query Supply\n\n```typescript\nconst totalSupply = await client.getTotalSupply();\nconst btcUsdcSupply = await client.getTotalSupplyByCoinType(\"0x6d9fc...::btc_usdc::BtcUSDC\");\n```\n","topics":["Sdk","Typescript"],"tags":{"latest":"1.0.0"},"stats":{"comments":0,"downloads":1139,"installsAllTime":43,"installsCurrent":0,"stars":0,"versions":1},"createdAt":1770882361009,"updatedAt":1778488070529},"latestVersion":{"version":"1.0.0","createdAt":1770882361009,"changelog":"Initial release of the Stable Layer SDK.\n\n- TypeScript SDK for interacting with the Stable Layer protocol on Sui blockchain.\n- Supports minting and burning stablecoins, with USDC as collateral.\n- Includes yield farming reward claiming functionality.\n- Provides supply query methods (total and per stablecoin).\n- Includes usage examples and comprehensive API documentation.","license":null},"metadata":null,"owner":{"handle":"k66inthesky","userId":"s17c7sn4g6a7v5jmj396epdyr58464rf","displayName":"k66 (Lana Chen)","image":"https://avatars.githubusercontent.com/u/45890492?v=4"},"moderation":null}