@liquidium/client 0.7.1 → 0.8.1

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
@@ -62,6 +62,8 @@ Amounts use `bigint` values in each asset's smallest unit. Read pool decimals be
62
62
 
63
63
  `Asset.ETH` supports native ETH on `Chain.ETH` and ckETH ICRC transfers on `Chain.ICP`. Both routes use 18 decimals, so amounts are expressed in wei (`0.005 ETH` is `5_000_000_000_000_000n`). For native ETH deposits and repayments, select `mechanism: "transfer"` to send ETH to a generated deposit address or `mechanism: "contractInteraction"` to send ETH through the payable deposit helper. Transfer is the default when `mechanism` is omitted. ckETH routes use the generated ICRC target.
64
64
 
65
+ Native ETH borrows and withdrawals do not support addresses with deployed contract bytecode, including smart contract wallets. The same restriction applies to Simple Loan borrow destinations and native ETH collateral refund destinations.
66
+
65
67
  See the [quick start](https://liquidium-inc.github.io/liquidium-sdk/getting-started/quick-start/) for LTV validation, repayment, and recovery.
66
68
 
67
69
  ## Examples
package/dist/index.cjs CHANGED
@@ -321,6 +321,12 @@ function appendErrorContext(message, context) {
321
321
  return `${message} (${details.join(", ")})`;
322
322
  }
323
323
  function createCanisterContext(opts) {
324
+ if (opts.agent) {
325
+ return {
326
+ agent: opts.agent,
327
+ canisterIds: opts.canisterIds
328
+ };
329
+ }
324
330
  const host = resolveHost(opts.icHost);
325
331
  const agent$1 = agent.HttpAgent.createSync({
326
332
  host,
@@ -1497,7 +1503,9 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
1497
1503
  InvalidEthAddress: IDL.Null,
1498
1504
  CouldNotDecode: IDL.Text,
1499
1505
  ProfileNotFound: IDL.Null,
1500
- InvalidBtcSignature: IDL.Null
1506
+ InvalidBtcSignature: IDL.Null,
1507
+ AnonymousIcpCaller: IDL.Null,
1508
+ InvalidIcpSubaccount: IDL.Null
1501
1509
  });
1502
1510
  const ProtocolError = IDL.Variant({
1503
1511
  PositionNotFound: IDL.Null,
@@ -1617,6 +1625,11 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
1617
1625
  eth_address: IDL.Text,
1618
1626
  lending_profile: IDL.Principal
1619
1627
  }),
1628
+ IcpProfileWarmed: IDL.Record({
1629
+ subaccount: IDL.Vec(IDL.Nat8),
1630
+ warmed_profile_id: IDL.Nat,
1631
+ lending_profile: IDL.Principal
1632
+ }),
1620
1633
  RepayComplete: CreateLoanResponse,
1621
1634
  DepositTimerStarted: IDL.Record({
1622
1635
  loan_id: IDL.Nat,
@@ -1634,6 +1647,9 @@ var flexibleSimpleLoansIdlFactory = ({ IDL }) => {
1634
1647
  derivation_index: IDL.Vec(IDL.Nat8),
1635
1648
  pubkey: IDL.Vec(IDL.Nat8),
1636
1649
  address: IDL.Text
1650
+ }),
1651
+ IcpCaller: IDL.Record({
1652
+ subaccount: IDL.Vec(IDL.Nat8)
1637
1653
  })
1638
1654
  });
1639
1655
  const Loan = IDL.Record({
@@ -7507,6 +7523,15 @@ function mapSimpleLoanEventType(eventType) {
7507
7523
  profileId: event.lending_profile.toText()
7508
7524
  };
7509
7525
  }
7526
+ if ("IcpProfileWarmed" in eventType) {
7527
+ const event = eventType.IcpProfileWarmed;
7528
+ return {
7529
+ type: "IcpProfileWarmed",
7530
+ subaccount: event.subaccount,
7531
+ warmedProfileId: event.warmed_profile_id,
7532
+ profileId: event.lending_profile.toText()
7533
+ };
7534
+ }
7510
7535
  if ("RepayComplete" in eventType) {
7511
7536
  return {
7512
7537
  type: "RepayComplete",
@@ -7529,6 +7554,12 @@ function mapWarmedProfile(profile) {
7529
7554
  };
7530
7555
  }
7531
7556
  function authorizationFromCanister(authorization) {
7557
+ if ("IcpCaller" in authorization) {
7558
+ return {
7559
+ type: "IcpCaller",
7560
+ subaccount: authorization.IcpCaller.subaccount
7561
+ };
7562
+ }
7532
7563
  return {
7533
7564
  type: "EthSignature",
7534
7565
  derivationIndex: authorization.EthSignature.derivation_index,
@@ -7725,6 +7756,7 @@ var LiquidiumClient = class {
7725
7756
  const canisterIds = resolveCanisterIds(environment, config.canisterIds);
7726
7757
  const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
7727
7758
  this.canisterContext = createCanisterContext({
7759
+ agent: config.agent,
7728
7760
  icHost: config.icHost,
7729
7761
  identity: config.identity,
7730
7762
  canisterIds