@aspan/sdk 0.1.4 → 0.1.7

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
@@ -23,10 +23,12 @@ pnpm add @aspan/sdk
23
23
 
24
24
  ## Quick Start
25
25
 
26
+ ### Read-Only Client (Query Data)
27
+
26
28
  ```typescript
27
29
  import { createAspanReadClient, formatAmount, formatCR } from "@aspan/sdk";
28
30
 
29
- const DIAMOND = "0xa67e91ebbb709516c563bcf1d9dae355aaf6d2ef";
31
+ const DIAMOND = "0x10d25Ae0690533e0BA9E64EC7ae77dbD4fE8A46f";
30
32
  const client = createAspanReadClient(DIAMOND, "https://bsc-dataseed.binance.org/");
31
33
 
32
34
  const stats = await client.getProtocolStats();
@@ -34,6 +36,53 @@ console.log("TVL:", formatAmount(stats.tvlInUSD), "USD");
34
36
  console.log("CR:", formatCR(stats.collateralRatio));
35
37
  ```
36
38
 
39
+ ### Write Client - Browser (React/wagmi)
40
+
41
+ ```typescript
42
+ import { AspanClient } from "@aspan/sdk";
43
+ import { useWalletClient } from "wagmi";
44
+
45
+ const DIAMOND = "0x10d25Ae0690533e0BA9E64EC7ae77dbD4fE8A46f";
46
+
47
+ function MyComponent() {
48
+ const { data: walletClient } = useWalletClient();
49
+
50
+ const getClient = () => {
51
+ if (!walletClient) return null;
52
+ return new AspanClient({
53
+ diamondAddress: DIAMOND,
54
+ walletClient: walletClient, // Pass wagmi's walletClient
55
+ });
56
+ };
57
+
58
+ const handleMint = async () => {
59
+ const client = getClient();
60
+ if (!client) return;
61
+
62
+ const hash = await client.mintApUSD({
63
+ lstToken: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
64
+ lstAmount: parseAmount("1"),
65
+ });
66
+ console.log("Tx hash:", hash);
67
+ };
68
+ }
69
+ ```
70
+
71
+ ### Write Client - Node.js / Server
72
+
73
+ ```typescript
74
+ import { createAspanClient, parseAmount } from "@aspan/sdk";
75
+ import { privateKeyToAccount } from "viem/accounts";
76
+
77
+ const account = privateKeyToAccount("0x...");
78
+ const client = createAspanClient(DIAMOND, account);
79
+
80
+ const hash = await client.mintApUSD({
81
+ lstToken: "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B",
82
+ lstAmount: parseAmount("1"),
83
+ });
84
+ ```
85
+
37
86
  ---
38
87
 
39
88
  ## User Flows
@@ -42,10 +91,52 @@ console.log("CR:", formatCR(stats.collateralRatio));
42
91
 
43
92
  User deposits LST (e.g., slisBNB) to mint apUSD stablecoin.
44
93
 
