@xoxno/sdk-js 1.0.236 → 1.0.237

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.
@@ -19,7 +19,7 @@
19
19
  * | controller `migrate_from_blend` | `blend_pool.submit(caller, controller, controller, [withdraw / withdraw_collateral / repay])`, at most twice | `contracts/controller/src/external/blend.rs:46-97` |
20
20
  * | controller `borrow`, `withdraw`, `swap_debt`, `swap_collateral`, `repay_debt_with_collateral`, `flash_loan`, `flash_position`, any other | none | the controller funds these from its own custody (`strategies/legs.rs:50`, `strategies/flash_position.rs:285`) |
21
21
  * | governance, any | none | proposer auth only |
22
- * | router `execute_strategy` | `token_in.transfer(sender, router, <= total_in)` | `contracts/swap-aggregator/src/execute/mod.rs:81` |
22
+ * | router `execute_strategy` | `token_in.transfer(sender, router, <= total_in)`; `token_out.trust(sender)` at most once, when the sender has no trustline for a Stellar Asset Contract output (CAP-73) | `contracts/swap-aggregator/src/execute/mod.rs:81`, `:139` |
23
23
  */
24
24
  import { xdr } from '@stellar/stellar-sdk';
25
25
  import { type StellarNetwork } from './contracts.js';
@@ -32,7 +32,7 @@ function _define_property(obj, key, value) {
32
32
  * | controller `migrate_from_blend` | `blend_pool.submit(caller, controller, controller, [withdraw / withdraw_collateral / repay])`, at most twice | `contracts/controller/src/external/blend.rs:46-97` |
33
33
  * | controller `borrow`, `withdraw`, `swap_debt`, `swap_collateral`, `repay_debt_with_collateral`, `flash_loan`, `flash_position`, any other | none | the controller funds these from its own custody (`strategies/legs.rs:50`, `strategies/flash_position.rs:285`) |
34
34
  * | governance, any | none | proposer auth only |
35
- * | router `execute_strategy` | `token_in.transfer(sender, router, <= total_in)` | `contracts/swap-aggregator/src/execute/mod.rs:81` |
35
+ * | router `execute_strategy` | `token_in.transfer(sender, router, <= total_in)`; `token_out.trust(sender)` at most once, when the sender has no trustline for a Stellar Asset Contract output (CAP-73) | `contracts/swap-aggregator/src/execute/mod.rs:81`, `:139` |
36
36
  */ import { Address, scValToBigInt, StrKey, xdr } from "@stellar/stellar-sdk";
37
37
  import { getStellarDeployment } from "./contracts.js";
38
38
  import { decodeStellarRouteBytes } from "./route-verify.js";
@@ -222,6 +222,15 @@ const blendSubmitAllowance = (blendPool, caller, controller)=>({
222
222
  maxAmount: totalIn
223
223
  }
224
224
  ];
225
+ // `ensure_trustline` opens the sender's missing trustline for the output token before the payout.
226
+ policy.calls = [
227
+ {
228
+ contract: route.tokenOut,
229
+ fn: 'trust',
230
+ maxCount: 1,
231
+ reject: (trustArgs)=>trustArgs.length === 1 && addressOf(trustArgs[0]) === caller ? undefined : '`trust` is not for the caller'
232
+ }
233
+ ];
225
234
  return policy;
226
235
  }
227
236
  if (contract !== deployment.lendingController) {