@kamino-finance/klend-sdk 7.4.0-beta.2 → 7.4.0-beta.4

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 (117) hide show
  1. package/dist/@codegen/klend/accounts/LendingMarket.d.ts +150 -3
  2. package/dist/@codegen/klend/accounts/LendingMarket.d.ts.map +1 -1
  3. package/dist/@codegen/klend/accounts/LendingMarket.js +91 -2
  4. package/dist/@codegen/klend/accounts/LendingMarket.js.map +1 -1
  5. package/dist/@codegen/klend/accounts/Reserve.d.ts +6 -0
  6. package/dist/@codegen/klend/accounts/Reserve.d.ts.map +1 -1
  7. package/dist/@codegen/klend/accounts/Reserve.js +8 -1
  8. package/dist/@codegen/klend/accounts/Reserve.js.map +1 -1
  9. package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts +144 -0
  10. package/dist/@codegen/klend/accounts/WithdrawTicket.d.ts.map +1 -0
  11. package/dist/@codegen/klend/accounts/WithdrawTicket.js +205 -0
  12. package/dist/@codegen/klend/accounts/WithdrawTicket.js.map +1 -0
  13. package/dist/@codegen/klend/accounts/index.d.ts +2 -0
  14. package/dist/@codegen/klend/accounts/index.d.ts.map +1 -1
  15. package/dist/@codegen/klend/accounts/index.js +3 -1
  16. package/dist/@codegen/klend/accounts/index.js.map +1 -1
  17. package/dist/@codegen/klend/errors/custom.d.ts +81 -1
  18. package/dist/@codegen/klend/errors/custom.d.ts.map +1 -1
  19. package/dist/@codegen/klend/errors/custom.js +142 -1
  20. package/dist/@codegen/klend/errors/custom.js.map +1 -1
  21. package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts +62 -0
  22. package/dist/@codegen/klend/instructions/enqueueToWithdraw.d.ts.map +1 -0
  23. package/dist/@codegen/klend/instructions/enqueueToWithdraw.js +79 -0
  24. package/dist/@codegen/klend/instructions/enqueueToWithdraw.js.map +1 -0
  25. package/dist/@codegen/klend/instructions/index.d.ts +6 -0
  26. package/dist/@codegen/klend/instructions/index.d.ts.map +1 -1
  27. package/dist/@codegen/klend/instructions/index.js +8 -2
  28. package/dist/@codegen/klend/instructions/index.js.map +1 -1
  29. package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts +54 -0
  30. package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.d.ts.map +1 -0
  31. package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js +66 -0
  32. package/dist/@codegen/klend/instructions/recoverInvalidTicketCollateral.js.map +1 -0
  33. package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts +66 -0
  34. package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.d.ts.map +1 -0
  35. package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js +41 -0
  36. package/dist/@codegen/klend/instructions/withdrawQueuedLiquidity.js.map +1 -0
  37. package/dist/@codegen/klend/types/BorrowOrder.d.ts +3 -3
  38. package/dist/@codegen/klend/types/BorrowOrder.js +1 -1
  39. package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.d.ts +145 -0
  40. package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.d.ts.map +1 -0
  41. package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.js +144 -0
  42. package/dist/@codegen/klend/types/FixedTermBorrowRolloverConfig.js.map +1 -0
  43. package/dist/@codegen/klend/types/ObligationLiquidity.d.ts +29 -0
  44. package/dist/@codegen/klend/types/ObligationLiquidity.d.ts.map +1 -1
  45. package/dist/@codegen/klend/types/ObligationLiquidity.js +15 -1
  46. package/dist/@codegen/klend/types/ObligationLiquidity.js.map +1 -1
  47. package/dist/@codegen/klend/types/ProgressCallbackType.d.ts +32 -0
  48. package/dist/@codegen/klend/types/ProgressCallbackType.d.ts.map +1 -0
  49. package/dist/@codegen/klend/types/ProgressCallbackType.js +108 -0
  50. package/dist/@codegen/klend/types/ProgressCallbackType.js.map +1 -0
  51. package/dist/@codegen/klend/types/ReserveLiquidity.d.ts +26 -8
  52. package/dist/@codegen/klend/types/ReserveLiquidity.d.ts.map +1 -1
  53. package/dist/@codegen/klend/types/ReserveLiquidity.js +14 -8
  54. package/dist/@codegen/klend/types/ReserveLiquidity.js.map +1 -1
  55. package/dist/@codegen/klend/types/UpdateConfigMode.d.ts +7 -7
  56. package/dist/@codegen/klend/types/UpdateConfigMode.d.ts.map +1 -1
  57. package/dist/@codegen/klend/types/UpdateConfigMode.js +12 -12
  58. package/dist/@codegen/klend/types/UpdateConfigMode.js.map +1 -1
  59. package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts +78 -0
  60. package/dist/@codegen/klend/types/UpdateLendingMarketMode.d.ts.map +1 -1
  61. package/dist/@codegen/klend/types/UpdateLendingMarketMode.js +145 -1
  62. package/dist/@codegen/klend/types/UpdateLendingMarketMode.js.map +1 -1
  63. package/dist/@codegen/klend/types/WithdrawQueue.d.ts +64 -0
  64. package/dist/@codegen/klend/types/WithdrawQueue.d.ts.map +1 -0
  65. package/dist/@codegen/klend/types/WithdrawQueue.js +104 -0
  66. package/dist/@codegen/klend/types/WithdrawQueue.js.map +1 -0
  67. package/dist/@codegen/klend/types/index.d.ts +23 -4
  68. package/dist/@codegen/klend/types/index.d.ts.map +1 -1
  69. package/dist/@codegen/klend/types/index.js +7 -1
  70. package/dist/@codegen/klend/types/index.js.map +1 -1
  71. package/dist/classes/action.d.ts +11 -0
  72. package/dist/classes/action.d.ts.map +1 -1
  73. package/dist/classes/action.js +66 -0
  74. package/dist/classes/action.js.map +1 -1
  75. package/dist/classes/actionTypes.d.ts +29 -0
  76. package/dist/classes/actionTypes.d.ts.map +1 -1
  77. package/dist/classes/manager.d.ts +1 -1
  78. package/dist/classes/manager.d.ts.map +1 -1
  79. package/dist/classes/manager.js +9 -8
  80. package/dist/classes/manager.js.map +1 -1
  81. package/dist/classes/reserve.d.ts +2 -1
  82. package/dist/classes/reserve.d.ts.map +1 -1
  83. package/dist/classes/reserve.js +45 -31
  84. package/dist/classes/reserve.js.map +1 -1
  85. package/dist/idl/klend.json +860 -32
  86. package/dist/manager/client_kamino_manager.js +2 -3
  87. package/dist/manager/client_kamino_manager.js.map +1 -1
  88. package/dist/utils/seeds.d.ts +24 -0
  89. package/dist/utils/seeds.d.ts.map +1 -1
  90. package/dist/utils/seeds.js +41 -1
  91. package/dist/utils/seeds.js.map +1 -1
  92. package/package.json +1 -1
  93. package/src/@codegen/klend/accounts/LendingMarket.ts +205 -4
  94. package/src/@codegen/klend/accounts/Reserve.ts +12 -1
  95. package/src/@codegen/klend/accounts/WithdrawTicket.ts +280 -0
  96. package/src/@codegen/klend/accounts/index.ts +2 -0
  97. package/src/@codegen/klend/errors/custom.ts +161 -0
  98. package/src/@codegen/klend/instructions/enqueueToWithdraw.ts +120 -0
  99. package/src/@codegen/klend/instructions/index.ts +12 -0
  100. package/src/@codegen/klend/instructions/recoverInvalidTicketCollateral.ts +103 -0
  101. package/src/@codegen/klend/instructions/withdrawQueuedLiquidity.ts +118 -0
  102. package/src/@codegen/klend/types/BorrowOrder.ts +3 -3
  103. package/src/@codegen/klend/types/FixedTermBorrowRolloverConfig.ts +199 -0
  104. package/src/@codegen/klend/types/ObligationLiquidity.ts +37 -1
  105. package/src/@codegen/klend/types/ProgressCallbackType.ts +91 -0
  106. package/src/@codegen/klend/types/ReserveLiquidity.ts +30 -12
  107. package/src/@codegen/klend/types/UpdateConfigMode.ts +13 -13
  108. package/src/@codegen/klend/types/UpdateLendingMarketMode.ts +180 -0
  109. package/src/@codegen/klend/types/WithdrawQueue.ts +117 -0
  110. package/src/@codegen/klend/types/index.ts +42 -2
  111. package/src/classes/action.ts +115 -1
  112. package/src/classes/actionTypes.ts +31 -0
  113. package/src/classes/manager.ts +19 -27
  114. package/src/classes/reserve.ts +45 -44
  115. package/src/idl/klend.json +860 -32
  116. package/src/manager/client_kamino_manager.ts +2 -4
  117. package/src/utils/seeds.ts +49 -0