94
+ #### Browser (React/wagmi)
95
+
96
+ ```typescript
97
+ import { AspanClient, parseAmount } from "@aspan/sdk";
98
+ import { useWalletClient } from "wagmi";
99
+
100
+ const DIAMOND = "0x10d25Ae0690533e0BA9E64EC7ae77dbD4fE8A46f";
101
+ const SLISBNB = "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B";
102
+
103
+ function MintComponent() {
104
+ const { data: walletClient } = useWalletClient();
105
+
106
+ const handleMint = async () => {
107
+ if (!walletClient) return;
108
+
109
+ const client = new AspanClient({
110
+ diamondAddress: DIAMOND,
111
+ walletClient,
112
+ });
113
+
114
+ const lstAmount = parseAmount("10"); // 10 slisBNB
115
+
116
+ // Step 1: Check LST is supported
117
+ const isSupported = await client.isLSTSupported(SLISBNB);
118
+ if (!isSupported) throw new Error("LST not supported");
119
+
120
+ // Step 2: Check current fees
121
+ const fees = await client.getCurrentFees();
122
+ if (fees.apUSDMintDisabled) throw new Error("Minting disabled");
123
+
124
+ // Step 3: Approve LST (use wagmi's useWriteContract or viem)
125
+ // ...
126
+
127
+ // Step 4: Mint apUSD
128
+ const hash = await client.mintApUSD({ lstToken: SLISBNB, lstAmount });
129
+ const receipt = await client.waitForTransaction(hash);
130
+ console.log("Minted apUSD:", receipt.status);
131
+ };
132
+ }
133
+ ```
134
+
135
+ #### Node.js / Server
136
+
45
137
  ```typescript
46
138
  import { createAspanClient, parseAmount } from "@aspan/sdk";
47
139
  import { privateKeyToAccount } from "viem/accounts";
48
- import { erc20Abi } from "viem";
49
140
 
50
141
  const account = privateKeyToAccount("0x...");
51
142
  const client = createAspanClient(DIAMOND, account);
@@ -394,6 +485,18 @@ displayDashboard();
394
485
 
395
486
  ## API Reference
396
487
 
488
+ ### Client Configuration
489
+
490
+ | Option | Type | Required | Description |
491
+ |--------|------|----------|-------------|
492
+ | `diamondAddress` | `Address` | ✅ | Diamond contract address |
493
+ | `chain` | `Chain` | ❌ | Chain config (default: BSC Mainnet) |
494
+ | `rpcUrl` | `string` | ❌ | RPC URL (default: BSC public RPC) |
495
+ | `walletClient` | `WalletClient` | ⚠️ | For browser/wagmi (required if no account) |
496
+ | `account` | `Account` | ⚠️ | For Node.js (required if no walletClient) |
497
+
498
+ > ⚠️ Write client requires either `walletClient` (browser) or `account` (Node.js)
499
+
397
500
  ### View Functions
398
501
 
399
502
  | Category | Methods |
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as viem from 'viem';
2
- import { Address, Hash, PublicClient, Chain, Account } from 'viem';
2
+ import { Address, Hash, PublicClient, Chain, Account, WalletClient, Transport } from 'viem';
3
3
 
4
4
  /**
5
5
  * Aspan SDK Type Definitions
@@ -199,8 +199,10 @@ interface AspanClientConfig {
199
199
  rpcUrl?: string;
200
200
  }
201
201
  interface AspanWriteClientConfig extends AspanClientConfig {
202
- /** Account for signing transactions */
203
- account: Account;
202
+ /** Account for signing transactions (required if walletClient not provided) */
203
+ account?: Account;
204
+ /** External wallet client (for browser environments with wagmi/rainbowkit) */
205
+ walletClient?: WalletClient<Transport, Chain, Account>;
204
206
  }
205
207
  /**
206
208
  * Read-only client for querying Aspan Protocol state
@@ -240,7 +242,7 @@ declare class AspanReadClient {
240
242
  getBNBPriceUSD(): Promise<bigint>;
241
243
  getLSTPriceUSD(lstToken: Address): Promise<bigint>;
242
244
  getLSTInfo(lstToken: Address): Promise<LSTInfo>;
243
- getSupportedLSTs(): Promise<readonly Address[]>;
245
+ getSupportedLSTs(): Promise<Address[]>;
244
246
  isLSTSupported(lstToken: Address): Promise<boolean>;
245
247
  getBNBPriceFeed(): Promise<Address>;
246
248
  getOracleBounds(priceFeed: Address): Promise<OracleBounds>;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as viem from 'viem';
2
- import { Address, Hash, PublicClient, Chain, Account } from 'viem';
2
+ import { Address, Hash, PublicClient, Chain, Account, WalletClient, Transport } from 'viem';
3
3
 
4
4
  /**
5
5
  * Aspan SDK Type Definitions
@@ -199,8 +199,10 @@ interface AspanClientConfig {
199
199
  rpcUrl?: string;
200
200
  }
201
201
  interface AspanWriteClientConfig extends AspanClientConfig {
202
- /** Account for signing transactions */
203
- account: Account;
202
+ /** Account for signing transactions (required if walletClient not provided) */
203
+ account?: Account;
204
+ /** External wallet client (for browser environments with wagmi/rainbowkit) */
205
+ walletClient?: WalletClient<Transport, Chain, Account>;
204
206
  }
205
207
  /**
206
208
  * Read-only client for querying Aspan Protocol state
@@ -240,7 +242,7 @@ declare class AspanReadClient {
240
242
  getBNBPriceUSD(): Promise<bigint>;
241
243
  getLSTPriceUSD(lstToken: Address): Promise<bigint>;
242
244
  getLSTInfo(lstToken: Address): Promise<LSTInfo>;
243
- getSupportedLSTs(): Promise<readonly Address[]>;
245
+ getSupportedLSTs(): Promise<Address[]>;
244
246
  isLSTSupported(lstToken: Address): Promise<boolean>;
245
247
  getBNBPriceFeed(): Promise<Address>;
246
248
  getOracleBounds(priceFeed: Address): Promise<OracleBounds>;
package/dist/index.js CHANGED
@@ -865,11 +865,12 @@ var AspanReadClient = class _AspanReadClient {
865
865
  };
866
866
  }
867
867
  async getSupportedLSTs() {
868
- return this.publicClient.readContract({
868
+ const result = await this.publicClient.readContract({
869
869
  address: this.diamondAddress,
870
870
  abi: DiamondABI,
871
871
  functionName: "getSupportedLSTs"
872
872
  });
873
+ return [...result];
873
874
  }
874
875
  async isLSTSupported(lstToken) {
875
876
  return this.publicClient.readContract({
@@ -1244,11 +1245,17 @@ var AspanClient = class extends AspanReadClient {
1244
1245
  walletClient;
1245
1246
  constructor(config) {
1246
1247
  super(config);
1247
- this.walletClient = (0, import_viem.createWalletClient)({
1248
- account: config.account,
1249
- chain: this.chain,
1250
- transport: (0, import_viem.http)(config.rpcUrl)
1251
- });
1248
+ if (config.walletClient) {
1249
+ this.walletClient = config.walletClient;
1250
+ } else if (config.account) {
1251
+ this.walletClient = (0, import_viem.createWalletClient)({
1252
+ account: config.account,
1253
+ chain: this.chain,
1254
+ transport: (0, import_viem.http)(config.rpcUrl)
1255
+ });
1256
+ } else {
1257
+ throw new Error("Either walletClient or account must be provided");
1258
+ }
1252
1259
  }
1253
1260
  // ============ Pool Write Functions ============
1254
1261
  /**
@@ -1258,6 +1265,8 @@ var AspanClient = class extends AspanReadClient {
1258
1265
  */
1259
1266
  async mintApUSD(params) {
1260
1267
  return this.walletClient.writeContract({
1268
+ chain: this.chain,
1269
+ account: this.walletClient.account,
1261
1270
  address: this.diamondAddress,
1262
1271
  abi: DiamondABI,
1263
1272
  functionName: "mintApUSD",
@@ -1271,6 +1280,8 @@ var AspanClient = class extends AspanReadClient {
1271
1280
  */
1272
1281
  async redeemApUSD(params) {
1273
1282
  return this.walletClient.writeContract({
1283
+ chain: this.chain,
1284
+ account: this.walletClient.account,
1274
1285
  address: this.diamondAddress,
1275
1286
  abi: DiamondABI,
1276
1287
  functionName: "redeemApUSD",
@@ -1284,6 +1295,8 @@ var AspanClient = class extends AspanReadClient {
1284
1295
  */
1285
1296
  async mintXBNB(params) {
1286
1297
  return this.walletClient.writeContract({
1298
+ chain: this.chain,
1299
+ account: this.walletClient.account,
1287
1300
  address: this.diamondAddress,
1288
1301
  abi: DiamondABI,
1289
1302
  functionName: "mintXBNB",
@@ -1297,6 +1310,8 @@ var AspanClient = class extends AspanReadClient {
1297
1310
  */
1298
1311
  async redeemXBNB(params) {
1299
1312
  return this.walletClient.writeContract({
1313
+ chain: this.chain,
1314
+ account: this.walletClient.account,
1300
1315
  address: this.diamondAddress,
1301
1316
  abi: DiamondABI,
1302
1317
  functionName: "redeemXBNB",
@@ -1311,6 +1326,8 @@ var AspanClient = class extends AspanReadClient {
1311
1326
  */
1312
1327
  async deposit(params) {
1313
1328
  return this.walletClient.writeContract({
1329
+ chain: this.chain,
1330
+ account: this.walletClient.account,
1314
1331
  address: this.diamondAddress,
1315
1332
  abi: DiamondABI,
1316
1333
  functionName: "deposit",
@@ -1324,6 +1341,8 @@ var AspanClient = class extends AspanReadClient {
1324
1341
  */
1325
1342
  async withdraw(params) {
1326
1343
  return this.walletClient.writeContract({
1344
+ chain: this.chain,
1345
+ account: this.walletClient.account,
1327
1346
  address: this.diamondAddress,
1328
1347
  abi: DiamondABI,
1329
1348
  functionName: "withdraw",
@@ -1337,6 +1356,8 @@ var AspanClient = class extends AspanReadClient {
1337
1356
  */
1338
1357
  async withdrawAssets(params) {
1339
1358
  return this.walletClient.writeContract({
1359
+ chain: this.chain,
1360
+ account: this.walletClient.account,
1340
1361
  address: this.diamondAddress,
1341
1362
  abi: DiamondABI,
1342
1363
  functionName: "withdrawAssets",
@@ -1349,6 +1370,8 @@ var AspanClient = class extends AspanReadClient {
1349
1370
  */
1350
1371
  async harvestYield() {
1351
1372
  return this.walletClient.writeContract({
1373
+ chain: this.chain,
1374
+ account: this.walletClient.account,
1352
1375
  address: this.diamondAddress,
1353
1376
  abi: DiamondABI,
1354
1377
  functionName: "harvestYield"
package/dist/index.mjs CHANGED
@@ -828,11 +828,12 @@ var AspanReadClient = class _AspanReadClient {
828
828
  };
829
829
  }
830
830
  async getSupportedLSTs() {
831
- return this.publicClient.readContract({
831
+ const result = await this.publicClient.readContract({
832
832
  address: this.diamondAddress,
833
833
  abi: DiamondABI,
834
834
  functionName: "getSupportedLSTs"
835
835
  });
836
+ return [...result];
836
837
  }
837
838
  async isLSTSupported(lstToken) {
838
839
  return this.publicClient.readContract({
@@ -1207,11 +1208,17 @@ var AspanClient = class extends AspanReadClient {
1207
1208
  walletClient;
1208
1209
  constructor(config) {
1209
1210
  super(config);
1210
- this.walletClient = createWalletClient({
1211
- account: config.account,
1212
- chain: this.chain,
1213
- transport: http(config.rpcUrl)
1214
- });
1211
+ if (config.walletClient) {
1212
+ this.walletClient = config.walletClient;
1213
+ } else if (config.account) {
1214
+ this.walletClient = createWalletClient({
1215
+ account: config.account,
1216
+ chain: this.chain,
1217
+ transport: http(config.rpcUrl)
1218
+ });
1219
+ } else {
1220
+ throw new Error("Either walletClient or account must be provided");
1221
+ }
1215
1222
  }
1216
1223
  // ============ Pool Write Functions ============
1217
1224
  /**
@@ -1221,6 +1228,8 @@ var AspanClient = class extends AspanReadClient {
1221
1228
  */
1222
1229
  async mintApUSD(params) {
1223
1230
  return this.walletClient.writeContract({
1231
+ chain: this.chain,
1232
+ account: this.walletClient.account,
1224
1233
  address: this.diamondAddress,
1225
1234
  abi: DiamondABI,
1226
1235
  functionName: "mintApUSD",
@@ -1234,6 +1243,8 @@ var AspanClient = class extends AspanReadClient {
1234
1243
  */
1235
1244
  async redeemApUSD(params) {
1236
1245
  return this.walletClient.writeContract({
1246
+ chain: this.chain,
1247
+ account: this.walletClient.account,
1237
1248
  address: this.diamondAddress,
1238
1249
  abi: DiamondABI,
1239
1250
  functionName: "redeemApUSD",
@@ -1247,6 +1258,8 @@ var AspanClient = class extends AspanReadClient {
1247
1258
  */
1248
1259
  async mintXBNB(params) {
1249
1260
  return this.walletClient.writeContract({
1261
+ chain: this.chain,
1262
+ account: this.walletClient.account,
1250
1263
  address: this.diamondAddress,
1251
1264
  abi: DiamondABI,
1252
1265
  functionName: "mintXBNB",
@@ -1260,6 +1273,8 @@ var AspanClient = class extends AspanReadClient {
1260
1273
  */
1261
1274
  async redeemXBNB(params) {
1262
1275
  return this.walletClient.writeContract({
1276
+ chain: this.chain,
1277
+ account: this.walletClient.account,
1263
1278
  address: this.diamondAddress,
1264
1279
  abi: DiamondABI,
1265
1280
  functionName: "redeemXBNB",
@@ -1274,6 +1289,8 @@ var AspanClient = class extends AspanReadClient {
1274
1289
  */
1275
1290
  async deposit(params) {
1276
1291
  return this.walletClient.writeContract({
1292
+ chain: this.chain,
1293
+ account: this.walletClient.account,
1277
1294
  address: this.diamondAddress,
1278
1295
  abi: DiamondABI,
1279
1296
  functionName: "deposit",
@@ -1287,6 +1304,8 @@ var AspanClient = class extends AspanReadClient {
1287
1304
  */
1288
1305
  async withdraw(params) {
1289
1306
  return this.walletClient.writeContract({
1307
+ chain: this.chain,
1308
+ account: this.walletClient.account,
1290
1309
  address: this.diamondAddress,
1291
1310
  abi: DiamondABI,
1292
1311
  functionName: "withdraw",
@@ -1300,6 +1319,8 @@ var AspanClient = class extends AspanReadClient {
1300
1319
  */
1301
1320
  async withdrawAssets(params) {
1302
1321
  return this.walletClient.writeContract({
1322
+ chain: this.chain,
1323
+ account: this.walletClient.account,
1303
1324
  address: this.diamondAddress,
1304
1325
  abi: DiamondABI,
1305
1326
  functionName: "withdrawAssets",
@@ -1312,6 +1333,8 @@ var AspanClient = class extends AspanReadClient {
1312
1333
  */
1313
1334
  async harvestYield() {
1314
1335
  return this.walletClient.writeContract({
1336
+ chain: this.chain,
1337
+ account: this.walletClient.account,
1315
1338
  address: this.diamondAddress,
1316
1339
  abi: DiamondABI,
1317
1340
  functionName: "harvestYield"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspan/sdk",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "TypeScript SDK for Aspan Protocol - LST-backed stablecoin on BNB Chain",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/client.ts CHANGED
@@ -52,8 +52,10 @@ export interface AspanClientConfig {
52
52
  }
53
53
 
54
54
  export interface AspanWriteClientConfig extends AspanClientConfig {
55
- /** Account for signing transactions */
56
- account: Account;
55
+ /** Account for signing transactions (required if walletClient not provided) */
56
+ account?: Account;
57
+ /** External wallet client (for browser environments with wagmi/rainbowkit) */
58
+ walletClient?: WalletClient<Transport, Chain, Account>;
57
59
  }
58
60
 
59
61
  // ============ Read-Only Client ============
@@ -398,12 +400,13 @@ export class AspanReadClient {
398
400
  };
399
401
  }
400
402
 
401
- async getSupportedLSTs(): Promise<readonly Address[]> {
402
- return this.publicClient.readContract({
403
+ async getSupportedLSTs(): Promise<Address[]> {
404
+ const result = await this.publicClient.readContract({
403
405
  address: this.diamondAddress,
404
406
  abi: DiamondABI,
405
407
  functionName: "getSupportedLSTs",
406
408
  });
409
+ return [...result];
407
410
  }
408
411
 
409
412
  async isLSTSupported(lstToken: Address): Promise<boolean> {
@@ -829,16 +832,24 @@ export class AspanReadClient {
829
832
  * Full client with write capabilities for interacting with Aspan Protocol
830
833
  */
831
834
  export class AspanClient extends AspanReadClient {
832
- private readonly walletClient: WalletClient<Transport, Chain, Account>;
835
+ private readonly walletClient: WalletClient;
833
836
 
834
837
  constructor(config: AspanWriteClientConfig) {
835
838
  super(config);
836
839
 
837
- this.walletClient = createWalletClient({
838
- account: config.account,
839
- chain: this.chain,
840
- transport: http(config.rpcUrl),
841
- });
840
+ // Use external walletClient if provided (browser environment with wagmi/rainbowkit)
841
+ // Otherwise create internal walletClient (server environment)
842
+ if (config.walletClient) {
843
+ this.walletClient = config.walletClient;
844
+ } else if (config.account) {
845
+ this.walletClient = createWalletClient({
846
+ account: config.account,
847
+ chain: this.chain,
848
+ transport: http(config.rpcUrl),
849
+ });
850
+ } else {
851
+ throw new Error('Either walletClient or account must be provided');
852
+ }
842
853
  }
843
854
 
844
855
  // ============ Pool Write Functions ============
@@ -850,6 +861,8 @@ export class AspanClient extends AspanReadClient {
850
861
  */
851
862
  async mintApUSD(params: MintApUSDParams): Promise<Hash> {
852
863
  return this.walletClient.writeContract({
864
+ chain: this.chain,
865
+ account: this.walletClient.account!,
853
866
  address: this.diamondAddress,
854
867
  abi: DiamondABI,
855
868
  functionName: "mintApUSD",
@@ -864,6 +877,8 @@ export class AspanClient extends AspanReadClient {
864
877
  */
865
878
  async redeemApUSD(params: RedeemApUSDParams): Promise<Hash> {
866
879
  return this.walletClient.writeContract({
880
+ chain: this.chain,
881
+ account: this.walletClient.account!,
867
882
  address: this.diamondAddress,
868
883
  abi: DiamondABI,
869
884
  functionName: "redeemApUSD",
@@ -878,6 +893,8 @@ export class AspanClient extends AspanReadClient {
878
893
  */
879
894
  async mintXBNB(params: MintXBNBParams): Promise<Hash> {
880
895
  return this.walletClient.writeContract({
896
+ chain: this.chain,
897
+ account: this.walletClient.account!,
881
898
  address: this.diamondAddress,
882
899
  abi: DiamondABI,
883
900
  functionName: "mintXBNB",
@@ -892,6 +909,8 @@ export class AspanClient extends AspanReadClient {
892
909
  */
893
910
  async redeemXBNB(params: RedeemXBNBParams): Promise<Hash> {
894
911
  return this.walletClient.writeContract({
912
+ chain: this.chain,
913
+ account: this.walletClient.account!,
895
914
  address: this.diamondAddress,
896
915
  abi: DiamondABI,
897
916
  functionName: "redeemXBNB",
@@ -908,6 +927,8 @@ export class AspanClient extends AspanReadClient {
908
927
  */
909
928
  async deposit(params: DepositParams): Promise<Hash> {
910
929
  return this.walletClient.writeContract({
930
+ chain: this.chain,
931
+ account: this.walletClient.account!,
911
932
  address: this.diamondAddress,
912
933
  abi: DiamondABI,
913
934
  functionName: "deposit",
@@ -922,6 +943,8 @@ export class AspanClient extends AspanReadClient {
922
943
  */
923
944
  async withdraw(params: WithdrawParams): Promise<Hash> {
924
945
  return this.walletClient.writeContract({
946
+ chain: this.chain,
947
+ account: this.walletClient.account!,
925
948
  address: this.diamondAddress,
926
949
  abi: DiamondABI,
927
950
  functionName: "withdraw",
@@ -936,6 +959,8 @@ export class AspanClient extends AspanReadClient {
936
959
  */
937
960
  async withdrawAssets(params: WithdrawAssetsParams): Promise<Hash> {
938
961
  return this.walletClient.writeContract({
962
+ chain: this.chain,
963
+ account: this.walletClient.account!,
939
964
  address: this.diamondAddress,
940
965
  abi: DiamondABI,
941
966
  functionName: "withdrawAssets",
@@ -949,6 +974,8 @@ export class AspanClient extends AspanReadClient {
949
974
  */
950
975
  async harvestYield(): Promise<Hash> {
951
976
  return this.walletClient.writeContract({
977
+ chain: this.chain,
978
+ account: this.walletClient.account!,
952
979
  address: this.diamondAddress,
953
980
  abi: DiamondABI,
954
981
  functionName: "harvestYield",