@gearbox-protocol/sdk 10.5.0 → 10.6.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.
Files changed (31) hide show
  1. package/dist/cjs/abi/310/generated.js +239 -25
  2. package/dist/cjs/dev/RevolverTransport.js +3 -0
  3. package/dist/cjs/sdk/market/MarketSuite.js +4 -0
  4. package/dist/cjs/sdk/market/credit/CreditFacadeV300Contract.js +4 -1
  5. package/dist/cjs/sdk/market/credit/CreditFacadeV310Contract.js +2 -2
  6. package/dist/cjs/sdk/market/loss-policy/AliasLossPolicyV310Contract.js +40 -0
  7. package/dist/cjs/sdk/market/loss-policy/LossPolicyContract.js +40 -0
  8. package/dist/cjs/sdk/market/loss-policy/createLossPolicy.js +48 -0
  9. package/dist/cjs/sdk/market/loss-policy/index.js +28 -0
  10. package/dist/cjs/sdk/market/loss-policy/types.js +16 -0
  11. package/dist/esm/abi/310/generated.js +238 -25
  12. package/dist/esm/dev/RevolverTransport.js +4 -0
  13. package/dist/esm/sdk/market/MarketSuite.js +6 -0
  14. package/dist/esm/sdk/market/credit/CreditFacadeV300Contract.js +4 -1
  15. package/dist/esm/sdk/market/credit/CreditFacadeV310Contract.js +2 -2
  16. package/dist/esm/sdk/market/loss-policy/AliasLossPolicyV310Contract.js +16 -0
  17. package/dist/esm/sdk/market/loss-policy/LossPolicyContract.js +16 -0
  18. package/dist/esm/sdk/market/loss-policy/createLossPolicy.js +24 -0
  19. package/dist/esm/sdk/market/loss-policy/index.js +4 -0
  20. package/dist/esm/sdk/market/loss-policy/types.js +0 -0
  21. package/dist/types/abi/310/generated.d.ts +292 -22
  22. package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
  23. package/dist/types/sdk/market/credit/CreditFacadeV300Contract.d.ts +2 -2
  24. package/dist/types/sdk/market/credit/CreditFacadeV310Contract.d.ts +2 -2
  25. package/dist/types/sdk/market/loss-policy/AliasLossPolicyV310Contract.d.ts +277 -0
  26. package/dist/types/sdk/market/loss-policy/LossPolicyContract.d.ts +133 -0
  27. package/dist/types/sdk/market/loss-policy/createLossPolicy.d.ts +16 -0
  28. package/dist/types/sdk/market/loss-policy/index.d.ts +4 -0
  29. package/dist/types/sdk/market/loss-policy/types.d.ts +5 -0
  30. package/dist/types/sdk/types/state-human.d.ts +1 -0
  31. package/package.json +1 -1
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var generated_exports = {};
20
20
  __export(generated_exports, {
21
21
  iAddressProviderV310Abi: () => iAddressProviderV310Abi,
22
+ iAliasedLossPolicyV310Abi: () => iAliasedLossPolicyV310Abi,
22
23
  iBotListV310Abi: () => iBotListV310Abi,
23
24
  iCreditConfiguratorV310Abi: () => iCreditConfiguratorV310Abi,
24
25
  iCreditFacadeMulticallV310Abi: () => iCreditFacadeMulticallV310Abi,
@@ -2361,101 +2362,313 @@ const iGaugeV310Abi = [
2361
2362
  const iLossPolicyV310Abi = [
2362
2363
  {
2363
2364
  type: "function",
2364
- inputs: [],
2365
2365
  name: "accessMode",
2366
+ inputs: [],
2366
2367
  outputs: [
2367
- { name: "", internalType: "enum ILossPolicy.AccessMode", type: "uint8" }
2368
+ { name: "", type: "uint8", internalType: "enum ILossPolicy.AccessMode" }
2368
2369
  ],
2369
2370
  stateMutability: "view"
2370
2371
  },
2371
2372
  {
2372
2373
  type: "function",
2373
- inputs: [],
2374
2374
  name: "checksEnabled",
2375
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
2375
+ inputs: [],
2376
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
2376
2377
  stateMutability: "view"
2377
2378
  },
2378
2379
  {
2379
2380
  type: "function",
2380
- inputs: [],
2381
2381
  name: "contractType",
2382
- outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }],
2382
+ inputs: [],
2383
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
2383
2384
  stateMutability: "view"
2384
2385
  },
2385
2386
  {
2386
2387
  type: "function",
2388
+ name: "isLiquidatableWithLoss",
2387
2389
  inputs: [
2388
- { name: "creditAccount", internalType: "address", type: "address" },
2389
- { name: "caller", internalType: "address", type: "address" },
2390
+ { name: "creditAccount", type: "address", internalType: "address" },
2391
+ { name: "caller", type: "address", internalType: "address" },
2390
2392
  {
2391
2393
  name: "params",
2394
+ type: "tuple",
2392
2395
  internalType: "struct ILossPolicy.Params",
2396
+ components: [
2397
+ { name: "totalDebtUSD", type: "uint256", internalType: "uint256" },
2398
+ { name: "twvUSD", type: "uint256", internalType: "uint256" },
2399
+ { name: "extraData", type: "bytes", internalType: "bytes" }
2400
+ ]
2401
+ }
2402
+ ],
2403
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
2404
+ stateMutability: "nonpayable"
2405
+ },
2406
+ {
2407
+ type: "function",
2408
+ name: "serialize",
2409
+ inputs: [],
2410
+ outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
2411
+ stateMutability: "view"
2412
+ },
2413
+ {
2414
+ type: "function",
2415
+ name: "setAccessMode",
2416
+ inputs: [
2417
+ {
2418
+ name: "mode",
2419
+ type: "uint8",
2420
+ internalType: "enum ILossPolicy.AccessMode"
2421
+ }
2422
+ ],
2423
+ outputs: [],
2424
+ stateMutability: "nonpayable"
2425
+ },
2426
+ {
2427
+ type: "function",
2428
+ name: "setChecksEnabled",
2429
+ inputs: [{ name: "enabled", type: "bool", internalType: "bool" }],
2430
+ outputs: [],
2431
+ stateMutability: "nonpayable"
2432
+ },
2433
+ {
2434
+ type: "function",
2435
+ name: "version",
2436
+ inputs: [],
2437
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
2438
+ stateMutability: "view"
2439
+ },
2440
+ {
2441
+ type: "event",
2442
+ name: "SetAccessMode",
2443
+ inputs: [
2444
+ {
2445
+ name: "mode",
2446
+ type: "uint8",
2447
+ indexed: false,
2448
+ internalType: "enum ILossPolicy.AccessMode"
2449
+ }
2450
+ ],
2451
+ anonymous: false
2452
+ },
2453
+ {
2454
+ type: "event",
2455
+ name: "SetChecksEnabled",
2456
+ inputs: [
2457
+ { name: "enabled", type: "bool", indexed: false, internalType: "bool" }
2458
+ ],
2459
+ anonymous: false
2460
+ }
2461
+ ];
2462
+ const iAliasedLossPolicyV310Abi = [
2463
+ {
2464
+ type: "function",
2465
+ name: "accessMode",
2466
+ inputs: [],
2467
+ outputs: [
2468
+ { name: "", type: "uint8", internalType: "enum ILossPolicy.AccessMode" }
2469
+ ],
2470
+ stateMutability: "view"
2471
+ },
2472
+ {
2473
+ type: "function",
2474
+ name: "acl",
2475
+ inputs: [],
2476
+ outputs: [{ name: "", type: "address", internalType: "address" }],
2477
+ stateMutability: "view"
2478
+ },
2479
+ {
2480
+ type: "function",
2481
+ name: "checksEnabled",
2482
+ inputs: [],
2483
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
2484
+ stateMutability: "view"
2485
+ },
2486
+ {
2487
+ type: "function",
2488
+ name: "contractType",
2489
+ inputs: [],
2490
+ outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
2491
+ stateMutability: "view"
2492
+ },
2493
+ {
2494
+ type: "function",
2495
+ name: "getAliasPriceFeedParams",
2496
+ inputs: [{ name: "token", type: "address", internalType: "address" }],
2497
+ outputs: [
2498
+ {
2499
+ name: "",
2393
2500
  type: "tuple",
2501
+ internalType: "struct PriceFeedParams",
2394
2502
  components: [
2395
- { name: "totalDebtUSD", internalType: "uint256", type: "uint256" },
2396
- { name: "twvUSD", internalType: "uint256", type: "uint256" },
2397
- { name: "extraData", internalType: "bytes", type: "bytes" }
2503
+ { name: "priceFeed", type: "address", internalType: "address" },
2504
+ { name: "stalenessPeriod", type: "uint32", internalType: "uint32" },
2505
+ { name: "skipCheck", type: "bool", internalType: "bool" },
2506
+ { name: "tokenDecimals", type: "uint8", internalType: "uint8" }
2398
2507
  ]
2399
2508
  }
2400
2509
  ],
2510
+ stateMutability: "view"
2511
+ },
2512
+ {
2513
+ type: "function",
2514
+ name: "getRequiredAliasPriceFeeds",
2515
+ inputs: [
2516
+ { name: "creditAccount", type: "address", internalType: "address" }
2517
+ ],
2518
+ outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
2519
+ stateMutability: "view"
2520
+ },
2521
+ {
2522
+ type: "function",
2523
+ name: "getTokensWithAlias",
2524
+ inputs: [],
2525
+ outputs: [{ name: "", type: "address[]", internalType: "address[]" }],
2526
+ stateMutability: "view"
2527
+ },
2528
+ {
2529
+ type: "function",
2401
2530
  name: "isLiquidatableWithLoss",
2402
- outputs: [{ name: "", internalType: "bool", type: "bool" }],
2531
+ inputs: [
2532
+ { name: "creditAccount", type: "address", internalType: "address" },
2533
+ { name: "caller", type: "address", internalType: "address" },
2534
+ {
2535
+ name: "params",
2536
+ type: "tuple",
2537
+ internalType: "struct ILossPolicy.Params",
2538
+ components: [
2539
+ { name: "totalDebtUSD", type: "uint256", internalType: "uint256" },
2540
+ { name: "twvUSD", type: "uint256", internalType: "uint256" },
2541
+ { name: "extraData", type: "bytes", internalType: "bytes" }
2542
+ ]
2543
+ }
2544
+ ],
2545
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
2403
2546
  stateMutability: "nonpayable"
2404
2547
  },
2405
2548
  {
2406
2549
  type: "function",
2550
+ name: "pool",
2551
+ inputs: [],
2552
+ outputs: [{ name: "", type: "address", internalType: "address" }],
2553
+ stateMutability: "view"
2554
+ },
2555
+ {
2556
+ type: "function",
2557
+ name: "priceFeedStore",
2407
2558
  inputs: [],
2559
+ outputs: [{ name: "", type: "address", internalType: "address" }],
2560
+ stateMutability: "view"
2561
+ },
2562
+ {
2563
+ type: "function",
2408
2564
  name: "serialize",
2409
- outputs: [{ name: "serializedData", internalType: "bytes", type: "bytes" }],
2565
+ inputs: [],
2566
+ outputs: [{ name: "serializedData", type: "bytes", internalType: "bytes" }],
2410
2567
  stateMutability: "view"
2411
2568
  },
2412
2569
  {
2413
2570
  type: "function",
2571
+ name: "setAccessMode",
2414
2572
  inputs: [
2415
2573
  {
2416
2574
  name: "mode",
2417
- internalType: "enum ILossPolicy.AccessMode",
2418
- type: "uint8"
2575
+ type: "uint8",
2576
+ internalType: "enum ILossPolicy.AccessMode"
2419
2577
  }
2420
2578
  ],
2421
- name: "setAccessMode",
2422
2579
  outputs: [],
2423
2580
  stateMutability: "nonpayable"
2424
2581
  },
2425
2582
  {
2426
2583
  type: "function",
2427
- inputs: [{ name: "enabled", internalType: "bool", type: "bool" }],
2584
+ name: "setAliasPriceFeed",
2585
+ inputs: [
2586
+ { name: "token", type: "address", internalType: "address" },
2587
+ { name: "priceFeed", type: "address", internalType: "address" }
2588
+ ],
2589
+ outputs: [],
2590
+ stateMutability: "nonpayable"
2591
+ },
2592
+ {
2593
+ type: "function",
2428
2594
  name: "setChecksEnabled",
2595
+ inputs: [{ name: "enabled", type: "bool", internalType: "bool" }],
2429
2596
  outputs: [],
2430
2597
  stateMutability: "nonpayable"
2431
2598
  },
2432
2599
  {
2433
2600
  type: "function",
2601
+ name: "underlying",
2434
2602
  inputs: [],
2603
+ outputs: [{ name: "", type: "address", internalType: "address" }],
2604
+ stateMutability: "view"
2605
+ },
2606
+ {
2607
+ type: "function",
2435
2608
  name: "version",
2436
- outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
2609
+ inputs: [],
2610
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
2437
2611
  stateMutability: "view"
2438
2612
  },
2439
2613
  {
2440
2614
  type: "event",
2441
- anonymous: false,
2615
+ name: "SetAccessMode",
2442
2616
  inputs: [
2443
2617
  {
2444
2618
  name: "mode",
2445
- internalType: "enum ILossPolicy.AccessMode",
2446
2619
  type: "uint8",
2447
- indexed: false
2620
+ indexed: false,
2621
+ internalType: "enum ILossPolicy.AccessMode"
2448
2622
  }
2449
2623
  ],
2450
- name: "SetAccessMode"
2624
+ anonymous: false
2451
2625
  },
2452
2626
  {
2453
2627
  type: "event",
2454
- anonymous: false,
2628
+ name: "SetAliasPriceFeed",
2455
2629
  inputs: [
2456
- { name: "enabled", internalType: "bool", type: "bool", indexed: false }
2630
+ {
2631
+ name: "token",
2632
+ type: "address",
2633
+ indexed: true,
2634
+ internalType: "address"
2635
+ },
2636
+ {
2637
+ name: "priceFeed",
2638
+ type: "address",
2639
+ indexed: true,
2640
+ internalType: "address"
2641
+ },
2642
+ {
2643
+ name: "stalenessPeriod",
2644
+ type: "uint32",
2645
+ indexed: false,
2646
+ internalType: "uint32"
2647
+ },
2648
+ { name: "skipCheck", type: "bool", indexed: false, internalType: "bool" }
2649
+ ],
2650
+ anonymous: false
2651
+ },
2652
+ {
2653
+ type: "event",
2654
+ name: "SetChecksEnabled",
2655
+ inputs: [
2656
+ { name: "enabled", type: "bool", indexed: false, internalType: "bool" }
2657
+ ],
2658
+ anonymous: false
2659
+ },
2660
+ {
2661
+ type: "event",
2662
+ name: "UnsetAliasPriceFeed",
2663
+ inputs: [
2664
+ {
2665
+ name: "token",
2666
+ type: "address",
2667
+ indexed: true,
2668
+ internalType: "address"
2669
+ }
2457
2670
  ],
2458
- name: "SetChecksEnabled"
2671
+ anonymous: false
2459
2672
  }
2460
2673
  ];
2461
2674
  const iMarketConfiguratorV310Abi = [
@@ -5151,6 +5364,7 @@ const iTumblerV310Abi = [
5151
5364
  // Annotate the CommonJS export names for ESM import in node:
5152
5365
  0 && (module.exports = {
5153
5366
  iAddressProviderV310Abi,
5367
+ iAliasedLossPolicyV310Abi,
5154
5368
  iBotListV310Abi,
5155
5369
  iCreditConfiguratorV310Abi,
5156
5370
  iCreditFacadeMulticallV310Abi,
@@ -184,6 +184,9 @@ const retryCodes = /* @__PURE__ */ new Set([
184
184
  const defaultShouldRetry = ({
185
185
  error
186
186
  }) => {
187
+ if (error instanceof import_viem.CallExecutionError && error.details === "header not found") {
188
+ return true;
189
+ }
187
190
  if ("code" in error && typeof error.code === "number") {
188
191
  return retryCodes.has(error.code);
189
192
  }
@@ -23,6 +23,7 @@ __export(MarketSuite_exports, {
23
23
  module.exports = __toCommonJS(MarketSuite_exports);
24
24
  var import_base = require("../base/index.js");
25
25
  var import_credit = require("./credit/index.js");
26
+ var import_loss_policy = require("./loss-policy/index.js");
26
27
  var import_MarketConfiguratorContract = require("./MarketConfiguratorContract.js");
27
28
  var import_oracle = require("./oracle/index.js");
28
29
  var import_pool = require("./pool/index.js");
@@ -32,6 +33,7 @@ class MarketSuite extends import_base.SDKConstruct {
32
33
  configurator;
33
34
  pool;
34
35
  priceOracle;
36
+ lossPolicy;
35
37
  creditManagers = [];
36
38
  /**
37
39
  * Original data received from compressor
@@ -58,6 +60,7 @@ class MarketSuite extends import_base.SDKConstruct {
58
60
  this.creditManagers.push(new import_credit.CreditSuite(sdk, marketData, i));
59
61
  }
60
62
  this.priceOracle = (0, import_oracle.getOrCreatePriceOracle)(sdk, marketData.priceOracle);
63
+ this.lossPolicy = (0, import_loss_policy.createLossPolicy)(sdk, marketData.lossPolicy);
61
64
  }
62
65
  get dirty() {
63
66
  return this.configurator.dirty || this.pool.dirty || this.priceOracle.dirty || this.creditManagers.some((cm) => cm.dirty);
@@ -77,6 +80,7 @@ class MarketSuite extends import_base.SDKConstruct {
77
80
  pool: this.pool.stateHuman(raw),
78
81
  creditManagers: this.creditManagers.map((cm) => cm.stateHuman(raw)),
79
82
  priceOracle: this.priceOracle.stateHuman(raw),
83
+ lossPolicy: this.lossPolicy.stateHuman(raw),
80
84
  pausableAdmins: this.state.pausableAdmins.map((a) => this.labelAddress(a)),
81
85
  unpausableAdmins: this.state.unpausableAdmins.map(
82
86
  (a) => this.labelAddress(a)
@@ -81,7 +81,10 @@ class CreditFacadeV300Contract extends import_base.BaseContract {
81
81
  break;
82
82
  }
83
83
  }
84
- liquidateCreditAccount(ca, to, calls) {
84
+ liquidateCreditAccount(ca, to, calls, lossPolicyData) {
85
+ if (lossPolicyData) {
86
+ this.logger?.warn("loss policy data is not supported");
87
+ }
85
88
  return this.createRawTx({
86
89
  functionName: "liquidateCreditAccount",
87
90
  args: [ca, to, calls]
@@ -81,10 +81,10 @@ class CreditFacadeV310Contract extends import_base.BaseContract {
81
81
  break;
82
82
  }
83
83
  }
84
- liquidateCreditAccount(ca, to, calls) {
84
+ liquidateCreditAccount(ca, to, calls, lossPolicyData) {
85
85
  return this.createRawTx({
86
86
  functionName: "liquidateCreditAccount",
87
- args: [ca, to, calls]
87
+ args: lossPolicyData ? [ca, to, calls, lossPolicyData] : [ca, to, calls]
88
88
  });
89
89
  }
90
90
  closeCreditAccount(ca, calls) {
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var AliasLossPolicyV310Contract_exports = {};
20
+ __export(AliasLossPolicyV310Contract_exports, {
21
+ AliasLossPolicyV310Contract: () => AliasLossPolicyV310Contract
22
+ });
23
+ module.exports = __toCommonJS(AliasLossPolicyV310Contract_exports);
24
+ var import_generated = require("../../../abi/310/generated.js");
25
+ var import_base = require("../../base/index.js");
26
+ const abi = import_generated.iAliasedLossPolicyV310Abi;
27
+ class AliasLossPolicyV310Contract extends import_base.BaseContract {
28
+ constructor(sdk, params) {
29
+ super(sdk, {
30
+ abi,
31
+ addr: params.addr,
32
+ contractType: params.contractType,
33
+ version: params.version
34
+ });
35
+ }
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ AliasLossPolicyV310Contract
40
+ });
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var LossPolicyContract_exports = {};
20
+ __export(LossPolicyContract_exports, {
21
+ LossPolicyContract: () => LossPolicyContract
22
+ });
23
+ module.exports = __toCommonJS(LossPolicyContract_exports);
24
+ var import_generated = require("../../../abi/310/generated.js");
25
+ var import_base = require("../../base/index.js");
26
+ const abi = import_generated.iLossPolicyV310Abi;
27
+ class LossPolicyContract extends import_base.BaseContract {
28
+ constructor(sdk, params) {
29
+ super(sdk, {
30
+ abi,
31
+ addr: params.addr,
32
+ contractType: params.contractType,
33
+ version: params.version
34
+ });
35
+ }
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ LossPolicyContract
40
+ });
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var createLossPolicy_exports = {};
20
+ __export(createLossPolicy_exports, {
21
+ createLossPolicy: () => createLossPolicy
22
+ });
23
+ module.exports = __toCommonJS(createLossPolicy_exports);
24
+ var import__ = require("../../index.js");
25
+ var import_AliasLossPolicyV310Contract = require("./AliasLossPolicyV310Contract.js");
26
+ var import_LossPolicyContract = require("./LossPolicyContract.js");
27
+ function createLossPolicy(sdk, { baseParams }) {
28
+ const existing = sdk.contracts.get(baseParams.addr);
29
+ if (existing) {
30
+ return existing;
31
+ }
32
+ const contractType = (0, import__.bytes32ToString)(baseParams.contractType);
33
+ switch (contractType) {
34
+ case "LOSS_POLICY::ALIASED":
35
+ return new import_AliasLossPolicyV310Contract.AliasLossPolicyV310Contract(sdk, baseParams);
36
+ case "LOSS_POLICY::DEFAULT":
37
+ return new import_LossPolicyContract.LossPolicyContract(sdk, baseParams);
38
+ default:
39
+ if (sdk.strictContractTypes) {
40
+ throw new Error(`unsupported loss policy type ${contractType}`);
41
+ }
42
+ return new import_LossPolicyContract.LossPolicyContract(sdk, baseParams);
43
+ }
44
+ }
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ createLossPolicy
48
+ });
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var loss_policy_exports = {};
17
+ module.exports = __toCommonJS(loss_policy_exports);
18
+ __reExport(loss_policy_exports, require("./AliasLossPolicyV310Contract.js"), module.exports);
19
+ __reExport(loss_policy_exports, require("./createLossPolicy.js"), module.exports);
20
+ __reExport(loss_policy_exports, require("./LossPolicyContract.js"), module.exports);
21
+ __reExport(loss_policy_exports, require("./types.js"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./AliasLossPolicyV310Contract.js"),
25
+ ...require("./createLossPolicy.js"),
26
+ ...require("./LossPolicyContract.js"),
27
+ ...require("./types.js")
28
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);