@@ -0,0 +1,144 @@
1
+ import { Address, GetAccountInfoApi, GetMultipleAccountsApi, Rpc } from "@solana/kit";
2
+ import BN from "bn.js";
3
+ export interface WithdrawTicketFields {
4
+ /** This ticket's place in the queue; the same as used for PDA derivation. */
5
+ sequenceNumber: BN;
6
+ /** The funds' owner (the user who called the `enqueue_to_withdraw` handler). */
7
+ owner: Address;
8
+ /** The reserve to withdraw from. */
9
+ reserve: Address;
10
+ /**
11
+ * The token account to which the finally-available liquidity should be transferred (by the
12
+ * `withdraw_queued_liquidity` handler).
13
+ */
14
+ userDestinationLiquidityTa: Address;
15
+ /** The amount of collateral still waiting to be withdrawn using this ticket. */
16
+ queuedCollateralAmount: BN;
17
+ /**
18
+ * The timestamp at which the queue was entered.
19
+ *
20
+ * This is currently only a piece of metadata, not used by the logic.
21
+ */
22
+ createdAtTimestamp: BN;
23
+ /**
24
+ * Whether the ticket has been found to be invalid (e.g. the [Self::user_destination_liquidity]
25
+ * has been repurposed) by the `withdraw_queued_liquidity` handler.
26
+ * To be specific: valid = `0`, invalid = `1`.
27
+ *
28
+ * An invalid ticket cannot be made valid again, and can only be passed to the
29
+ * `recover_invalid_ticket_collateral` handler.
30
+ */
31
+ invalid: number;
32
+ /** One of the valid [ProgressCallbackType] representations. */
33
+ progressCallbackType: number;
34
+ /** Inner padding, for alignment. */
35
+ alignmentPadding: Array<number>;
36
+ /** The (optional) accounts to be used by [Self::progress_callback_type]s. */
37
+ progressCallbackCustomAccounts: Array<Address>;
38
+ /** Trailing padding, for future developments. */
39
+ endPadding: Array<BN>;
40
+ }
41
+ export interface WithdrawTicketJSON {
42
+ /** This ticket's place in the queue; the same as used for PDA derivation. */
43
+ sequenceNumber: string;
44
+ /** The funds' owner (the user who called the `enqueue_to_withdraw` handler). */
45
+ owner: string;
46
+ /** The reserve to withdraw from. */
47
+ reserve: string;
48
+ /**
49
+ * The token account to which the finally-available liquidity should be transferred (by the
50
+ * `withdraw_queued_liquidity` handler).
51
+ */
52
+ userDestinationLiquidityTa: string;
53
+ /** The amount of collateral still waiting to be withdrawn using this ticket. */
54
+ queuedCollateralAmount: string;
55
+ /**
56
+ * The timestamp at which the queue was entered.
57
+ *
58
+ * This is currently only a piece of metadata, not used by the logic.
59
+ */
60
+ createdAtTimestamp: string;
61
+ /**
62
+ * Whether the ticket has been found to be invalid (e.g. the [Self::user_destination_liquidity]
63
+ * has been repurposed) by the `withdraw_queued_liquidity` handler.
64
+ * To be specific: valid = `0`, invalid = `1`.
65
+ *
66
+ * An invalid ticket cannot be made valid again, and can only be passed to the
67
+ * `recover_invalid_ticket_collateral` handler.
68
+ */
69
+ invalid: number;
70
+ /** One of the valid [ProgressCallbackType] representations. */
71
+ progressCallbackType: number;
72
+ /** Inner padding, for alignment. */
73
+ alignmentPadding: Array<number>;
74
+ /** The (optional) accounts to be used by [Self::progress_callback_type]s. */
75
+ progressCallbackCustomAccounts: Array<string>;
76
+ /** Trailing padding, for future developments. */
77
+ endPadding: Array<string>;
78
+ }
79
+ /**
80
+ * A finite-lifecycle account representing a specific depositor's place in the withdraw queue of
81
+ * a specific reserve.
82
+ *
83
+ * The lifecycle:
84
+ * 1. The depositor holding ctokens wants to withdraw funds from the reserve, and finds out that
85
+ * the required amount is not available (due to high utilization).
86
+ * 2. The depositor calls the `enqueue_to_withdraw` handler.
87
+ * 3. The handler transfers the depositor's ctokens to the reserve's internal "pending" vault.
88
+ * 4. The handler initializes a new [WithdrawTicket] account, with the next available sequence
89
+ * number.
90
+ * 5. The depositor waits until his ticket is the next expected one for actual withdraw, and until
91
+ * the reserve has enough liquidity.
92
+ * 6. Anyone (the depositor or a bot) calls the permissionless `withdraw_queued_liquidity`
93
+ * handler. If the ticket became invalid (e.g. destination account no longer exists), then the
94
+ * depositor can call the `recover_invalid_ticket_collateral` handler instead.
95
+ * 7. The handler transfers the liquidity amount according to the current exchange rate.
96
+ * 8. The handler closes the ticket account.
97
+ */
98
+ export declare class WithdrawTicket {
99
+ /** This ticket's place in the queue; the same as used for PDA derivation. */
100
+ readonly sequenceNumber: BN;
101
+ /** The funds' owner (the user who called the `enqueue_to_withdraw` handler). */
102
+ readonly owner: Address;
103
+ /** The reserve to withdraw from. */
104
+ readonly reserve: Address;
105
+ /**
106
+ * The token account to which the finally-available liquidity should be transferred (by the
107
+ * `withdraw_queued_liquidity` handler).
108
+ */
109
+ readonly userDestinationLiquidityTa: Address;
110
+ /** The amount of collateral still waiting to be withdrawn using this ticket. */
111
+ readonly queuedCollateralAmount: BN;
112
+ /**
113
+ * The timestamp at which the queue was entered.
114
+ *
115
+ * This is currently only a piece of metadata, not used by the logic.
116
+ */
117
+ readonly createdAtTimestamp: BN;
118
+ /**
119
+ * Whether the ticket has been found to be invalid (e.g. the [Self::user_destination_liquidity]
120
+ * has been repurposed) by the `withdraw_queued_liquidity` handler.
121
+ * To be specific: valid = `0`, invalid = `1`.
122
+ *
123
+ * An invalid ticket cannot be made valid again, and can only be passed to the
124
+ * `recover_invalid_ticket_collateral` handler.
125
+ */
126
+ readonly invalid: number;
127
+ /** One of the valid [ProgressCallbackType] representations. */
128
+ readonly progressCallbackType: number;
129
+ /** Inner padding, for alignment. */
130
+ readonly alignmentPadding: Array<number>;
131
+ /** The (optional) accounts to be used by [Self::progress_callback_type]s. */
132
+ readonly progressCallbackCustomAccounts: Array<Address>;
133
+ /** Trailing padding, for future developments. */
134
+ readonly endPadding: Array<BN>;
135
+ static readonly discriminator: Buffer<ArrayBuffer>;
136
+ static readonly layout: import("buffer-layout").Layout<WithdrawTicket>;
137
+ constructor(fields: WithdrawTicketFields);
138
+ static fetch(rpc: Rpc<GetAccountInfoApi>, address: Address, programId?: Address): Promise<WithdrawTicket | null>;
139
+ static fetchMultiple(rpc: Rpc<GetMultipleAccountsApi>, addresses: Address[], programId?: Address): Promise<Array<WithdrawTicket | null>>;
140
+ static decode(data: Buffer): WithdrawTicket;
141
+ toJSON(): WithdrawTicketJSON;
142
+ static fromJSON(obj: WithdrawTicketJSON): WithdrawTicket;
143
+ }
144
+ //# sourceMappingURL=WithdrawTicket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithdrawTicket.d.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,CAAC,sBAAsB,CAAC,EAChC,SAAS,EAAE,OAAO,EAAE,EACpB,SAAS,GAAE,OAAoB,GAC9B,OAAO,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAiBxC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;IAsB3C,MAAM,IAAI,kBAAkB;IAgB5B,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,kBAAkB,GAAG,cAAc;CAiBzD"}
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.WithdrawTicket = void 0;
40
+ /* eslint-disable @typescript-eslint/no-unused-vars */
41
+ const kit_1 = require("@solana/kit");
42
+ /* eslint-enable @typescript-eslint/no-unused-vars */
43
+ const bn_js_1 = __importDefault(require("bn.js")); // eslint-disable-line @typescript-eslint/no-unused-vars
44
+ const borsh = __importStar(require("@coral-xyz/borsh")); // eslint-disable-line @typescript-eslint/no-unused-vars
45
+ const utils_1 = require("../utils"); // eslint-disable-line @typescript-eslint/no-unused-vars
46
+ const programId_1 = require("../programId");
47
+ /**
48
+ * A finite-lifecycle account representing a specific depositor's place in the withdraw queue of
49
+ * a specific reserve.
50
+ *
51
+ * The lifecycle:
52
+ * 1. The depositor holding ctokens wants to withdraw funds from the reserve, and finds out that
53
+ * the required amount is not available (due to high utilization).
54
+ * 2. The depositor calls the `enqueue_to_withdraw` handler.
55
+ * 3. The handler transfers the depositor's ctokens to the reserve's internal "pending" vault.
56
+ * 4. The handler initializes a new [WithdrawTicket] account, with the next available sequence
57
+ * number.
58
+ * 5. The depositor waits until his ticket is the next expected one for actual withdraw, and until
59
+ * the reserve has enough liquidity.
60
+ * 6. Anyone (the depositor or a bot) calls the permissionless `withdraw_queued_liquidity`
61
+ * handler. If the ticket became invalid (e.g. destination account no longer exists), then the
62
+ * depositor can call the `recover_invalid_ticket_collateral` handler instead.
63
+ * 7. The handler transfers the liquidity amount according to the current exchange rate.
64
+ * 8. The handler closes the ticket account.
65
+ */
66
+ class WithdrawTicket {
67
+ /** This ticket's place in the queue; the same as used for PDA derivation. */
68
+ sequenceNumber;
69
+ /** The funds' owner (the user who called the `enqueue_to_withdraw` handler). */
70
+ owner;
71
+ /** The reserve to withdraw from. */
72
+ reserve;
73
+ /**
74
+ * The token account to which the finally-available liquidity should be transferred (by the
75
+ * `withdraw_queued_liquidity` handler).
76
+ */
77
+ userDestinationLiquidityTa;
78
+ /** The amount of collateral still waiting to be withdrawn using this ticket. */
79
+ queuedCollateralAmount;
80
+ /**
81
+ * The timestamp at which the queue was entered.
82
+ *
83
+ * This is currently only a piece of metadata, not used by the logic.
84
+ */
85
+ createdAtTimestamp;
86
+ /**
87
+ * Whether the ticket has been found to be invalid (e.g. the [Self::user_destination_liquidity]
88
+ * has been repurposed) by the `withdraw_queued_liquidity` handler.
89
+ * To be specific: valid = `0`, invalid = `1`.
90
+ *
91
+ * An invalid ticket cannot be made valid again, and can only be passed to the
92
+ * `recover_invalid_ticket_collateral` handler.
93
+ */
94
+ invalid;
95
+ /** One of the valid [ProgressCallbackType] representations. */
96
+ progressCallbackType;
97
+ /** Inner padding, for alignment. */
98
+ alignmentPadding;
99
+ /** The (optional) accounts to be used by [Self::progress_callback_type]s. */
100
+ progressCallbackCustomAccounts;
101
+ /** Trailing padding, for future developments. */
102
+ endPadding;
103
+ static discriminator = Buffer.from([
104
+ 237, 23, 164, 58, 53, 248, 240, 94,
105
+ ]);
106
+ static layout = borsh.struct([
107
+ borsh.u64("sequenceNumber"),
108
+ (0, utils_1.borshAddress)("owner"),
109
+ (0, utils_1.borshAddress)("reserve"),
110
+ (0, utils_1.borshAddress)("userDestinationLiquidityTa"),
111
+ borsh.u64("queuedCollateralAmount"),
112
+ borsh.u64("createdAtTimestamp"),
113
+ borsh.u8("invalid"),
114
+ borsh.u8("progressCallbackType"),
115
+ borsh.array(borsh.u8(), 6, "alignmentPadding"),
116
+ borsh.array((0, utils_1.borshAddress)(), 2, "progressCallbackCustomAccounts"),
117
+ borsh.array(borsh.u64(), 40, "endPadding"),
118
+ ]);
119
+ constructor(fields) {
120
+ this.sequenceNumber = fields.sequenceNumber;
121
+ this.owner = fields.owner;
122
+ this.reserve = fields.reserve;
123
+ this.userDestinationLiquidityTa = fields.userDestinationLiquidityTa;
124
+ this.queuedCollateralAmount = fields.queuedCollateralAmount;
125
+ this.createdAtTimestamp = fields.createdAtTimestamp;
126
+ this.invalid = fields.invalid;
127
+ this.progressCallbackType = fields.progressCallbackType;
128
+ this.alignmentPadding = fields.alignmentPadding;
129
+ this.progressCallbackCustomAccounts = fields.progressCallbackCustomAccounts;
130
+ this.endPadding = fields.endPadding;
131
+ }
132
+ static async fetch(rpc, address, programId = programId_1.PROGRAM_ID) {
133
+ const info = await (0, kit_1.fetchEncodedAccount)(rpc, address);
134
+ if (!info.exists) {
135
+ return null;
136
+ }
137
+ if (info.programAddress !== programId) {
138
+ throw new Error(`WithdrawTicketFields account ${address} belongs to wrong program ${info.programAddress}, expected ${programId}`);
139
+ }
140
+ return this.decode(Buffer.from(info.data));
141
+ }
142
+ static async fetchMultiple(rpc, addresses, programId = programId_1.PROGRAM_ID) {
143
+ const infos = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses);
144
+ return infos.map((info) => {
145
+ if (!info.exists) {
146
+ return null;
147
+ }
148
+ if (info.programAddress !== programId) {
149
+ throw new Error(`WithdrawTicketFields account ${info.address} belongs to wrong program ${info.programAddress}, expected ${programId}`);
150
+ }
151
+ return this.decode(Buffer.from(info.data));
152
+ });
153
+ }
154
+ static decode(data) {
155
+ if (!data.slice(0, 8).equals(WithdrawTicket.discriminator)) {
156
+ throw new Error("invalid account discriminator");
157
+ }
158
+ const dec = WithdrawTicket.layout.decode(data.slice(8));
159
+ return new WithdrawTicket({
160
+ sequenceNumber: dec.sequenceNumber,
161
+ owner: dec.owner,
162
+ reserve: dec.reserve,
163
+ userDestinationLiquidityTa: dec.userDestinationLiquidityTa,
164
+ queuedCollateralAmount: dec.queuedCollateralAmount,
165
+ createdAtTimestamp: dec.createdAtTimestamp,
166
+ invalid: dec.invalid,
167
+ progressCallbackType: dec.progressCallbackType,
168
+ alignmentPadding: dec.alignmentPadding,
169
+ progressCallbackCustomAccounts: dec.progressCallbackCustomAccounts,
170
+ endPadding: dec.endPadding,
171
+ });
172
+ }
173
+ toJSON() {
174
+ return {
175
+ sequenceNumber: this.sequenceNumber.toString(),
176
+ owner: this.owner,
177
+ reserve: this.reserve,
178
+ userDestinationLiquidityTa: this.userDestinationLiquidityTa,
179
+ queuedCollateralAmount: this.queuedCollateralAmount.toString(),
180
+ createdAtTimestamp: this.createdAtTimestamp.toString(),
181
+ invalid: this.invalid,
182
+ progressCallbackType: this.progressCallbackType,
183
+ alignmentPadding: this.alignmentPadding,
184
+ progressCallbackCustomAccounts: this.progressCallbackCustomAccounts,
185
+ endPadding: this.endPadding.map((item) => item.toString()),
186
+ };
187
+ }
188
+ static fromJSON(obj) {
189
+ return new WithdrawTicket({
190
+ sequenceNumber: new bn_js_1.default(obj.sequenceNumber),
191
+ owner: (0, kit_1.address)(obj.owner),
192
+ reserve: (0, kit_1.address)(obj.reserve),
193
+ userDestinationLiquidityTa: (0, kit_1.address)(obj.userDestinationLiquidityTa),
194
+ queuedCollateralAmount: new bn_js_1.default(obj.queuedCollateralAmount),
195
+ createdAtTimestamp: new bn_js_1.default(obj.createdAtTimestamp),
196
+ invalid: obj.invalid,
197
+ progressCallbackType: obj.progressCallbackType,
198
+ alignmentPadding: obj.alignmentPadding,
199
+ progressCallbackCustomAccounts: obj.progressCallbackCustomAccounts.map((item) => (0, kit_1.address)(item)),
200
+ endPadding: obj.endPadding.map((item) => new bn_js_1.default(item)),
201
+ });
202
+ }
203
+ }
204
+ exports.WithdrawTicket = WithdrawTicket;
205
+ //# sourceMappingURL=WithdrawTicket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithdrawTicket.js","sourceRoot":"","sources":["../../../../src/@codegen/klend/accounts/WithdrawTicket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,qCAQoB;AACpB,qDAAqD;AACrD,kDAAsB,CAAC,wDAAwD;AAC/E,wDAAyC,CAAC,wDAAwD;AAClG,oCAAuC,CAAC,wDAAwD;AAEhG,4CAAyC;AAgFzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,cAAc;IACzB,6EAA6E;IACpE,cAAc,CAAI;IAC3B,gFAAgF;IAC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AC9C,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;YACtC,8BAA8B,EAAE,GAAG,CAAC,8BAA8B,CAAC,GAAG,CACpE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,aAAO,EAAC,IAAI,CAAC,CACxB;YACD,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAE,CAAC,IAAI,CAAC,CAAC;SACvD,CAAC,CAAA;IACJ,CAAC;;AApKH,wCAqKC"}
@@ -16,4 +16,6 @@ export { UserMetadata } from "./UserMetadata";
16
16
  export type { UserMetadataFields, UserMetadataJSON } from "./UserMetadata";
