@shelby-protocol/sdk 0.0.6 → 0.0.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.
@@ -1,15 +1,15 @@
1
1
  import "../chunk-DJJD2AXO.mjs";
2
2
  import "../chunk-MWDW4ROU.mjs";
3
3
  import "../chunk-MQUVYMNQ.mjs";
4
+ import "../chunk-ZHXCVRZX.mjs";
4
5
  import "../chunk-RNXGC54D.mjs";
5
6
  import {
6
7
  ShelbyClient
7
- } from "../chunk-CQZZRXA6.mjs";
8
+ } from "../chunk-AUGZMI6U.mjs";
8
9
  import "../chunk-Z7RFCADT.mjs";
9
10
  import {
10
11
  ShelbyRPCClient
11
12
  } from "../chunk-7P3P3D3X.mjs";
12
- import "../chunk-ZHXCVRZX.mjs";
13
13
  import {
14
14
  isShelbyNetwork,
15
15
  shelbyNetworks
@@ -257,6 +257,41 @@ var ShelbyClient = class {
257
257
  async download(params) {
258
258
  return await this.rpc.getBlob(params);
259
259
  }
260
+ /**
261
+ *
262
+ * Funds an account with ShelbyUSD tokens.
263
+ *
264
+ * @param params.address - The address to fund.
265
+ * @param params.amount - The amount to fund.
266
+ * @returns The transaction hash of the funded account.
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const hash = await client.fundAccount({
271
+ * address: "0x1",
272
+ * amount: 100000000,
273
+ * });
274
+ * ```
275
+ */
276
+ async fundAccount(params) {
277
+ const { address, amount } = params;
278
+ try {
279
+ const faucet = this.config.faucet ?? "https://faucet.shelbynet.shelby.xyz/fund?asset=shelbyusd";
280
+ const response = await fetch(`${faucet}`, {
281
+ method: "POST",
282
+ body: JSON.stringify({ address, amount }),
283
+ headers: {
284
+ "Content-Type": "application/json"
285
+ }
286
+ });
287
+ if (!response.ok) {
288
+ throw new Error("Failed to fund account");
289
+ }
290
+ return response.json();
291
+ } catch (error) {
292
+ throw new Error("Failed to fund account: " + error);
293
+ }
294
+ }
260
295
  };
261
296
 
262
297
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ShelbyClient
3
- } from "./chunk-CQZZRXA6.mjs";
3
+ } from "./chunk-AUGZMI6U.mjs";
4
4
 
5
5
  // src/node/clients/ShelbyNodeClient.ts
6
6
  var ShelbyNodeClient = class extends ShelbyClient {
@@ -171,6 +171,26 @@ declare class ShelbyClient {
171
171
  end?: number;
172
172
  };
173
173
  }): Promise<ShelbyBlob>;
174
+ /**
175
+ *
176
+ * Funds an account with ShelbyUSD tokens.
177
+ *
178
+ * @param params.address - The address to fund.
179
+ * @param params.amount - The amount to fund.
180
+ * @returns The transaction hash of the funded account.
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const hash = await client.fundAccount({
185
+ * address: "0x1",
186
+ * amount: 100000000,
187
+ * });
188
+ * ```
189
+ */
190
+ fundAccount(params: {
191
+ address: AccountAddressInput;
192
+ amount: number;
193
+ }): Promise<any>;
174
194
  }
175
195
 
176
196
  export { ShelbyClient, type UploadOptions };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ShelbyClient
3
- } from "../../chunk-CQZZRXA6.mjs";
3
+ } from "../../chunk-AUGZMI6U.mjs";
4
4
  import "../../chunk-7P3P3D3X.mjs";
5
5
  import "../../chunk-I6NG5GNL.mjs";
6
6
  import "../../chunk-HDYY6NS4.mjs";
@@ -42,6 +42,8 @@ interface ShelbyClientConfig {
42
42
  rpc?: ShelbyRPCConfig;
43
43
  /** An optional indexer configuration for GraphQL queries. If not provided, the default indexer will be used. */
44
44
  indexer?: ShelbyIndexerConfig;
45
+ /** An optional faucet URL for funding accounts. If not provided, the default faucet will be used. */
46
+ faucet?: string;
45
47
  }
