@gearbox-protocol/sdk 9.10.0 → 9.10.2

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.
@@ -38,10 +38,13 @@ class DealMinter extends import_AbstractMinter.default {
38
38
  super(sdk, anvil, "DealMinter");
39
39
  }
40
40
  async mint(token, dest, amount) {
41
+ let balance = await this.balanceOf(token, dest);
42
+ balance += amount;
43
+ this.logger?.debug(`set balance of ${dest} to ${this.fmt(token, balance)}`);
41
44
  await (0, import_viem_deal.deal)(this.anvil, {
42
45
  erc20: token,
43
46
  account: dest,
44
- amount
47
+ amount: balance
45
48
  });
46
49
  }
47
50
  }
@@ -27,9 +27,9 @@ var import_FallbackMinter = require("./FallbackMinter.js");
27
27
  var import_TransferMinter = require("./TransferMinter.js");
28
28
  function createMinter(sdk, anvil, token) {
29
29
  return new import_FallbackMinter.FallbackMinter(sdk, anvil, [
30
+ new import_DealMinter.DealMinter(sdk, anvil),
30
31
  new import_DirectMinter.DirectMinter(sdk, anvil),
31
- new import_TransferMinter.TransferMinter(sdk, anvil),
32
- new import_DealMinter.DealMinter(sdk, anvil)
32
+ new import_TransferMinter.TransferMinter(sdk, anvil)
33
33
  ]);
34
34
  }
35
35
  // Annotate the CommonJS export names for ESM import in node:
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var providers_exports = {};
20
20
  __export(providers_exports, {
21
21
  getAlchemyUrl: () => getAlchemyUrl,
22
+ getAnkrUrl: () => getAnkrUrl,
22
23
  getDrpcUrl: () => getDrpcUrl,
23
24
  getProviderUrl: () => getProviderUrl
24
25
  });