17
17
  export { Reserve } from "./Reserve";
18
18
  export type { ReserveFields, ReserveJSON } from "./Reserve";
19
+ export { WithdrawTicket } from "./WithdrawTicket";
20
+ export type { WithdrawTicketFields, WithdrawTicketJSON } from "./WithdrawTicket";
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/@codegen/klend/accounts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,YAAY,EAAE,mBAA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AY,EACV,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Reserve = exports.UserMetadata = exports.ShortUrl = exports.ReferrerTokenState = exports.ReferrerState = exports.Obligation = exports.LendingMarket = exports.GlobalConfig = exports.UserState = void 0;
3
+ exports.WithdrawTicket = exports.Reserve = exports.UserMetadata = exports.ShortUrl = exports.ReferrerTokenState = exports.ReferrerState = exports.Obligation = exports.LendingMarket = exports.GlobalConfig = exports.UserState = void 0;
4
4
  var UserState_1 = require("./UserState");
5
5
  Object.defineProperty(exports, "UserState", { enumerable: true, get: function () { return UserState_1.UserState; } });
6
6
  var GlobalConfig_1 = require("./GlobalConfig");
@@ -19,4 +19,6 @@ var UserMetadata_1 = require("./UserMetadata");
19
19
  Object.defineProperty(exports, "UserMetadata", { enumerable: true, get: function () { return UserMetadata_1.UserMetadata; } });
