@perena/vault-sdk 1.0.20 → 1.0.23
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 +35 -0
- package/dist/index.d.ts +228 -160
- package/dist/index.js +389 -204
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -105,6 +105,41 @@ const plan = await client.tx.executeDeposit.getTx({
|
|
|
105
105
|
const sig = await client.sendTransaction(payer, plan);
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
+
### Squads proposal routing
|
|
109
|
+
|
|
110
|
+
Browser integrations can map a connected Squads member wallet to a multisig and
|
|
111
|
+
vault index, then use the derived vault PDA while building the instruction:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import {
|
|
115
|
+
prepareVaultTransaction,
|
|
116
|
+
vaultAuthorityForWallet,
|
|
117
|
+
type SquadsWalletRouteConfig,
|
|
118
|
+
} from "@perena/vault-sdk";
|
|
119
|
+
|
|
120
|
+
const routes: SquadsWalletRouteConfig[] = [
|
|
121
|
+
{ wallet: "MEMBER_WALLET", multisigPda: "MULTISIG_PDA", vaultIndex: 0 },
|
|
122
|
+
];
|
|
123
|
+
const authority = vaultAuthorityForWallet(connectedWallet, routes);
|
|
124
|
+
const plan = await client.tx.setVaultConfig.getTx({
|
|
125
|
+
curator: address(authority.toBase58()),
|
|
126
|
+
// ...
|
|
127
|
+
});
|
|
128
|
+
const prepared = await prepareVaultTransaction({
|
|
129
|
+
connection,
|
|
130
|
+
proposer: connectedWallet,
|
|
131
|
+
instructions: plan.instructions.map(fromKitInstruction),
|
|
132
|
+
squadsRoutes: routes,
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
When the wallet is configured, `prepared.transaction` creates a Squads vault
|
|
137
|
+
transaction and proposal. The member signs and submits that outer transaction;
|
|
138
|
+
the multisig must still approve and execute the proposal. When no route matches,
|
|
139
|
+
the helper returns the original instructions as a normal direct transaction.
|
|
140
|
+
The configured member must have Squads' `Initiate` permission, and the vault
|
|
141
|
+
program role must be assigned to the derived Squads vault PDA.
|
|
142
|
+
|
|
108
143
|
`VaultTransactionPlan` contains:
|
|
109
144
|
|
|
110
145
|
- `instructions` — ordered `@solana/kit` instructions (preamble + program ix)
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _solana_kit from '@solana/kit';
|
|
|
2
2
|
import { Address, ProgramDerivedAddressBump, Rpc, SolanaRpcApi, Instruction } from '@solana/kit';
|
|
3
3
|
export { address } from '@solana/kit';
|
|
4
4
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
5
|
-
import { PublicKey, Connection, Keypair, TransactionInstruction } from '@solana/web3.js';
|
|
5
|
+
import { PublicKey, Connection, Keypair, Transaction, TransactionInstruction } from '@solana/web3.js';
|
|
6
6
|
import * as _anchor_lang_core from '@anchor-lang/core';
|
|
7
7
|
import { Program, IdlAccounts, BN, AnchorProvider } from '@anchor-lang/core';
|
|
8
8
|
import * as common from 'common';
|
|
@@ -9543,224 +9543,239 @@ type Bankineco = {
|
|
|
9543
9543
|
];
|
|
9544
9544
|
"errors": [
|
|
9545
9545
|
{
|
|
9546
|
-
"code":
|
|
9547
|
-
"name": "
|
|
9548
|
-
"msg": "
|
|
9546
|
+
"code": 14001;
|
|
9547
|
+
"name": "unauthorized";
|
|
9548
|
+
"msg": "You are not authorized to perform this action.";
|
|
9549
9549
|
},
|
|
9550
9550
|
{
|
|
9551
|
-
"code":
|
|
9552
|
-
"name": "
|
|
9553
|
-
"msg": "
|
|
9551
|
+
"code": 14002;
|
|
9552
|
+
"name": "invalidBankMint";
|
|
9553
|
+
"msg": "Invalid mint";
|
|
9554
9554
|
},
|
|
9555
9555
|
{
|
|
9556
|
-
"code":
|
|
9557
|
-
"name": "
|
|
9558
|
-
"msg": "
|
|
9556
|
+
"code": 14003;
|
|
9557
|
+
"name": "accountingIssue";
|
|
9558
|
+
"msg": "Accounting issue";
|
|
9559
9559
|
},
|
|
9560
9560
|
{
|
|
9561
|
-
"code":
|
|
9562
|
-
"name": "
|
|
9563
|
-
"msg": "
|
|
9561
|
+
"code": 14004;
|
|
9562
|
+
"name": "vaultAccountingIssue";
|
|
9563
|
+
"msg": "Vault accounting issue";
|
|
9564
9564
|
},
|
|
9565
9565
|
{
|
|
9566
|
-
"code":
|
|
9567
|
-
"name": "
|
|
9568
|
-
"msg": "
|
|
9566
|
+
"code": 14005;
|
|
9567
|
+
"name": "bankAccountingIssue";
|
|
9568
|
+
"msg": "Bank accounting issue";
|
|
9569
9569
|
},
|
|
9570
9570
|
{
|
|
9571
|
-
"code":
|
|
9572
|
-
"name": "
|
|
9573
|
-
"msg": "
|
|
9571
|
+
"code": 14006;
|
|
9572
|
+
"name": "onchainAccountingIssue";
|
|
9573
|
+
"msg": "Onchain accounting issue";
|
|
9574
9574
|
},
|
|
9575
9575
|
{
|
|
9576
|
-
"code":
|
|
9577
|
-
"name": "
|
|
9578
|
-
"msg": "
|
|
9576
|
+
"code": 14007;
|
|
9577
|
+
"name": "externalAccountingIssue";
|
|
9578
|
+
"msg": "External accounting issue";
|
|
9579
9579
|
},
|
|
9580
9580
|
{
|
|
9581
|
-
"code":
|
|
9582
|
-
"name": "
|
|
9583
|
-
"msg": "
|
|
9581
|
+
"code": 14008;
|
|
9582
|
+
"name": "mintSlippage";
|
|
9583
|
+
"msg": "Minting failed due to slippage.";
|
|
9584
9584
|
},
|
|
9585
9585
|
{
|
|
9586
|
-
"code":
|
|
9587
|
-
"name": "
|
|
9588
|
-
"msg": "
|
|
9586
|
+
"code": 14009;
|
|
9587
|
+
"name": "burningSlippage";
|
|
9588
|
+
"msg": "Burning failed due to slippage.";
|
|
9589
9589
|
},
|
|
9590
9590
|
{
|
|
9591
|
-
"code":
|
|
9591
|
+
"code": 14010;
|
|
9592
|
+
"name": "teamAccountAlreadyExists";
|
|
9593
|
+
"msg": "Team account already exists";
|
|
9594
|
+
},
|
|
9595
|
+
{
|
|
9596
|
+
"code": 14011;
|
|
9597
|
+
"name": "oracleAccountAlreadyExists";
|
|
9598
|
+
"msg": "Oracle account already exists";
|
|
9599
|
+
},
|
|
9600
|
+
{
|
|
9601
|
+
"code": 14012;
|
|
9592
9602
|
"name": "staleOracle";
|
|
9593
|
-
"msg": "
|
|
9603
|
+
"msg": "Stale oracle";
|
|
9594
9604
|
},
|
|
9595
9605
|
{
|
|
9596
|
-
"code":
|
|
9597
|
-
"name": "
|
|
9598
|
-
"msg": "
|
|
9606
|
+
"code": 14013;
|
|
9607
|
+
"name": "localSignificantPriceChange";
|
|
9608
|
+
"msg": "Price change is too large locally";
|
|
9599
9609
|
},
|
|
9600
9610
|
{
|
|
9601
|
-
"code":
|
|
9602
|
-
"name": "
|
|
9603
|
-
"msg": "
|
|
9611
|
+
"code": 14014;
|
|
9612
|
+
"name": "significantPriceChange";
|
|
9613
|
+
"msg": "Price change is too large";
|
|
9604
9614
|
},
|
|
9605
9615
|
{
|
|
9606
|
-
"code":
|
|
9607
|
-
"name": "
|
|
9608
|
-
"msg": "
|
|
9616
|
+
"code": 14015;
|
|
9617
|
+
"name": "roundingImpact";
|
|
9618
|
+
"msg": "Rounding impacts the protocol";
|
|
9609
9619
|
},
|
|
9610
9620
|
{
|
|
9611
|
-
"code":
|
|
9612
|
-
"name": "
|
|
9613
|
-
"msg": "
|
|
9621
|
+
"code": 14016;
|
|
9622
|
+
"name": "bankIsHalted";
|
|
9623
|
+
"msg": "Bank is halted";
|
|
9614
9624
|
},
|
|
9615
9625
|
{
|
|
9616
|
-
"code":
|
|
9617
|
-
"name": "
|
|
9618
|
-
"msg": "
|
|
9626
|
+
"code": 14017;
|
|
9627
|
+
"name": "vaultIsHalted";
|
|
9628
|
+
"msg": "Vault is halted";
|
|
9619
9629
|
},
|
|
9620
9630
|
{
|
|
9621
|
-
"code":
|
|
9622
|
-
"name": "
|
|
9623
|
-
"msg": "
|
|
9631
|
+
"code": 14018;
|
|
9632
|
+
"name": "conversionOverflow";
|
|
9633
|
+
"msg": "Conversion Overflow";
|
|
9624
9634
|
},
|
|
9625
9635
|
{
|
|
9626
|
-
"code":
|
|
9627
|
-
"name": "
|
|
9628
|
-
"msg": "
|
|
9636
|
+
"code": 14019;
|
|
9637
|
+
"name": "reserved8019";
|
|
9638
|
+
"msg": "reserved";
|
|
9629
9639
|
},
|
|
9630
9640
|
{
|
|
9631
|
-
"code":
|
|
9632
|
-
"name": "
|
|
9633
|
-
"msg": "
|
|
9641
|
+
"code": 14020;
|
|
9642
|
+
"name": "invalidArgument";
|
|
9643
|
+
"msg": "Invalid argument";
|
|
9634
9644
|
},
|
|
9635
9645
|
{
|
|
9636
|
-
"code":
|
|
9637
|
-
"name": "
|
|
9638
|
-
"msg": "
|
|
9646
|
+
"code": 14021;
|
|
9647
|
+
"name": "userSanityCheck";
|
|
9648
|
+
"msg": "User Sanity Check";
|
|
9639
9649
|
},
|
|
9640
9650
|
{
|
|
9641
|
-
"code":
|
|
9642
|
-
"name": "
|
|
9643
|
-
"msg": "
|
|
9651
|
+
"code": 14022;
|
|
9652
|
+
"name": "mathOverflow";
|
|
9653
|
+
"msg": "Math overflow";
|
|
9644
9654
|
},
|
|
9645
9655
|
{
|
|
9646
|
-
"code":
|
|
9647
|
-
"name": "
|
|
9648
|
-
"msg": "
|
|
9656
|
+
"code": 14023;
|
|
9657
|
+
"name": "invalidMarginFiAccount";
|
|
9658
|
+
"msg": "Invalid MarginFi account - must be correct PDA for this vault";
|
|
9649
9659
|
},
|
|
9650
9660
|
{
|
|
9651
|
-
"code":
|
|
9652
|
-
"name": "
|
|
9653
|
-
"msg": "Invalid
|
|
9661
|
+
"code": 14024;
|
|
9662
|
+
"name": "invalidStartMarker";
|
|
9663
|
+
"msg": "Invalid start marker";
|
|
9654
9664
|
},
|
|
9655
9665
|
{
|
|
9656
|
-
"code":
|
|
9657
|
-
"name": "
|
|
9658
|
-
"msg": "
|
|
9666
|
+
"code": 14025;
|
|
9667
|
+
"name": "oracleUpdateOnEmptyReserve";
|
|
9668
|
+
"msg": "Unable to push oracle update on an empty vault reserve";
|
|
9659
9669
|
},
|
|
9660
9670
|
{
|
|
9661
|
-
"code":
|
|
9662
|
-
"name": "
|
|
9663
|
-
"msg": "
|
|
9671
|
+
"code": 14026;
|
|
9672
|
+
"name": "invalidRemainingAccountsLength";
|
|
9673
|
+
"msg": "Invalid remaining accounts length";
|
|
9664
9674
|
},
|
|
9665
9675
|
{
|
|
9666
|
-
"code":
|
|
9667
|
-
"name": "
|
|
9668
|
-
"msg": "
|
|
9676
|
+
"code": 14027;
|
|
9677
|
+
"name": "withdrawalExceedsBalance";
|
|
9678
|
+
"msg": "Specified withdrawal exceeds available balance";
|
|
9669
9679
|
},
|
|
9670
9680
|
{
|
|
9671
|
-
"code":
|
|
9672
|
-
"name": "
|
|
9673
|
-
"msg": "
|
|
9681
|
+
"code": 14028;
|
|
9682
|
+
"name": "insufficientPendingYield";
|
|
9683
|
+
"msg": "Insufficient pending yield";
|
|
9674
9684
|
},
|
|
9675
9685
|
{
|
|
9676
|
-
"code":
|
|
9677
|
-
"name": "
|
|
9678
|
-
"msg": "
|
|
9686
|
+
"code": 14029;
|
|
9687
|
+
"name": "notSupported";
|
|
9688
|
+
"msg": "Not supported";
|
|
9679
9689
|
},
|
|
9680
9690
|
{
|
|
9681
|
-
"code":
|
|
9682
|
-
"name": "
|
|
9683
|
-
"msg": "
|
|
9691
|
+
"code": 14030;
|
|
9692
|
+
"name": "exceedsMaxYieldingTvl";
|
|
9693
|
+
"msg": "Exceeds maximum yielding TVL";
|
|
9684
9694
|
},
|
|
9685
9695
|
{
|
|
9686
|
-
"code":
|
|
9687
|
-
"name": "
|
|
9688
|
-
"msg": "
|
|
9696
|
+
"code": 14031;
|
|
9697
|
+
"name": "tranchingNotEnabled";
|
|
9698
|
+
"msg": "Tranching is not enabled for this bank";
|
|
9689
9699
|
},
|
|
9690
9700
|
{
|
|
9691
|
-
"code":
|
|
9692
|
-
"name": "
|
|
9693
|
-
"msg": "Invalid
|
|
9701
|
+
"code": 14032;
|
|
9702
|
+
"name": "invalidLeverageFactor";
|
|
9703
|
+
"msg": "Invalid leverage factor - must be at least 10000 (1x)";
|
|
9694
9704
|
},
|
|
9695
9705
|
{
|
|
9696
|
-
"code":
|
|
9697
|
-
"name": "
|
|
9698
|
-
"msg": "
|
|
9706
|
+
"code": 14033;
|
|
9707
|
+
"name": "insufficientStakedAmount";
|
|
9708
|
+
"msg": "Insufficient staked amount";
|
|
9699
9709
|
},
|
|
9700
9710
|
{
|
|
9701
|
-
"code":
|
|
9702
|
-
"name": "
|
|
9703
|
-
"msg": "
|
|
9711
|
+
"code": 14034;
|
|
9712
|
+
"name": "juniorTrancheEmpty";
|
|
9713
|
+
"msg": "Junior tranche has no value";
|
|
9704
9714
|
},
|
|
9705
9715
|
{
|
|
9706
|
-
"code":
|
|
9707
|
-
"name": "
|
|
9708
|
-
"msg": "Invalid
|
|
9716
|
+
"code": 14035;
|
|
9717
|
+
"name": "invalidTrancheConfig";
|
|
9718
|
+
"msg": "Invalid tranche config parameter";
|
|
9709
9719
|
},
|
|
9710
9720
|
{
|
|
9711
|
-
"code":
|
|
9712
|
-
"name": "
|
|
9713
|
-
"msg": "
|
|
9721
|
+
"code": 14036;
|
|
9722
|
+
"name": "withdrawalQueueNotExpired";
|
|
9723
|
+
"msg": "Withdrawal queue lockup period has not expired";
|
|
9714
9724
|
},
|
|
9715
9725
|
{
|
|
9716
|
-
"code":
|
|
9717
|
-
"name": "
|
|
9718
|
-
"msg": "
|
|
9726
|
+
"code": 14037;
|
|
9727
|
+
"name": "invalidWithdrawalQueue";
|
|
9728
|
+
"msg": "Withdrawal queue entry is not in a valid state";
|
|
9729
|
+
},
|
|
9730
|
+
{
|
|
9731
|
+
"code": 14038;
|
|
9732
|
+
"name": "invalidAccount";
|
|
9733
|
+
"msg": "Account does not belong to the expected parent";
|
|
9719
9734
|
},
|
|
9720
9735
|
{
|
|
9721
|
-
"code":
|
|
9722
|
-
"name": "
|
|
9723
|
-
"msg": "
|
|
9736
|
+
"code": 14039;
|
|
9737
|
+
"name": "missingAccount";
|
|
9738
|
+
"msg": "Required optional account is missing";
|
|
9724
9739
|
},
|
|
9725
9740
|
{
|
|
9726
|
-
"code":
|
|
9727
|
-
"name": "
|
|
9728
|
-
"msg": "
|
|
9741
|
+
"code": 14040;
|
|
9742
|
+
"name": "trancheWipedOut";
|
|
9743
|
+
"msg": "Junior tranche is wiped out and cannot accept new stakes";
|
|
9729
9744
|
},
|
|
9730
9745
|
{
|
|
9731
|
-
"code":
|
|
9732
|
-
"name": "
|
|
9733
|
-
"msg": "
|
|
9746
|
+
"code": 14041;
|
|
9747
|
+
"name": "vaultLossNotAccepted";
|
|
9748
|
+
"msg": "Vault does not accept losses — enable losses_accepted before retrying";
|
|
9734
9749
|
},
|
|
9735
9750
|
{
|
|
9736
|
-
"code":
|
|
9737
|
-
"name": "
|
|
9738
|
-
"msg": "
|
|
9751
|
+
"code": 14042;
|
|
9752
|
+
"name": "capitalLossExceedsReserve";
|
|
9753
|
+
"msg": "Capital loss exceeds available yielding reserve";
|
|
9739
9754
|
},
|
|
9740
9755
|
{
|
|
9741
|
-
"code":
|
|
9742
|
-
"name": "
|
|
9743
|
-
"msg": "
|
|
9756
|
+
"code": 14043;
|
|
9757
|
+
"name": "rollingWithdrawalLimitExceeded";
|
|
9758
|
+
"msg": "Rolling withdrawal limit exceeded";
|
|
9744
9759
|
},
|
|
9745
9760
|
{
|
|
9746
|
-
"code":
|
|
9747
|
-
"name": "
|
|
9748
|
-
"msg": "
|
|
9761
|
+
"code": 14044;
|
|
9762
|
+
"name": "vaultAlreadyMigrated";
|
|
9763
|
+
"msg": "Legacy vault has already been migrated";
|
|
9749
9764
|
},
|
|
9750
9765
|
{
|
|
9751
|
-
"code":
|
|
9752
|
-
"name": "
|
|
9753
|
-
"msg": "
|
|
9766
|
+
"code": 14045;
|
|
9767
|
+
"name": "invalidMigrationState";
|
|
9768
|
+
"msg": "Legacy vault migration is incomplete or invalid";
|
|
9754
9769
|
},
|
|
9755
9770
|
{
|
|
9756
|
-
"code":
|
|
9757
|
-
"name": "
|
|
9758
|
-
"msg": "
|
|
9771
|
+
"code": 14046;
|
|
9772
|
+
"name": "invalidMigrationMintAuthority";
|
|
9773
|
+
"msg": "Mint authority does not match the expected migration source";
|
|
9759
9774
|
},
|
|
9760
9775
|
{
|
|
9761
|
-
"code":
|
|
9762
|
-
"name": "
|
|
9763
|
-
"msg": "
|
|
9776
|
+
"code": 14047;
|
|
9777
|
+
"name": "bankMigrationIncomplete";
|
|
9778
|
+
"msg": "Legacy bank or tranche migration is incomplete — source accounting and escrow must be fully drained before mint authority transfer";
|
|
9764
9779
|
}
|
|
9765
9780
|
];
|
|
9766
9781
|
"types": [
|
|
@@ -15397,6 +15412,68 @@ declare function makeProvider(connection: Connection, payer: Keypair): AnchorPro
|
|
|
15397
15412
|
|
|
15398
15413
|
declare function createRpcFromConnection(connection: Connection): Rpc<SolanaRpcApi>;
|
|
15399
15414
|
|
|
15415
|
+
/**
|
|
15416
|
+
* Maps a transaction-proposing wallet to the Squads vault it operates.
|
|
15417
|
+
*
|
|
15418
|
+
* The member wallet pays for and signs proposal creation. The derived Squads
|
|
15419
|
+
* vault PDA is the authority that signs the instructions when the proposal is
|
|
15420
|
+
* eventually executed.
|
|
15421
|
+
*/
|
|
15422
|
+
interface SquadsWalletRouteConfig {
|
|
15423
|
+
wallet: string;
|
|
15424
|
+
multisigPda: string;
|
|
15425
|
+
vaultIndex: number;
|
|
15426
|
+
memo?: string;
|
|
15427
|
+
}
|
|
15428
|
+
interface ResolvedSquadsWalletRoute {
|
|
15429
|
+
wallet: PublicKey;
|
|
15430
|
+
multisigPda: PublicKey;
|
|
15431
|
+
vaultIndex: number;
|
|
15432
|
+
vaultPda: PublicKey;
|
|
15433
|
+
memo?: string;
|
|
15434
|
+
}
|
|
15435
|
+
interface PreparedDirectTransaction {
|
|
15436
|
+
kind: "direct";
|
|
15437
|
+
transaction: Transaction;
|
|
15438
|
+
authority: PublicKey;
|
|
15439
|
+
}
|
|
15440
|
+
interface PreparedSquadsTransaction {
|
|
15441
|
+
kind: "squads";
|
|
15442
|
+
transaction: Transaction;
|
|
15443
|
+
authority: PublicKey;
|
|
15444
|
+
multisigPda: PublicKey;
|
|
15445
|
+
vaultIndex: number;
|
|
15446
|
+
transactionIndex: bigint;
|
|
15447
|
+
proposalPda: PublicKey;
|
|
15448
|
+
vaultTransactionPda: PublicKey;
|
|
15449
|
+
}
|
|
15450
|
+
type PreparedVaultTransaction = PreparedDirectTransaction | PreparedSquadsTransaction;
|
|
15451
|
+
/** Resolve and validate a configured wallet route, including its vault PDA. */
|
|
15452
|
+
declare function resolveSquadsWalletRoute(route: SquadsWalletRouteConfig): ResolvedSquadsWalletRoute;
|
|
15453
|
+
/** Find the optional Squads route for a connected proposer wallet. */
|
|
15454
|
+
declare function findSquadsWalletRoute(wallet: PublicKey | string, routes: readonly SquadsWalletRouteConfig[]): ResolvedSquadsWalletRoute | undefined;
|
|
15455
|
+
/** Fail fast on ambiguous wallet mappings or malformed route values. */
|
|
15456
|
+
declare function validateSquadsWalletRoutes(routes: readonly SquadsWalletRouteConfig[]): void;
|
|
15457
|
+
/**
|
|
15458
|
+
* Return the authority that should be used while building vault instructions.
|
|
15459
|
+
* For a configured member wallet this is the Squads vault PDA; otherwise it is
|
|
15460
|
+
* the wallet itself.
|
|
15461
|
+
*/
|
|
15462
|
+
declare function vaultAuthorityForWallet(wallet: PublicKey | string, routes: readonly SquadsWalletRouteConfig[]): PublicKey;
|
|
15463
|
+
/**
|
|
15464
|
+
* Build either a normal transaction or a Squads proposal-creation transaction,
|
|
15465
|
+
* based on whether `proposer` has a configured wallet route.
|
|
15466
|
+
*
|
|
15467
|
+
* The returned Squads transaction creates both the vault transaction and its
|
|
15468
|
+
* proposal. It does not approve or execute the proposal.
|
|
15469
|
+
*/
|
|
15470
|
+
declare function prepareVaultTransaction(args: {
|
|
15471
|
+
connection: Connection;
|
|
15472
|
+
proposer: PublicKey;
|
|
15473
|
+
instructions: readonly TransactionInstruction[];
|
|
15474
|
+
squadsRoutes?: readonly SquadsWalletRouteConfig[];
|
|
15475
|
+
}): Promise<PreparedVaultTransaction>;
|
|
15476
|
+
|
|
15400
15477
|
interface CreateTokenMintIxs {
|
|
15401
15478
|
mint: Keypair;
|
|
15402
15479
|
ixs: TransactionInstruction[];
|
|
@@ -15784,38 +15861,22 @@ interface YieldAccountSnapshot {
|
|
|
15784
15861
|
accrualStart: Date;
|
|
15785
15862
|
accrualEnd: Date;
|
|
15786
15863
|
}
|
|
15864
|
+
/** Payment state used to interlock oracle publication with yield settlement. */
|
|
15865
|
+
interface YieldPaymentSnapshot {
|
|
15866
|
+
id: string;
|
|
15867
|
+
/** Only `confirmed` is safe; present or future intermediate states block. */
|
|
15868
|
+
status: string;
|
|
15869
|
+
}
|
|
15787
15870
|
/**
|
|
15788
|
-
*
|
|
15789
|
-
*
|
|
15790
|
-
*
|
|
15871
|
+
* Read-only yield-tracker surface required by the oracle. The live implementation
|
|
15872
|
+
* delegates to the HTTP API; the in-memory implementation also exposes mutation
|
|
15873
|
+
* helpers for tests and local operation.
|
|
15791
15874
|
*/
|
|
15792
15875
|
interface YieldTracker {
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
getTotalYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
15876
|
+
/** All payments for an account, including payments not yet confirmed. */
|
|
15877
|
+
getYieldPayments(accountName: string): Promise<YieldPaymentSnapshot[]>;
|
|
15796
15878
|
/** Sum of oracle-safe outstanding yield across the named accounts. */
|
|
15797
15879
|
getTotalOutstandingYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
15798
|
-
/** Current balance (principal + outstanding yield), UI amount. */
|
|
15799
|
-
getBalance(accountName: string, atTime?: Date): Promise<number>;
|
|
15800
|
-
addCashflow(params: {
|
|
15801
|
-
accountName: string;
|
|
15802
|
-
amount: number;
|
|
15803
|
-
date?: Date;
|
|
15804
|
-
cashflowType: "deposit" | "withdraw";
|
|
15805
|
-
}): Promise<void>;
|
|
15806
|
-
/** Register an expected payment. Pending payments remain outstanding. */
|
|
15807
|
-
createYieldPayment(params: {
|
|
15808
|
-
accountName: string;
|
|
15809
|
-
paymentId: string;
|
|
15810
|
-
amount: number;
|
|
15811
|
-
effectiveAt: Date;
|
|
15812
|
-
}): Promise<void>;
|
|
15813
|
-
/** Confirm only after the payment is observable in the destination wallet. */
|
|
15814
|
-
confirmYieldPayment(params: {
|
|
15815
|
-
accountName: string;
|
|
15816
|
-
paymentId: string;
|
|
15817
|
-
transactionSignature: string;
|
|
15818
|
-
}): Promise<void>;
|
|
15819
15880
|
}
|
|
15820
15881
|
/** Injectable wall clock (ms since epoch). Lets tests pin time deterministically. */
|
|
15821
15882
|
interface Clock {
|
|
@@ -16074,6 +16135,7 @@ declare class MockYieldTracker implements YieldTracker {
|
|
|
16074
16135
|
/** Register (or replace) a tracked account. */
|
|
16075
16136
|
setAccount(name: string, cfg: MockYieldAccountConfig): void;
|
|
16076
16137
|
private require;
|
|
16138
|
+
getYieldPayments(accountName: string): Promise<YieldPaymentSnapshot[]>;
|
|
16077
16139
|
getYield(accountName: string, start?: Date, end?: Date): Promise<YieldAccountSnapshot>;
|
|
16078
16140
|
getTotalYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
16079
16141
|
getTotalOutstandingYield(accountNames: string[], start?: Date, end?: Date): Promise<number>;
|
|
@@ -16105,6 +16167,12 @@ declare class ConsensusOracleService {
|
|
|
16105
16167
|
constructor(client: VaultClient, deps: ConsensusOracleDeps);
|
|
16106
16168
|
/** Drive one vault: source prices/balances, push consensus update, crank NAV. */
|
|
16107
16169
|
runOnce(signer: Keypair, target: ConsensusOracleTarget, opts?: RunOptions): Promise<VaultOracleResult>;
|
|
16170
|
+
/**
|
|
16171
|
+
* Fail closed while any configured yield account has an unsettled payment.
|
|
16172
|
+
* The payout must be confirmed only after it is visible in the same wallet
|
|
16173
|
+
* balance source used by this service. Until then, no oracle update is safe.
|
|
16174
|
+
*/
|
|
16175
|
+
private assertNoUnconfirmedYieldPayments;
|
|
16108
16176
|
/**
|
|
16109
16177
|
* Drive several vaults in sequence. Non-fatal: a failure on one vault is
|
|
16110
16178
|
* recorded and the rest still run (mirrors the oracle-updater daemon).
|
|
@@ -16187,4 +16255,4 @@ declare class ExternalLiquidityIntegrityService {
|
|
|
16187
16255
|
private depositIntoMarginfi;
|
|
16188
16256
|
}
|
|
16189
16257
|
|
|
16190
|
-
export { ASSET_DECIMALS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type Bankineco, type BasicAuthCredentials, type Bigintish, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, type Clock, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DeleteAccountParams, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, ExecuteDepositBuilder, type ExecuteDepositIxArgs, type ExecuteDepositTxArgs, ExecuteShareSwapBuilder, type ExecuteShareSwapIxArgs, type ExecuteShareSwapTxArgs, ExecuteTrancheDepositBuilder, type ExecuteTrancheDepositIxArgs, type ExecuteTrancheDepositTxArgs, ExecuteTrancheWithdrawBuilder, type ExecuteTrancheWithdrawIxArgs, type ExecuteTrancheWithdrawTxArgs, ExecuteWithdrawBuilder, type ExecuteWithdrawIxArgs, type ExecuteWithdrawTxArgs, type ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingUpdatePreview, IDL, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterBalanceSource, type JupiterBalanceSourceOptions, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, type LiveConsensusOracleDepsOptions, MAX_PRICE_STALENESS_THRESHOLD_SECS, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, OracleService, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PdaClient, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type RollingLimitConfig, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, StaticPositionProvider, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type WalletBalanceSource, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawTrancheFeesIxArgs, type WithdrawTrancheFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldPaymentResponse, type YieldTracker, addCashflowUpdate, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, defaultKeypairPath, deleteAccount, fromUiAmount, getAccounts, getBalance, getCashflows, getRpcUrl, getTotalOutstandingYield, getTotalYield, getVaultProgramId, getYield, getYieldPayments, isVaultEnv, keypairAddress, loadKeypair, makeProvider, mintTokensTo, resolveKeypairPath, roundToNextUtcMidnight, runLiveConsensusOracle, systemClock, toUiAmount, updateAccount, updateDynamicApr };
|
|
16258
|
+
export { ASSET_DECIMALS, type AccountBalanceResponse, AccountClient, type AccountYieldResponse, ActivateCircuitBreakerBuilder, type ActivateCircuitBreakerIxArgs, type ActivateCircuitBreakerTxArgs, type AssetPriceOracleConfigIxArgs, type AssetPriceOracleConfigTxArgs, type AssetPriceRefreshTarget, type AssetRefreshResult, type Bankineco, type BasicAuthCredentials, type Bigintish, CancelJuniorTrancheWithdrawBuilder, type CancelJuniorTrancheWithdrawIxArgs, type CancelJuniorTrancheWithdrawTxArgs, type Clock, type ConsensusAssetUpdate, type ConsensusHoldingEntry, type ConsensusOracleDeps, type ConsensusOracleHoldingConfig, ConsensusOracleService, type ConsensusOracleTarget, CrankNavBuilder, type CrankNavIxArgs, type CrankNavTxArgs, CrankPerformanceFeesBuilder, type CrankPerformanceFeesIxArgs, type CrankPerformanceFeesTxArgs, type CreateAccountParams, CreateAssetHoldingBuilder, type CreateAssetHoldingIxArgs, type CreateAssetHoldingTxArgs, type CreateTokenMintIxs, CreateTrancheStateBuilder, type CreateTrancheStateIxArgs, type CreateTrancheStateTxArgs, CreateVaultBuilder, type CreateVaultClientOptions, type CreateVaultIxArgs, type CreateVaultParams, type CreateVaultTxArgs, type CreateYieldPaymentParams, DEFAULT_JUNIOR_EARLY_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_STANDARD_UNSTAKE_FEE_BPS, DEFAULT_JUNIOR_WITHDRAWAL_LOCKUP_SECS, DEFAULT_MAX_ACCEPTABLE_APY_BPS, DEFAULT_ORACLE_STALENESS_THRESHOLD_SECS, DEFAULT_PRICE_ORACLE_ACCOUNT, DEFAULT_PRICE_STALENESS_THRESHOLD_SECS, DEFAULT_VAULT_ID, type DecodedHolding, type DecodedVault, type DeleteAccountParams, DisableCircuitBreakerBuilder, type DisableCircuitBreakerIxArgs, type DisableCircuitBreakerTxArgs, ExecuteDepositBuilder, type ExecuteDepositIxArgs, type ExecuteDepositTxArgs, ExecuteShareSwapBuilder, type ExecuteShareSwapIxArgs, type ExecuteShareSwapTxArgs, ExecuteTrancheDepositBuilder, type ExecuteTrancheDepositIxArgs, type ExecuteTrancheDepositTxArgs, ExecuteTrancheWithdrawBuilder, type ExecuteTrancheWithdrawIxArgs, type ExecuteTrancheWithdrawTxArgs, ExecuteWithdrawBuilder, type ExecuteWithdrawIxArgs, type ExecuteWithdrawTxArgs, type ExternalLiquidityIntegrityResult, ExternalLiquidityIntegrityService, type ExternalLiquidityIntegritySummary, type ExternalLiquiditySlot, type ExternalLiquiditySourceArgs, type ExternalPosition, type ExternalPositionContext, type ExternalPositionProvider, type ExternalPositionRef, ExternalPositionRegistry, FEE_VAULT_CACHE_CATEGORY, type FeeVaultAccountData, FulfillJuniorTrancheWithdrawBuilder, type FulfillJuniorTrancheWithdrawIxArgs, type FulfillJuniorTrancheWithdrawTxArgs, type FulfillSummary, type HoldingUpdatePreview, IDL, InitializeVaultRolesBuilder, type InitializeVaultRolesIxArgs, type InitializeVaultRolesTxArgs, type JuniorWithdrawalMode, JupiterBalanceSource, type JupiterBalanceSourceOptions, JupiterPriceSource, type JupiterPriceSourceOptions, JupiterSwapBuilder, type JupiterSwapIxArgs, type JupiterSwapTxArgs, KaminoPositionProvider, type LiveConsensusOracleDepsOptions, MAX_PRICE_STALENESS_THRESHOLD_SECS, ManagerRedepositAssetBuilder, type ManagerRedepositAssetIxArgs, type ManagerRedepositAssetTxArgs, ManagerWithdrawAssetBuilder, type ManagerWithdrawAssetIxArgs, type ManagerWithdrawAssetTxArgs, MarginfiPositionProvider, type MockYieldAccountConfig, MockYieldTracker, type MockYieldTrackerOptions, type NavCrankBlocker, type NavCrankBlockerReason, type NavCrankReadiness, type NavCrankResult, OracleService, PROGRAM_FEE_EXEMPT_OWNER_WHITELIST, PROTOCOL_ADMIN, PROTOCOL_FEE_RECIPIENT, PdaClient, type PreparedDirectTransaction, type PreparedSquadsTransaction, type PreparedVaultTransaction, type PriceOracleTypeArgs, type PriceSource, ProtocolInteractionBuilder, type ProtocolInteractionIxArgs, type ProtocolInteractionTxArgs, type QuoteFeeUnit, RemoveAssetHoldingBuilder, type RemoveAssetHoldingIxArgs, type RemoveAssetHoldingTxArgs, RequestJuniorTrancheWithdrawBuilder, type RequestJuniorTrancheWithdrawIxArgs, type RequestJuniorTrancheWithdrawTxArgs, type ResolvedSquadsWalletRoute, type RollingLimitConfig, type RunLiveConsensusOracleOptions, type RunOptions, type RunSummary, SHARE_DECIMALS, SetAssetPriceOracleBuilder, type SetAssetPriceOracleIxArgs, type SetAssetPriceOracleTxArgs, SetExternalLiquidityBuilder, type SetExternalLiquidityIxArgs, type SetExternalLiquidityTxArgs, SetProtocolFeeBuilder, type SetProtocolFeeIxArgs, type SetProtocolFeeTxArgs, SetVaultConfigBuilder, type SetVaultConfigIxArgs, type SetVaultConfigTxArgs, type SquadsWalletRouteConfig, StaticPositionProvider, TOKEN_PROGRAM, TOKEN_PROGRAM_ID, type TrancheKindArgs, type TransactionBuilder, TransactionClient, USDC_MINT, USD_STAR_JUNIOR_MINT, USD_STAR_MINT, USD_STAR_PRINCIPAL_MINT, type UpdateAccountParams, UpdateAssetPriceBuilder, type UpdateAssetPriceIxArgs, type UpdateAssetPriceTxArgs, UpdateConsensusOracleBuilder, type UpdateConsensusOracleIxArgs, type UpdateConsensusOracleTxArgs, UpdateConsensusSignersBuilder, type UpdateConsensusSignersIxArgs, type UpdateConsensusSignersTxArgs, type UpdateDynamicAprParams, UpdateTrancheConfigBuilder, type UpdateTrancheConfigIxArgs, type UpdateTrancheConfigTxArgs, VAULT_CACHE_CATEGORY, VAULT_CREATOR_WHITELIST, VAULT_ENVIRONMENTS, VAULT_ORACLE_CACHE_CATEGORY, VAULT_PROGRAM_ID, VAULT_PROGRAM_IDS, VAULT_PROGRAM_PUBLIC_KEY, VAULT_ROLE_UPDATE_TIMELOCK_SECS, VAULT_TRANCHE_STATE_CACHE_CATEGORY, VAULT_TRANCHE_WITHDRAWAL_QUEUE_CACHE_CATEGORY, type Vault, type VaultAccountData, VaultBuilderBase, type VaultBuilderContext, type VaultCacheInvalidation, VaultClient, type VaultClientBundle, type VaultEnv, type VaultOracleAccountData, type VaultOracleResult, type VaultPricingInputs, type VaultQuote, type VaultQuoteArgs, VaultQuoteClient, type VaultQuoteDirection, type VaultQuoteShareClass, VaultReallocationBuilder, type VaultReallocationIxArgs, type VaultReallocationTxArgs, type VaultTrancheStateAccountData, type VaultTrancheWithdrawalQueueAccountData, type VaultTransactionPlan, type WalletBalanceSource, type WithdrawProtocolFeesIxArgs, type WithdrawProtocolFeesTxArgs, type WithdrawTrancheFeesIxArgs, type WithdrawTrancheFeesTxArgs, WithdrawalQueueService, type WithdrawalQueueSnapshot, type YieldAccount, type YieldAccountSnapshot, type YieldCalculationLog, type YieldPaymentResponse, type YieldPaymentSnapshot, type YieldTracker, addCashflowUpdate, confirmYieldPayment, createAccount, createLiveConsensusOracleDeps, createRpcFromConnection, createTokenMint, createTokenMintIxs, createVaultClient, createYieldPayment, dateToStr, defaultKeypairPath, deleteAccount, findSquadsWalletRoute, fromUiAmount, getAccounts, getBalance, getCashflows, getRpcUrl, getTotalOutstandingYield, getTotalYield, getVaultProgramId, getYield, getYieldPayments, isVaultEnv, keypairAddress, loadKeypair, makeProvider, mintTokensTo, prepareVaultTransaction, resolveKeypairPath, resolveSquadsWalletRoute, roundToNextUtcMidnight, runLiveConsensusOracle, systemClock, toUiAmount, updateAccount, updateDynamicApr, validateSquadsWalletRoutes, vaultAuthorityForWallet };
|