@@ -29,6 +30,8 @@ function getProviderUrl(provider, network, apiKey, protocol) {
29
30
  return getAlchemyUrl(network, apiKey, protocol);
30
31
  case "drpc":
31
32
  return getDrpcUrl(network, apiKey, protocol);
33
+ case "ankr":
34
+ return getAnkrUrl(network, apiKey, protocol);
32
35
  case "custom": {
33
36
  if (!apiKey.startsWith(protocol)) {
34
37
  throw new Error(`Custom RPC URL must start with ${protocol}`);
@@ -82,9 +85,32 @@ function getDrpcUrl(network, apiKey, protocol) {
82
85
  const net = DRPC_NETS[network];
83
86
  return net ? `${protocol}s://lb.drpc.org/${net}/${apiKey}` : void 0;
84
87
  }
88
+ const ANKR_DOMAINS = {
89
+ Arbitrum: "arbitrum",
90
+ Avalanche: "avalanche",
91
+ Base: "base",
92
+ Berachain: null,
93
+ BNB: "bsc",
94
+ Etherlink: "etherlink_mainnet",
95
+ Hemi: null,
96
+ Lisk: null,
97
+ Mainnet: "eth",
98
+ MegaETH: null,
99
+ Monad: "monad_testnet",
100
+ Optimism: "optimism",
101
+ Plasma: null,
102
+ Sonic: "sonic_mainnet",
103
+ WorldChain: null
104
+ };
105
+ function getAnkrUrl(network, apiKey, protocol) {
106
+ const net = ANKR_DOMAINS[network];
107
+ const sep = protocol === "ws" ? "/ws/" : "/";
108
+ return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
109
+ }
85
110
  // Annotate the CommonJS export names for ESM import in node:
86
111
  0 && (module.exports = {
87
112
  getAlchemyUrl,
113
+ getAnkrUrl,
88
114
  getDrpcUrl,
89
115
  getProviderUrl
90
116
  });
@@ -5,10 +5,13 @@ class DealMinter extends AbstractMinter {
5
5
  super(sdk, anvil, "DealMinter");
6
6
  }
7
7
  async mint(token, dest, amount) {
8
+ let balance = await this.balanceOf(token, dest);
9
+ balance += amount;
10
+ this.logger?.debug(`set balance of ${dest} to ${this.fmt(token, balance)}`);
8
11
  await deal(this.anvil, {
9
12
  erc20: token,
10
13
  account: dest,
11
- amount
14
+ amount: balance
12
15
  });
13
16
  }
14
17
  }
@@ -4,9 +4,9 @@ import { FallbackMinter } from "./FallbackMinter.js";
4
4
  import { TransferMinter } from "./TransferMinter.js";
5
5
  function createMinter(sdk, anvil, token) {
6
6
  return new FallbackMinter(sdk, anvil, [
7
+ new DealMinter(sdk, anvil),
7
8
  new DirectMinter(sdk, anvil),
8
- new TransferMinter(sdk, anvil),
9
- new DealMinter(sdk, anvil)
9
+ new TransferMinter(sdk, anvil)
10
10
  ]);
11
11
  }
12
12
  export {
@@ -4,6 +4,8 @@ function getProviderUrl(provider, network, apiKey, protocol) {
4
4
  return getAlchemyUrl(network, apiKey, protocol);
5
5
  case "drpc":
6
6
  return getDrpcUrl(network, apiKey, protocol);
7
+ case "ankr":
8
+ return getAnkrUrl(network, apiKey, protocol);
7
9
  case "custom": {
8
10
  if (!apiKey.startsWith(protocol)) {
9
11
  throw new Error(`Custom RPC URL must start with ${protocol}`);
@@ -57,8 +59,31 @@ function getDrpcUrl(network, apiKey, protocol) {
57
59
  const net = DRPC_NETS[network];
58
60
  return net ? `${protocol}s://lb.drpc.org/${net}/${apiKey}` : void 0;
59
61
  }
62
+ const ANKR_DOMAINS = {
63
+ Arbitrum: "arbitrum",
64
+ Avalanche: "avalanche",
65
+ Base: "base",
66
+ Berachain: null,
67
+ BNB: "bsc",
68
+ Etherlink: "etherlink_mainnet",
69
+ Hemi: null,
70
+ Lisk: null,
71
+ Mainnet: "eth",
72
+ MegaETH: null,
73
+ Monad: "monad_testnet",
74
+ Optimism: "optimism",
75
+ Plasma: null,
76
+ Sonic: "sonic_mainnet",
77
+ WorldChain: null
78
+ };
79
+ function getAnkrUrl(network, apiKey, protocol) {
80
+ const net = ANKR_DOMAINS[network];
81
+ const sep = protocol === "ws" ? "/ws/" : "/";
82
+ return net ? `${protocol}s://rpc.ankr.com/${net}${sep}${apiKey}` : void 0;
83
+ }
60
84
  export {
61
85
  getAlchemyUrl,
86
+ getAnkrUrl,
62
87
  getDrpcUrl,
63
88
  getProviderUrl
64
89
  };
@@ -1,6 +1,6 @@
1
1
  import type { HttpTransportConfig, WebSocketTransportConfig } from "viem";
2
2
  import type { NetworkType } from "../sdk/index.js";
3
- export type RpcProvider = "alchemy" | "drpc" | "custom";
3
+ export type RpcProvider = "alchemy" | "drpc" | "ankr" | "custom";
4
4
  export interface ProviderConfig {
5
5
  provider: RpcProvider;
6
6
  keys: string[];
@@ -23,3 +23,4 @@ export type CreateTransportConfig = CreateHTTPTransportConfig | CreateWSTranspor
23
23
  export declare function getProviderUrl(provider: RpcProvider, network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
24
24
  export declare function getAlchemyUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
25
25
  export declare function getDrpcUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
26
+ export declare function getAnkrUrl(network: NetworkType, apiKey: string, protocol: "http" | "ws"): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "9.10.0",
3
+ "version": "9.10.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",