20
20
  var Reserve_1 = require("./Reserve");
21
21
  Object.defineProperty(exports, "Reserve", { enumerable: true, get: function () { return Reserve_1.Reserve; } });
22
+ var WithdrawTicket_1 = require("./WithdrawTicket");
23
+ Object.defineProperty(exports, "WithdrawTicket", { enumerable: true, get: function () { return WithdrawTicket_1.WithdrawTicket; } });
22
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/@codegen/klend/accounts/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAEtB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAEtB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AAEjB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/@codegen/klend/accounts/index.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAA9B,sGAAA,SAAS,OAAA;AAElB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAEtB,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AAEnB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAEtB,2DAAyD;AAAhD,wHAAA,kBAAkB,OAAA;AAK3B,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AAEjB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA"}
@@ -1,4 +1,4 @@
1
- export type CustomError = InvalidMarketAuthority | InvalidMarketOwner | InvalidAccountOwner | InvalidAmount | InvalidConfig | InvalidSigner | InvalidAccountInput | MathOverflow | InsufficientLiquidity | ReserveStale | WithdrawTooSmall | WithdrawTooLarge | BorrowTooSmall | BorrowTooLarge | RepayTooSmall | LiquidationTooSmall | ObligationHealthy | ObligationStale | ObligationReserveLimit | InvalidObligationOwner | ObligationDepositsEmpty | ObligationBorrowsEmpty | ObligationDepositsZero | ObligationBorrowsZero | InvalidObligationCollateral | InvalidObligationLiquidity | ObligationCollateralEmpty | ObligationLiquidityEmpty | NegativeInterestRate | InvalidOracleConfig | InsufficientProtocolFeesToRedeem | FlashBorrowCpi | NoFlashRepayFound | InvalidFlashRepay | FlashRepayCpi | MultipleFlashBorrows | FlashLoansDisabled | SwitchboardV2Error | CouldNotDeserializeScope | PriceTooOld | PriceTooDivergentFromTwap | InvalidTwapPrice | GlobalEmergencyMode | InvalidFlag | PriceNotValid | PriceIsBiggerThanHeuristic | PriceIsLowerThanHeuristic | PriceIsZero | PriceConfidenceTooWide | IntegerOverflow | NoFarmForReserve | IncorrectInstructionInPosition | NoPriceFound | InvalidTwapConfig | InvalidPythPriceAccount | InvalidSwitchboardAccount | InvalidScopePriceAccount | ObligationCollateralLtvZero | InvalidObligationSeedsValue | DeprecatedInvalidObligationId | InvalidBorrowRateCurvePoint | InvalidUtilizationRate | CannotSocializeObligationWithCollateral | ObligationEmpty | WithdrawalCapReached | LastTimestampGreaterThanCurrent | LiquidationRewardTooSmall | IsolatedAssetTierViolation | InconsistentElevationGroup | InvalidElevationGroup | InvalidElevationGroupConfig | UnhealthyElevationGroupLtv | ElevationGroupNewLoansDisabled | ReserveDeprecated | ReferrerAccountNotInitialized | ReferrerAccountMintMissmatch | ReferrerAccountWrongAddress | ReferrerAccountReferrerMissmatch | ReferrerAccountMissing | InsufficientReferralFeesToRedeem | CpiDisabled | ShortUrlNotAsciiAlphanumeric | ReserveObsolete | ElevationGroupAlreadyActivated | ObligationInObsoleteReserve | ReferrerStateOwnerMismatch | UserMetadataOwnerAlreadySet | CollateralNonLiquidatable | BorrowingDisabled | BorrowLimitExceeded | DepositLimitExceeded | BorrowingDisabledOutsideElevationGroup | NetValueRemainingTooSmall | WorseLtvBlocked | LiabilitiesBiggerThanAssets | ReserveTokenBalanceMismatch | ReserveVaultBalanceMismatch | ReserveAccountingMismatch | BorrowingAboveUtilizationRateDisabled | LiquidationBorrowFactorPriority | LiquidationLowestLiquidationLtvPriority | ElevationGroupBorrowLimitExceeded | ElevationGroupWithoutDebtReserve | ElevationGroupMaxCollateralReserveZero | ElevationGroupHasAnotherDebtReserve | ElevationGroupDebtReserveAsCollateral | ObligationCollateralExceedsElevationGroupLimit | ObligationElevationGroupMultipleDebtReserve | UnsupportedTokenExtension | InvalidTokenAccount | DepositDisabledOutsideElevationGroup | CannotCalculateReferralAmountDueToSlotsMismatch | ObligationOwnersMustMatch | ObligationsMustMatch | LendingMarketsMustMatch | ObligationCurrentlyMarkedForDeleveraging | MaximumWithdrawValueZero | ZeroMaxLtvAssetsInDeposits | LowestLtvAssetsPriority | WorseLtvThanUnhealthyLtv | FarmAccountsMissing | RepayTooSmallForFullLiquidation | InsufficientRepayAmount | OrderIndexOutOfBounds | InvalidOrderConfiguration | OrderConfigurationNotSupportedByObligation | OperationNotPermittedWithCurrentObligationOrders | OperationNotPermittedMarketImmutable | OrderCreationDisabled | NoUpgradeAuthority | InitialAdminDepositExecuted | ReserveHasNotReceivedInitialDeposit | CTokenUsageBlocked | CannotUseSameReserve | TransactionIncludesRestrictedPrograms | BorrowOrderDebtLiquidityMintMismatch | BorrowOrderMaxBorrowRateExceeded | BorrowOrderMinDebtTermInsufficient | BorrowOrderFillTimeLimitExceeded | ReserveDebtMaturityReached | NonUpdatableOrderConfiguration | BorrowOrderExecutionDisabled | DebtReachedReserveDebtTerm | ExpectationNotMet;
1
+ export type CustomError = InvalidMarketAuthority | InvalidMarketOwner | InvalidAccountOwner | InvalidAmount | InvalidConfig | InvalidSigner | InvalidAccountInput | MathOverflow | InsufficientLiquidity | ReserveStale | WithdrawTooSmall | WithdrawTooLarge | BorrowTooSmall | BorrowTooLarge | RepayTooSmall | LiquidationTooSmall | ObligationHealthy | ObligationStale | ObligationReserveLimit | InvalidObligationOwner | ObligationDepositsEmpty | ObligationBorrowsEmpty | ObligationDepositsZero | ObligationBorrowsZero | InvalidObligationCollateral | InvalidObligationLiquidity | ObligationCollateralEmpty | ObligationLiquidityEmpty | NegativeInterestRate | InvalidOracleConfig | InsufficientProtocolFeesToRedeem | FlashBorrowCpi | NoFlashRepayFound | InvalidFlashRepay | FlashRepayCpi | MultipleFlashBorrows | FlashLoansDisabled | SwitchboardV2Error | CouldNotDeserializeScope | PriceTooOld | PriceTooDivergentFromTwap | InvalidTwapPrice | GlobalEmergencyMode | InvalidFlag | PriceNotValid | PriceIsBiggerThanHeuristic | PriceIsLowerThanHeuristic | PriceIsZero | PriceConfidenceTooWide | IntegerOverflow | NoFarmForReserve | IncorrectInstructionInPosition | NoPriceFound | InvalidTwapConfig | InvalidPythPriceAccount | InvalidSwitchboardAccount | InvalidScopePriceAccount | ObligationCollateralLtvZero | InvalidObligationSeedsValue | DeprecatedInvalidObligationId | InvalidBorrowRateCurvePoint | InvalidUtilizationRate | CannotSocializeObligationWithCollateral | ObligationEmpty | WithdrawalCapReached | LastTimestampGreaterThanCurrent | LiquidationRewardTooSmall | IsolatedAssetTierViolation | InconsistentElevationGroup | InvalidElevationGroup | InvalidElevationGroupConfig | UnhealthyElevationGroupLtv | ElevationGroupNewLoansDisabled | ReserveDeprecated | ReferrerAccountNotInitialized | ReferrerAccountMintMissmatch | ReferrerAccountWrongAddress | ReferrerAccountReferrerMissmatch | ReferrerAccountMissing | InsufficientReferralFeesToRedeem | CpiDisabled | ShortUrlNotAsciiAlphanumeric | ReserveObsolete | ElevationGroupAlreadyActivated | ObligationInObsoleteReserve | ReferrerStateOwnerMismatch | UserMetadataOwnerAlreadySet | CollateralNonLiquidatable | BorrowingDisabled | BorrowLimitExceeded | DepositLimitExceeded | BorrowingDisabledOutsideElevationGroup | NetValueRemainingTooSmall | WorseLtvBlocked | LiabilitiesBiggerThanAssets | ReserveTokenBalanceMismatch | ReserveVaultBalanceMismatch | ReserveAccountingMismatch | BorrowingAboveUtilizationRateDisabled | LiquidationBorrowFactorPriority | LiquidationLowestLiquidationLtvPriority | ElevationGroupBorrowLimitExceeded | ElevationGroupWithoutDebtReserve | ElevationGroupMaxCollateralReserveZero | ElevationGroupHasAnotherDebtReserve | ElevationGroupDebtReserveAsCollateral | ObligationCollateralExceedsElevationGroupLimit | ObligationElevationGroupMultipleDebtReserve | UnsupportedTokenExtension | InvalidTokenAccount | DepositDisabledOutsideElevationGroup | CannotCalculateReferralAmountDueToSlotsMismatch | ObligationOwnersMustMatch | ObligationsMustMatch | LendingMarketsMustMatch | ObligationCurrentlyMarkedForDeleveraging | MaximumWithdrawValueZero | ZeroMaxLtvAssetsInDeposits | LowestLtvAssetsPriority | WorseLtvThanUnhealthyLtv | FarmAccountsMissing | RepayTooSmallForFullLiquidation | InsufficientRepayAmount | OrderIndexOutOfBounds | InvalidOrderConfiguration | OrderConfigurationNotSupportedByObligation | OperationNotPermittedWithCurrentObligationOrders | OperationNotPermittedMarketImmutable | OrderCreationDisabled | NoUpgradeAuthority | InitialAdminDepositExecuted | ReserveHasNotReceivedInitialDeposit | CTokenUsageBlocked | CannotUseSameReserve | TransactionIncludesRestrictedPrograms | BorrowOrderDebtLiquidityMintMismatch | BorrowOrderMaxBorrowRateExceeded | BorrowOrderMinDebtTermInsufficient | BorrowOrderFillTimeLimitExceeded | ReserveDebtMaturityReached | NonUpdatableOrderConfiguration | BorrowOrderExecutionDisabled | DebtReachedReserveDebtTerm | ExpectationNotMet | WithdrawTicketIssuanceDisabled | WithdrawTicketRedemptionDisabled | WithdrawTicketStillValid | WithdrawTicketRequiresFullRedemption | UserTokenBalanceMismatch | WithdrawQueuedLiquidityValueTooSmall | InvalidTokenAccountState | WithdrawTicketInvalid | InvalidWithdrawTicketProgressCallbackConfig | WithdrawTicketProgressCallbackAccountsMissing;
2
2
  export declare class InvalidMarketAuthority extends Error {
3
3
  readonly logs?: string[] | undefined;
4
4
  static readonly code = 6000;
@@ -1151,5 +1151,85 @@ export declare class ExpectationNotMet extends Error {
1151
1151
  readonly msg = "The on-chain state does not meet expectation specified by the caller, so the operation must be aborted (to avoid race conditions)";
1152
1152
  constructor(logs?: string[] | undefined);
1153
1153
  }
1154
+ export declare class WithdrawTicketIssuanceDisabled extends Error {
1155
+ readonly logs?: string[] | undefined;
1156
+ static readonly code = 6144;
1157
+ readonly code = 6144;
1158
+ readonly name = "WithdrawTicketIssuanceDisabled";
1159
+ readonly msg = "Issuing new withdraw tickets is disabled by the market";
1160
+ constructor(logs?: string[] | undefined);
1161
+ }
1162
+ export declare class WithdrawTicketRedemptionDisabled extends Error {
1163
+ readonly logs?: string[] | undefined;
1164
+ static readonly code = 6145;
1165
+ readonly code = 6145;
1166
+ readonly name = "WithdrawTicketRedemptionDisabled";
1167
+ readonly msg = "Redeeming withdraw tickets is disabled by the market";
1168
+ constructor(logs?: string[] | undefined);
1169
+ }
1170
+ export declare class WithdrawTicketStillValid extends Error {
1171
+ readonly logs?: string[] | undefined;
1172
+ static readonly code = 6146;
1173
+ readonly code = 6146;
1174
+ readonly name = "WithdrawTicketStillValid";
1175
+ readonly msg = "Recovering collateral is only available after the withdraw ticket has been marked invalid";
1176
+ constructor(logs?: string[] | undefined);
1177
+ }
1178
+ export declare class WithdrawTicketRequiresFullRedemption extends Error {
1179
+ readonly logs?: string[] | undefined;
1180
+ static readonly code = 6147;
1181
+ readonly code = 6147;
1182
+ readonly name = "WithdrawTicketRequiresFullRedemption";
1183
+ readonly msg = "The withdraw ticket's current state requires that it is fully redeemed (e.g. due to owner ATA creation), but there is not enough liquidity";
1184
+ constructor(logs?: string[] | undefined);
1185
+ }
1186
+ export declare class UserTokenBalanceMismatch extends Error {
1187
+ readonly logs?: string[] | undefined;
1188
+ static readonly code = 6148;
1189
+ readonly code = 6148;
1190
+ readonly name = "UserTokenBalanceMismatch";
1191
+ readonly msg = "The user's token account has changed its balance in an unexpected way";
1192
+ constructor(logs?: string[] | undefined);
1193
+ }
1194
+ export declare class WithdrawQueuedLiquidityValueTooSmall extends Error {
1195
+ readonly logs?: string[] | undefined;
1196
+ static readonly code = 6149;
1197
+ readonly code = 6149;
1198
+ readonly name = "WithdrawQueuedLiquidityValueTooSmall";
1199
+ readonly msg = "Available liquidity could not satisfy the minimum required ticketed withdrawal value";
1200
+ constructor(logs?: string[] | undefined);
1201
+ }
1202
+ export declare class InvalidTokenAccountState extends Error {
1203
+ readonly logs?: string[] | undefined;
1204
+ static readonly code = 6150;
1205
+ readonly code = 6150;
1206
+ readonly name = "InvalidTokenAccountState";
1207
+ readonly msg = "Token account is in a state preventing the handler's operation (e.g. frozen or delegate)";
1208
+ constructor(logs?: string[] | undefined);
1209
+ }
1210
+ export declare class WithdrawTicketInvalid extends Error {
1211
+ readonly logs?: string[] | undefined;
1212
+ static readonly code = 6151;
1213
+ readonly code = 6151;
1214
+ readonly name = "WithdrawTicketInvalid";
1215
+ readonly msg = "Cannot use ticket that was already marked invalid";
1216
+ constructor(logs?: string[] | undefined);
1217
+ }
1218
+ export declare class InvalidWithdrawTicketProgressCallbackConfig extends Error {
1219
+ readonly logs?: string[] | undefined;
1220
+ static readonly code = 6152;
1221
+ readonly code = 6152;
1222
+ readonly name = "InvalidWithdrawTicketProgressCallbackConfig";
1223
+ readonly msg = "Invalid configuration or required custom accounts for the requested withdraw ticket callback type";
1224
+ constructor(logs?: string[] | undefined);
1225
+ }
1226
+ export declare class WithdrawTicketProgressCallbackAccountsMissing extends Error {
1227
+ readonly logs?: string[] | undefined;
1228
+ static readonly code = 6153;
1229
+ readonly code = 6153;
1230
+ readonly name = "WithdrawTicketProgressCallbackAccountsMissing";
1231
+ readonly msg = "One or more accounts required by the ticket's configured progress callback are missing";
1232
+ constructor(logs?: string[] | undefined);
1233
+ }
1154
1234
  export declare function fromCode(code: number, logs?: string[]): CustomError | null;
1155
1235
  //# sourceMappingURL=custom.d.ts.map