46
48
 
47
49
  export type { ShelbyClientConfig, ShelbyIndexerConfig, ShelbyRPCConfig };
@@ -1,7 +1,7 @@
1
1
  import "../../chunk-RNXGC54D.mjs";
2
2
  import {
3
3
  ShelbyClient
4
- } from "../../chunk-CQZZRXA6.mjs";
4
+ } from "../../chunk-AUGZMI6U.mjs";
5
5
  import "../../chunk-Z7RFCADT.mjs";
6
6
  import {
7
7
  ShelbyRPCClient
@@ -1,15 +1,15 @@
1
1
  import "../chunk-DJJD2AXO.mjs";
2
2
  import "../chunk-MWDW4ROU.mjs";
3
3
  import "../chunk-MQUVYMNQ.mjs";
4
+ import "../chunk-ZHXCVRZX.mjs";
4
5
  import "../chunk-RNXGC54D.mjs";
5
6
  import {
6
7
  ShelbyClient
7
- } from "../chunk-CQZZRXA6.mjs";
8
+ } from "../chunk-AUGZMI6U.mjs";
8
9
  import "../chunk-Z7RFCADT.mjs";
9
10
  import {
10
11
  ShelbyRPCClient
11
12
  } from "../chunk-7P3P3D3X.mjs";
12
- import "../chunk-ZHXCVRZX.mjs";
13
13
  import {
14
14
  isShelbyNetwork,
15
15
  shelbyNetworks
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ShelbyNodeClient
3
- } from "../../chunk-2JMRK5PM.mjs";
4
- import "../../chunk-CQZZRXA6.mjs";
3
+ } from "../../chunk-GZJ5IOCG.mjs";
4
+ import "../../chunk-AUGZMI6U.mjs";
5
5
  import "../../chunk-7P3P3D3X.mjs";
6
6
  import "../../chunk-I6NG5GNL.mjs";
7
7
  import "../../chunk-HDYY6NS4.mjs";
@@ -4,8 +4,8 @@ import {
4
4
  } from "../../chunk-CTGCK3H2.mjs";
5
5
  import {
6
6
  ShelbyNodeClient
7
- } from "../../chunk-2JMRK5PM.mjs";
8
- import "../../chunk-CQZZRXA6.mjs";
7
+ } from "../../chunk-GZJ5IOCG.mjs";
8
+ import "../../chunk-AUGZMI6U.mjs";
9
9
  import "../../chunk-7P3P3D3X.mjs";
10
10
  import "../../chunk-I6NG5GNL.mjs";
11
11
  import "../../chunk-HDYY6NS4.mjs";
@@ -4,22 +4,22 @@ import {
4
4
  } from "../chunk-CTGCK3H2.mjs";
5
5
  import {
6
6
  ShelbyNodeClient
7
- } from "../chunk-2JMRK5PM.mjs";
7
+ } from "../chunk-GZJ5IOCG.mjs";
8
8
  import {
9
9
  testUtil_exports
10
10
  } from "../chunk-A4IG6GSE.mjs";
11
11
  import "../chunk-DJJD2AXO.mjs";
12
12
  import "../chunk-MWDW4ROU.mjs";
13
13
  import "../chunk-MQUVYMNQ.mjs";
14
+ import "../chunk-ZHXCVRZX.mjs";
14
15
  import "../chunk-RNXGC54D.mjs";
15
16
  import {
16
17
  ShelbyClient
17
- } from "../chunk-CQZZRXA6.mjs";
18
+ } from "../chunk-AUGZMI6U.mjs";
18
19
  import "../chunk-Z7RFCADT.mjs";
19
20
  import {
20
21
  ShelbyRPCClient
21
22
  } from "../chunk-7P3P3D3X.mjs";
22
- import "../chunk-ZHXCVRZX.mjs";
23
23
  import {
24
24
  isShelbyNetwork,
25
25
  shelbyNetworks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shelby-protocol/sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"