@keel-fi/svm-alm-controller 1.0.0-rc.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/dist/generated/accounts/controller.d.ts +29 -0
- package/dist/generated/accounts/controller.d.ts.map +1 -0
- package/dist/generated/accounts/index.d.ts +6 -0
- package/dist/generated/accounts/index.d.ts.map +1 -0
- package/dist/generated/accounts/integration.d.ts +45 -0
- package/dist/generated/accounts/integration.d.ts.map +1 -0
- package/dist/generated/accounts/oracle.d.ts +39 -0
- package/dist/generated/accounts/oracle.d.ts.map +1 -0
- package/dist/generated/accounts/permission.d.ts +43 -0
- package/dist/generated/accounts/permission.d.ts.map +1 -0
- package/dist/generated/accounts/reserve.d.ts +41 -0
- package/dist/generated/accounts/reserve.d.ts.map +1 -0
- package/dist/generated/index.d.ts +5 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/instructions/atomicSwapBorrow.d.ts +76 -0
- package/dist/generated/instructions/atomicSwapBorrow.d.ts.map +1 -0
- package/dist/generated/instructions/atomicSwapRepay.d.ts +78 -0
- package/dist/generated/instructions/atomicSwapRepay.d.ts.map +1 -0
- package/dist/generated/instructions/emitEvent.d.ts +37 -0
- package/dist/generated/instructions/emitEvent.d.ts.map +1 -0
- package/dist/generated/instructions/index.d.ts +19 -0
- package/dist/generated/instructions/index.d.ts.map +1 -0
- package/dist/generated/instructions/initializeController.d.ts +56 -0
- package/dist/generated/instructions/initializeController.d.ts.map +1 -0
- package/dist/generated/instructions/initializeIntegration.d.ts +74 -0
- package/dist/generated/instructions/initializeIntegration.d.ts.map +1 -0
- package/dist/generated/instructions/initializeOracle.d.ts +61 -0
- package/dist/generated/instructions/initializeOracle.d.ts.map +1 -0
- package/dist/generated/instructions/initializeReserve.d.ts +74 -0
- package/dist/generated/instructions/initializeReserve.d.ts.map +1 -0
- package/dist/generated/instructions/manageController.d.ts +47 -0
- package/dist/generated/instructions/manageController.d.ts.map +1 -0
- package/dist/generated/instructions/manageIntegration.d.ts +59 -0
- package/dist/generated/instructions/manageIntegration.d.ts.map +1 -0
- package/dist/generated/instructions/managePermission.d.ts +86 -0
- package/dist/generated/instructions/managePermission.d.ts.map +1 -0
- package/dist/generated/instructions/manageReserve.d.ts +56 -0
- package/dist/generated/instructions/manageReserve.d.ts.map +1 -0
- package/dist/generated/instructions/pull.d.ts +56 -0
- package/dist/generated/instructions/pull.d.ts.map +1 -0
- package/dist/generated/instructions/push.d.ts +56 -0
- package/dist/generated/instructions/push.d.ts.map +1 -0
- package/dist/generated/instructions/refreshOracle.d.ts +33 -0
- package/dist/generated/instructions/refreshOracle.d.ts.map +1 -0
- package/dist/generated/instructions/resetLzPushInFlight.d.ts +36 -0
- package/dist/generated/instructions/resetLzPushInFlight.d.ts.map +1 -0
- package/dist/generated/instructions/sync.d.ts +36 -0
- package/dist/generated/instructions/sync.d.ts.map +1 -0
- package/dist/generated/instructions/syncReserve.d.ts +39 -0
- package/dist/generated/instructions/syncReserve.d.ts.map +1 -0
- package/dist/generated/instructions/updateOracle.d.ts +50 -0
- package/dist/generated/instructions/updateOracle.d.ts.map +1 -0
- package/dist/generated/programs/index.d.ts +2 -0
- package/dist/generated/programs/index.d.ts.map +1 -0
- package/dist/generated/programs/svmAlmController.d.ts +71 -0
- package/dist/generated/programs/svmAlmController.d.ts.map +1 -0
- package/dist/generated/shared/index.d.ts +15 -0
- package/dist/generated/shared/index.d.ts.map +1 -0
- package/dist/generated/types/accountDiscriminators.d.ts +14 -0
- package/dist/generated/types/accountDiscriminators.d.ts.map +1 -0
- package/dist/generated/types/accountingAction.d.ts +14 -0
- package/dist/generated/types/accountingAction.d.ts.map +1 -0
- package/dist/generated/types/accountingDirection.d.ts +10 -0
- package/dist/generated/types/accountingDirection.d.ts.map +1 -0
- package/dist/generated/types/accountingEvent.d.ts +24 -0
- package/dist/generated/types/accountingEvent.d.ts.map +1 -0
- package/dist/generated/types/atomicSwapConfig.d.ts +29 -0
- package/dist/generated/types/atomicSwapConfig.d.ts.map +1 -0
- package/dist/generated/types/atomicSwapState.d.ts +21 -0
- package/dist/generated/types/atomicSwapState.d.ts.map +1 -0
- package/dist/generated/types/cctpBridgeConfig.d.ts +14 -0
- package/dist/generated/types/cctpBridgeConfig.d.ts.map +1 -0
- package/dist/generated/types/cctpBridgeState.d.ts +9 -0
- package/dist/generated/types/cctpBridgeState.d.ts.map +1 -0
- package/dist/generated/types/controllerStatus.d.ts +11 -0
- package/dist/generated/types/controllerStatus.d.ts.map +1 -0
- package/dist/generated/types/controllerUpdateEvent.d.ts +18 -0
- package/dist/generated/types/controllerUpdateEvent.d.ts.map +1 -0
- package/dist/generated/types/depositForBurnArgs.d.ts +15 -0
- package/dist/generated/types/depositForBurnArgs.d.ts.map +1 -0
- package/dist/generated/types/depositSingleTokenTypeExactAmountInArgs.d.ts +13 -0
- package/dist/generated/types/depositSingleTokenTypeExactAmountInArgs.d.ts.map +1 -0
- package/dist/generated/types/feed.d.ts +10 -0
- package/dist/generated/types/feed.d.ts.map +1 -0
- package/dist/generated/types/feedArgs.d.ts +9 -0
- package/dist/generated/types/feedArgs.d.ts.map +1 -0
- package/dist/generated/types/index.d.ts +42 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/initializeArgs.d.ts +51 -0
- package/dist/generated/types/initializeArgs.d.ts.map +1 -0
- package/dist/generated/types/integrationConfig.d.ts +53 -0
- package/dist/generated/types/integrationConfig.d.ts.map +1 -0
- package/dist/generated/types/integrationState.d.ts +53 -0
- package/dist/generated/types/integrationState.d.ts.map +1 -0
- package/dist/generated/types/integrationStatus.d.ts +10 -0
- package/dist/generated/types/integrationStatus.d.ts.map +1 -0
- package/dist/generated/types/integrationType.d.ts +13 -0
- package/dist/generated/types/integrationType.d.ts.map +1 -0
- package/dist/generated/types/integrationUpdateEvent.d.ts +20 -0
- package/dist/generated/types/integrationUpdateEvent.d.ts.map +1 -0
- package/dist/generated/types/localToken.d.ts +27 -0
- package/dist/generated/types/localToken.d.ts.map +1 -0
- package/dist/generated/types/lzBridgeConfig.d.ts +16 -0
- package/dist/generated/types/lzBridgeConfig.d.ts.map +1 -0
- package/dist/generated/types/lzBridgeState.d.ts +10 -0
- package/dist/generated/types/lzBridgeState.d.ts.map +1 -0
- package/dist/generated/types/oFTStore.d.ts +29 -0
- package/dist/generated/types/oFTStore.d.ts.map +1 -0
- package/dist/generated/types/oftSendParams.d.ts +15 -0
- package/dist/generated/types/oftSendParams.d.ts.map +1 -0
- package/dist/generated/types/oracleUpdateEvent.d.ts +20 -0
- package/dist/generated/types/oracleUpdateEvent.d.ts.map +1 -0
- package/dist/generated/types/peerConfig.d.ts +9 -0
- package/dist/generated/types/peerConfig.d.ts.map +1 -0
- package/dist/generated/types/permissionStatus.d.ts +10 -0
- package/dist/generated/types/permissionStatus.d.ts.map +1 -0
- package/dist/generated/types/permissionUpdateEvent.d.ts +20 -0
- package/dist/generated/types/permissionUpdateEvent.d.ts.map +1 -0
- package/dist/generated/types/pullArgs.d.ts +38 -0
- package/dist/generated/types/pullArgs.d.ts.map +1 -0
- package/dist/generated/types/pushArgs.d.ts +44 -0
- package/dist/generated/types/pushArgs.d.ts.map +1 -0
- package/dist/generated/types/remoteTokenMessenger.d.ts +10 -0
- package/dist/generated/types/remoteTokenMessenger.d.ts.map +1 -0
- package/dist/generated/types/reserveStatus.d.ts +10 -0
- package/dist/generated/types/reserveStatus.d.ts.map +1 -0
- package/dist/generated/types/reserveUpdateEvent.d.ts +20 -0
- package/dist/generated/types/reserveUpdateEvent.d.ts.map +1 -0
- package/dist/generated/types/splTokenExternalConfig.d.ts +13 -0
- package/dist/generated/types/splTokenExternalConfig.d.ts.map +1 -0
- package/dist/generated/types/splTokenExternalState.d.ts +9 -0
- package/dist/generated/types/splTokenExternalState.d.ts.map +1 -0
- package/dist/generated/types/splTokenSwapConfig.d.ts +15 -0
- package/dist/generated/types/splTokenSwapConfig.d.ts.map +1 -0
- package/dist/generated/types/splTokenSwapState.d.ts +17 -0
- package/dist/generated/types/splTokenSwapState.d.ts.map +1 -0
- package/dist/generated/types/svmAlmControllerEvent.d.ts +53 -0
- package/dist/generated/types/svmAlmControllerEvent.d.ts.map +1 -0
- package/dist/generated/types/swapV1Subset.d.ts +17 -0
- package/dist/generated/types/swapV1Subset.d.ts.map +1 -0
- package/dist/generated/types/withdrawSingleTokenTypeExactAmountOutArgs.d.ts +13 -0
- package/dist/generated/types/withdrawSingleTokenTypeExactAmountOutArgs.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +3067 -0
- package/dist/index.js +3382 -0
- package/dist/pdas.d.ts +9 -0
- package/dist/pdas.d.ts.map +1 -0
- package/package.json +24 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3382 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var kit = require('@solana/kit');
|
|
4
|
+
var addresses = require('@solana/addresses');
|
|
5
|
+
|
|
6
|
+
exports.AccountDiscriminators = void 0;
|
|
7
|
+
(function (AccountDiscriminators) {
|
|
8
|
+
AccountDiscriminators[AccountDiscriminators["UninitializedDiscriminator"] = 0] = "UninitializedDiscriminator";
|
|
9
|
+
AccountDiscriminators[AccountDiscriminators["ControllerDiscriminator"] = 1] = "ControllerDiscriminator";
|
|
10
|
+
AccountDiscriminators[AccountDiscriminators["PermissionDiscriminator"] = 2] = "PermissionDiscriminator";
|
|
11
|
+
AccountDiscriminators[AccountDiscriminators["IntegrationDiscriminator"] = 3] = "IntegrationDiscriminator";
|
|
12
|
+
AccountDiscriminators[AccountDiscriminators["ReserveDiscriminator"] = 4] = "ReserveDiscriminator";
|
|
13
|
+
AccountDiscriminators[AccountDiscriminators["OracleDiscriminator"] = 5] = "OracleDiscriminator";
|
|
14
|
+
})(exports.AccountDiscriminators || (exports.AccountDiscriminators = {}));
|
|
15
|
+
function getAccountDiscriminatorsEncoder() {
|
|
16
|
+
return kit.getEnumEncoder(exports.AccountDiscriminators);
|
|
17
|
+
}
|
|
18
|
+
function getAccountDiscriminatorsDecoder() {
|
|
19
|
+
return kit.getEnumDecoder(exports.AccountDiscriminators);
|
|
20
|
+
}
|
|
21
|
+
function getAccountDiscriminatorsCodec() {
|
|
22
|
+
return kit.combineCodec(getAccountDiscriminatorsEncoder(), getAccountDiscriminatorsDecoder());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.AccountingAction = void 0;
|
|
26
|
+
(function (AccountingAction) {
|
|
27
|
+
AccountingAction[AccountingAction["Sync"] = 0] = "Sync";
|
|
28
|
+
AccountingAction[AccountingAction["ExternalTransfer"] = 1] = "ExternalTransfer";
|
|
29
|
+
AccountingAction[AccountingAction["Deposit"] = 2] = "Deposit";
|
|
30
|
+
AccountingAction[AccountingAction["Withdrawal"] = 3] = "Withdrawal";
|
|
31
|
+
AccountingAction[AccountingAction["BridgeSend"] = 4] = "BridgeSend";
|
|
32
|
+
AccountingAction[AccountingAction["Swap"] = 5] = "Swap";
|
|
33
|
+
})(exports.AccountingAction || (exports.AccountingAction = {}));
|
|
34
|
+
function getAccountingActionEncoder() {
|
|
35
|
+
return kit.getEnumEncoder(exports.AccountingAction);
|
|
36
|
+
}
|
|
37
|
+
function getAccountingActionDecoder() {
|
|
38
|
+
return kit.getEnumDecoder(exports.AccountingAction);
|
|
39
|
+
}
|
|
40
|
+
function getAccountingActionCodec() {
|
|
41
|
+
return kit.combineCodec(getAccountingActionEncoder(), getAccountingActionDecoder());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.AccountingDirection = void 0;
|
|
45
|
+
(function (AccountingDirection) {
|
|
46
|
+
AccountingDirection[AccountingDirection["Debit"] = 0] = "Debit";
|
|
47
|
+
AccountingDirection[AccountingDirection["Credit"] = 1] = "Credit";
|
|
48
|
+
})(exports.AccountingDirection || (exports.AccountingDirection = {}));
|
|
49
|
+
function getAccountingDirectionEncoder() {
|
|
50
|
+
return kit.getEnumEncoder(exports.AccountingDirection);
|
|
51
|
+
}
|
|
52
|
+
function getAccountingDirectionDecoder() {
|
|
53
|
+
return kit.getEnumDecoder(exports.AccountingDirection);
|
|
54
|
+
}
|
|
55
|
+
function getAccountingDirectionCodec() {
|
|
56
|
+
return kit.combineCodec(getAccountingDirectionEncoder(), getAccountingDirectionDecoder());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getAccountingEventEncoder() {
|
|
60
|
+
return kit.getStructEncoder([
|
|
61
|
+
['controller', kit.getAddressEncoder()],
|
|
62
|
+
['integration', kit.getOptionEncoder(kit.getAddressEncoder())],
|
|
63
|
+
['reserve', kit.getOptionEncoder(kit.getAddressEncoder())],
|
|
64
|
+
['mint', kit.getAddressEncoder()],
|
|
65
|
+
['action', getAccountingActionEncoder()],
|
|
66
|
+
['delta', kit.getU64Encoder()],
|
|
67
|
+
['direction', getAccountingDirectionEncoder()],
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
function getAccountingEventDecoder() {
|
|
71
|
+
return kit.getStructDecoder([
|
|
72
|
+
['controller', kit.getAddressDecoder()],
|
|
73
|
+
['integration', kit.getOptionDecoder(kit.getAddressDecoder())],
|
|
74
|
+
['reserve', kit.getOptionDecoder(kit.getAddressDecoder())],
|
|
75
|
+
['mint', kit.getAddressDecoder()],
|
|
76
|
+
['action', getAccountingActionDecoder()],
|
|
77
|
+
['delta', kit.getU64Decoder()],
|
|
78
|
+
['direction', getAccountingDirectionDecoder()],
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
81
|
+
function getAccountingEventCodec() {
|
|
82
|
+
return kit.combineCodec(getAccountingEventEncoder(), getAccountingEventDecoder());
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function getAtomicSwapConfigEncoder() {
|
|
86
|
+
return kit.getStructEncoder([
|
|
87
|
+
['inputToken', kit.getAddressEncoder()],
|
|
88
|
+
['outputToken', kit.getAddressEncoder()],
|
|
89
|
+
['oracle', kit.getAddressEncoder()],
|
|
90
|
+
['maxStaleness', kit.getU64Encoder()],
|
|
91
|
+
['expiryTimestamp', kit.getI64Encoder()],
|
|
92
|
+
['maxSlippageBps', kit.getU16Encoder()],
|
|
93
|
+
['inputMintDecimals', kit.getU8Encoder()],
|
|
94
|
+
['outputMintDecimals', kit.getU8Encoder()],
|
|
95
|
+
['oraclePriceInverted', kit.getBooleanEncoder()],
|
|
96
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 107)],
|
|
97
|
+
]);
|
|
98
|
+
}
|
|
99
|
+
function getAtomicSwapConfigDecoder() {
|
|
100
|
+
return kit.getStructDecoder([
|
|
101
|
+
['inputToken', kit.getAddressDecoder()],
|
|
102
|
+
['outputToken', kit.getAddressDecoder()],
|
|
103
|
+
['oracle', kit.getAddressDecoder()],
|
|
104
|
+
['maxStaleness', kit.getU64Decoder()],
|
|
105
|
+
['expiryTimestamp', kit.getI64Decoder()],
|
|
106
|
+
['maxSlippageBps', kit.getU16Decoder()],
|
|
107
|
+
['inputMintDecimals', kit.getU8Decoder()],
|
|
108
|
+
['outputMintDecimals', kit.getU8Decoder()],
|
|
109
|
+
['oraclePriceInverted', kit.getBooleanDecoder()],
|
|
110
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 107)],
|
|
111
|
+
]);
|
|
112
|
+
}
|
|
113
|
+
function getAtomicSwapConfigCodec() {
|
|
114
|
+
return kit.combineCodec(getAtomicSwapConfigEncoder(), getAtomicSwapConfigDecoder());
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getAtomicSwapStateEncoder() {
|
|
118
|
+
return kit.getStructEncoder([
|
|
119
|
+
['lastBalanceA', kit.getU64Encoder()],
|
|
120
|
+
['lastBalanceB', kit.getU64Encoder()],
|
|
121
|
+
['amountBorrowed', kit.getU64Encoder()],
|
|
122
|
+
['recipientTokenAPre', kit.getU64Encoder()],
|
|
123
|
+
['recipientTokenBPre', kit.getU64Encoder()],
|
|
124
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
function getAtomicSwapStateDecoder() {
|
|
128
|
+
return kit.getStructDecoder([
|
|
129
|
+
['lastBalanceA', kit.getU64Decoder()],
|
|
130
|
+
['lastBalanceB', kit.getU64Decoder()],
|
|
131
|
+
['amountBorrowed', kit.getU64Decoder()],
|
|
132
|
+
['recipientTokenAPre', kit.getU64Decoder()],
|
|
133
|
+
['recipientTokenBPre', kit.getU64Decoder()],
|
|
134
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
135
|
+
]);
|
|
136
|
+
}
|
|
137
|
+
function getAtomicSwapStateCodec() {
|
|
138
|
+
return kit.combineCodec(getAtomicSwapStateEncoder(), getAtomicSwapStateDecoder());
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function getCctpBridgeConfigEncoder() {
|
|
142
|
+
return kit.getStructEncoder([
|
|
143
|
+
['cctpTokenMessengerMinter', kit.getAddressEncoder()],
|
|
144
|
+
['cctpMessageTransmitter', kit.getAddressEncoder()],
|
|
145
|
+
['mint', kit.getAddressEncoder()],
|
|
146
|
+
['destinationAddress', kit.getAddressEncoder()],
|
|
147
|
+
['destinationDomain', kit.getU32Encoder()],
|
|
148
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 92)],
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
function getCctpBridgeConfigDecoder() {
|
|
152
|
+
return kit.getStructDecoder([
|
|
153
|
+
['cctpTokenMessengerMinter', kit.getAddressDecoder()],
|
|
154
|
+
['cctpMessageTransmitter', kit.getAddressDecoder()],
|
|
155
|
+
['mint', kit.getAddressDecoder()],
|
|
156
|
+
['destinationAddress', kit.getAddressDecoder()],
|
|
157
|
+
['destinationDomain', kit.getU32Decoder()],
|
|
158
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 92)],
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
function getCctpBridgeConfigCodec() {
|
|
162
|
+
return kit.combineCodec(getCctpBridgeConfigEncoder(), getCctpBridgeConfigDecoder());
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function getCctpBridgeStateEncoder() {
|
|
166
|
+
return kit.getStructEncoder([['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 48)]]);
|
|
167
|
+
}
|
|
168
|
+
function getCctpBridgeStateDecoder() {
|
|
169
|
+
return kit.getStructDecoder([['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 48)]]);
|
|
170
|
+
}
|
|
171
|
+
function getCctpBridgeStateCodec() {
|
|
172
|
+
return kit.combineCodec(getCctpBridgeStateEncoder(), getCctpBridgeStateDecoder());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
exports.ControllerStatus = void 0;
|
|
176
|
+
(function (ControllerStatus) {
|
|
177
|
+
ControllerStatus[ControllerStatus["Frozen"] = 0] = "Frozen";
|
|
178
|
+
ControllerStatus[ControllerStatus["Active"] = 1] = "Active";
|
|
179
|
+
ControllerStatus[ControllerStatus["PushPullFrozen"] = 2] = "PushPullFrozen";
|
|
180
|
+
})(exports.ControllerStatus || (exports.ControllerStatus = {}));
|
|
181
|
+
function getControllerStatusEncoder() {
|
|
182
|
+
return kit.getEnumEncoder(exports.ControllerStatus);
|
|
183
|
+
}
|
|
184
|
+
function getControllerStatusDecoder() {
|
|
185
|
+
return kit.getEnumDecoder(exports.ControllerStatus);
|
|
186
|
+
}
|
|
187
|
+
function getControllerStatusCodec() {
|
|
188
|
+
return kit.combineCodec(getControllerStatusEncoder(), getControllerStatusDecoder());
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function getControllerUpdateEventEncoder() {
|
|
192
|
+
return kit.getStructEncoder([
|
|
193
|
+
['authority', kit.getAddressEncoder()],
|
|
194
|
+
['controller', kit.getAddressEncoder()],
|
|
195
|
+
['oldState', kit.getOptionEncoder(getControllerEncoder())],
|
|
196
|
+
['newState', kit.getOptionEncoder(getControllerEncoder())],
|
|
197
|
+
]);
|
|
198
|
+
}
|
|
199
|
+
function getControllerUpdateEventDecoder() {
|
|
200
|
+
return kit.getStructDecoder([
|
|
201
|
+
['authority', kit.getAddressDecoder()],
|
|
202
|
+
['controller', kit.getAddressDecoder()],
|
|
203
|
+
['oldState', kit.getOptionDecoder(getControllerDecoder())],
|
|
204
|
+
['newState', kit.getOptionDecoder(getControllerDecoder())],
|
|
205
|
+
]);
|
|
206
|
+
}
|
|
207
|
+
function getControllerUpdateEventCodec() {
|
|
208
|
+
return kit.combineCodec(getControllerUpdateEventEncoder(), getControllerUpdateEventDecoder());
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function getDepositForBurnArgsEncoder() {
|
|
212
|
+
return kit.getStructEncoder([
|
|
213
|
+
['amount', kit.getU64Encoder()],
|
|
214
|
+
['destinationDomain', kit.getU32Encoder()],
|
|
215
|
+
['mintRecipient', kit.getAddressEncoder()],
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
function getDepositForBurnArgsDecoder() {
|
|
219
|
+
return kit.getStructDecoder([
|
|
220
|
+
['amount', kit.getU64Decoder()],
|
|
221
|
+
['destinationDomain', kit.getU32Decoder()],
|
|
222
|
+
['mintRecipient', kit.getAddressDecoder()],
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
function getDepositForBurnArgsCodec() {
|
|
226
|
+
return kit.combineCodec(getDepositForBurnArgsEncoder(), getDepositForBurnArgsDecoder());
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function getDepositSingleTokenTypeExactAmountInArgsEncoder() {
|
|
230
|
+
return kit.getStructEncoder([
|
|
231
|
+
['sourceTokenAmount', kit.getU64Encoder()],
|
|
232
|
+
['minimumPoolTokenAmount', kit.getU64Encoder()],
|
|
233
|
+
]);
|
|
234
|
+
}
|
|
235
|
+
function getDepositSingleTokenTypeExactAmountInArgsDecoder() {
|
|
236
|
+
return kit.getStructDecoder([
|
|
237
|
+
['sourceTokenAmount', kit.getU64Decoder()],
|
|
238
|
+
['minimumPoolTokenAmount', kit.getU64Decoder()],
|
|
239
|
+
]);
|
|
240
|
+
}
|
|
241
|
+
function getDepositSingleTokenTypeExactAmountInArgsCodec() {
|
|
242
|
+
return kit.combineCodec(getDepositSingleTokenTypeExactAmountInArgsEncoder(), getDepositSingleTokenTypeExactAmountInArgsDecoder());
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function getFeedEncoder() {
|
|
246
|
+
return kit.getStructEncoder([
|
|
247
|
+
['priceFeed', kit.getAddressEncoder()],
|
|
248
|
+
['oracleType', kit.getU8Encoder()],
|
|
249
|
+
['reserved', kit.fixEncoderSize(kit.getBytesEncoder(), 63)],
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
function getFeedDecoder() {
|
|
253
|
+
return kit.getStructDecoder([
|
|
254
|
+
['priceFeed', kit.getAddressDecoder()],
|
|
255
|
+
['oracleType', kit.getU8Decoder()],
|
|
256
|
+
['reserved', kit.fixDecoderSize(kit.getBytesDecoder(), 63)],
|
|
257
|
+
]);
|
|
258
|
+
}
|
|
259
|
+
function getFeedCodec() {
|
|
260
|
+
return kit.combineCodec(getFeedEncoder(), getFeedDecoder());
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function getFeedArgsEncoder() {
|
|
264
|
+
return kit.getStructEncoder([['oracleType', kit.getU8Encoder()]]);
|
|
265
|
+
}
|
|
266
|
+
function getFeedArgsDecoder() {
|
|
267
|
+
return kit.getStructDecoder([['oracleType', kit.getU8Decoder()]]);
|
|
268
|
+
}
|
|
269
|
+
function getFeedArgsCodec() {
|
|
270
|
+
return kit.combineCodec(getFeedArgsEncoder(), getFeedArgsDecoder());
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function getInitializeArgsEncoder() {
|
|
274
|
+
return kit.getDiscriminatedUnionEncoder([
|
|
275
|
+
['SplTokenExternal', kit.getUnitEncoder()],
|
|
276
|
+
['SplTokenSwap', kit.getUnitEncoder()],
|
|
277
|
+
[
|
|
278
|
+
'CctpBridge',
|
|
279
|
+
kit.getStructEncoder([
|
|
280
|
+
['destinationAddress', kit.getAddressEncoder()],
|
|
281
|
+
['destinationDomain', kit.getU32Encoder()],
|
|
282
|
+
]),
|
|
283
|
+
],
|
|
284
|
+
[
|
|
285
|
+
'LzBridge',
|
|
286
|
+
kit.getStructEncoder([
|
|
287
|
+
['destinationAddress', kit.getAddressEncoder()],
|
|
288
|
+
['destinationEid', kit.getU32Encoder()],
|
|
289
|
+
]),
|
|
290
|
+
],
|
|
291
|
+
[
|
|
292
|
+
'AtomicSwap',
|
|
293
|
+
kit.getStructEncoder([
|
|
294
|
+
['maxSlippageBps', kit.getU16Encoder()],
|
|
295
|
+
['maxStaleness', kit.getU64Encoder()],
|
|
296
|
+
['expiryTimestamp', kit.getI64Encoder()],
|
|
297
|
+
['oraclePriceInverted', kit.getBooleanEncoder()],
|
|
298
|
+
]),
|
|
299
|
+
],
|
|
300
|
+
]);
|
|
301
|
+
}
|
|
302
|
+
function getInitializeArgsDecoder() {
|
|
303
|
+
return kit.getDiscriminatedUnionDecoder([
|
|
304
|
+
['SplTokenExternal', kit.getUnitDecoder()],
|
|
305
|
+
['SplTokenSwap', kit.getUnitDecoder()],
|
|
306
|
+
[
|
|
307
|
+
'CctpBridge',
|
|
308
|
+
kit.getStructDecoder([
|
|
309
|
+
['destinationAddress', kit.getAddressDecoder()],
|
|
310
|
+
['destinationDomain', kit.getU32Decoder()],
|
|
311
|
+
]),
|
|
312
|
+
],
|
|
313
|
+
[
|
|
314
|
+
'LzBridge',
|
|
315
|
+
kit.getStructDecoder([
|
|
316
|
+
['destinationAddress', kit.getAddressDecoder()],
|
|
317
|
+
['destinationEid', kit.getU32Decoder()],
|
|
318
|
+
]),
|
|
319
|
+
],
|
|
320
|
+
[
|
|
321
|
+
'AtomicSwap',
|
|
322
|
+
kit.getStructDecoder([
|
|
323
|
+
['maxSlippageBps', kit.getU16Decoder()],
|
|
324
|
+
['maxStaleness', kit.getU64Decoder()],
|
|
325
|
+
['expiryTimestamp', kit.getI64Decoder()],
|
|
326
|
+
['oraclePriceInverted', kit.getBooleanDecoder()],
|
|
327
|
+
]),
|
|
328
|
+
],
|
|
329
|
+
]);
|
|
330
|
+
}
|
|
331
|
+
function getInitializeArgsCodec() {
|
|
332
|
+
return kit.combineCodec(getInitializeArgsEncoder(), getInitializeArgsDecoder());
|
|
333
|
+
}
|
|
334
|
+
function initializeArgs(kind, data) {
|
|
335
|
+
return Array.isArray(data)
|
|
336
|
+
? { __kind: kind, fields: data }
|
|
337
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
338
|
+
}
|
|
339
|
+
function isInitializeArgs(kind, value) {
|
|
340
|
+
return value.__kind === kind;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function getIntegrationConfigEncoder() {
|
|
344
|
+
return kit.getDiscriminatedUnionEncoder([
|
|
345
|
+
[
|
|
346
|
+
'Undefined',
|
|
347
|
+
kit.getStructEncoder([['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 224)]]),
|
|
348
|
+
],
|
|
349
|
+
[
|
|
350
|
+
'SplTokenExternal',
|
|
351
|
+
kit.getStructEncoder([
|
|
352
|
+
['fields', kit.getTupleEncoder([getSplTokenExternalConfigEncoder()])],
|
|
353
|
+
]),
|
|
354
|
+
],
|
|
355
|
+
[
|
|
356
|
+
'SplTokenSwap',
|
|
357
|
+
kit.getStructEncoder([
|
|
358
|
+
['fields', kit.getTupleEncoder([getSplTokenSwapConfigEncoder()])],
|
|
359
|
+
]),
|
|
360
|
+
],
|
|
361
|
+
[
|
|
362
|
+
'CctpBridge',
|
|
363
|
+
kit.getStructEncoder([
|
|
364
|
+
['fields', kit.getTupleEncoder([getCctpBridgeConfigEncoder()])],
|
|
365
|
+
]),
|
|
366
|
+
],
|
|
367
|
+
[
|
|
368
|
+
'LzBridge',
|
|
369
|
+
kit.getStructEncoder([
|
|
370
|
+
['fields', kit.getTupleEncoder([getLzBridgeConfigEncoder()])],
|
|
371
|
+
]),
|
|
372
|
+
],
|
|
373
|
+
[
|
|
374
|
+
'AtomicSwap',
|
|
375
|
+
kit.getStructEncoder([
|
|
376
|
+
['fields', kit.getTupleEncoder([getAtomicSwapConfigEncoder()])],
|
|
377
|
+
]),
|
|
378
|
+
],
|
|
379
|
+
]);
|
|
380
|
+
}
|
|
381
|
+
function getIntegrationConfigDecoder() {
|
|
382
|
+
return kit.getDiscriminatedUnionDecoder([
|
|
383
|
+
[
|
|
384
|
+
'Undefined',
|
|
385
|
+
kit.getStructDecoder([['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 224)]]),
|
|
386
|
+
],
|
|
387
|
+
[
|
|
388
|
+
'SplTokenExternal',
|
|
389
|
+
kit.getStructDecoder([
|
|
390
|
+
['fields', kit.getTupleDecoder([getSplTokenExternalConfigDecoder()])],
|
|
391
|
+
]),
|
|
392
|
+
],
|
|
393
|
+
[
|
|
394
|
+
'SplTokenSwap',
|
|
395
|
+
kit.getStructDecoder([
|
|
396
|
+
['fields', kit.getTupleDecoder([getSplTokenSwapConfigDecoder()])],
|
|
397
|
+
]),
|
|
398
|
+
],
|
|
399
|
+
[
|
|
400
|
+
'CctpBridge',
|
|
401
|
+
kit.getStructDecoder([
|
|
402
|
+
['fields', kit.getTupleDecoder([getCctpBridgeConfigDecoder()])],
|
|
403
|
+
]),
|
|
404
|
+
],
|
|
405
|
+
[
|
|
406
|
+
'LzBridge',
|
|
407
|
+
kit.getStructDecoder([
|
|
408
|
+
['fields', kit.getTupleDecoder([getLzBridgeConfigDecoder()])],
|
|
409
|
+
]),
|
|
410
|
+
],
|
|
411
|
+
[
|
|
412
|
+
'AtomicSwap',
|
|
413
|
+
kit.getStructDecoder([
|
|
414
|
+
['fields', kit.getTupleDecoder([getAtomicSwapConfigDecoder()])],
|
|
415
|
+
]),
|
|
416
|
+
],
|
|
417
|
+
]);
|
|
418
|
+
}
|
|
419
|
+
function getIntegrationConfigCodec() {
|
|
420
|
+
return kit.combineCodec(getIntegrationConfigEncoder(), getIntegrationConfigDecoder());
|
|
421
|
+
}
|
|
422
|
+
function integrationConfig(kind, data) {
|
|
423
|
+
return Array.isArray(data)
|
|
424
|
+
? { __kind: kind, fields: data }
|
|
425
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
426
|
+
}
|
|
427
|
+
function isIntegrationConfig(kind, value) {
|
|
428
|
+
return value.__kind === kind;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function getIntegrationStateEncoder() {
|
|
432
|
+
return kit.getDiscriminatedUnionEncoder([
|
|
433
|
+
[
|
|
434
|
+
'Undefined',
|
|
435
|
+
kit.getStructEncoder([['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 48)]]),
|
|
436
|
+
],
|
|
437
|
+
[
|
|
438
|
+
'SplTokenExternal',
|
|
439
|
+
kit.getStructEncoder([
|
|
440
|
+
['fields', kit.getTupleEncoder([getSplTokenExternalStateEncoder()])],
|
|
441
|
+
]),
|
|
442
|
+
],
|
|
443
|
+
[
|
|
444
|
+
'SplTokenSwap',
|
|
445
|
+
kit.getStructEncoder([
|
|
446
|
+
['fields', kit.getTupleEncoder([getSplTokenSwapStateEncoder()])],
|
|
447
|
+
]),
|
|
448
|
+
],
|
|
449
|
+
[
|
|
450
|
+
'CctpBridge',
|
|
451
|
+
kit.getStructEncoder([
|
|
452
|
+
['fields', kit.getTupleEncoder([getCctpBridgeStateEncoder()])],
|
|
453
|
+
]),
|
|
454
|
+
],
|
|
455
|
+
[
|
|
456
|
+
'LzBridge',
|
|
457
|
+
kit.getStructEncoder([
|
|
458
|
+
['fields', kit.getTupleEncoder([getLzBridgeStateEncoder()])],
|
|
459
|
+
]),
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
'AtomicSwap',
|
|
463
|
+
kit.getStructEncoder([
|
|
464
|
+
['fields', kit.getTupleEncoder([getAtomicSwapStateEncoder()])],
|
|
465
|
+
]),
|
|
466
|
+
],
|
|
467
|
+
]);
|
|
468
|
+
}
|
|
469
|
+
function getIntegrationStateDecoder() {
|
|
470
|
+
return kit.getDiscriminatedUnionDecoder([
|
|
471
|
+
[
|
|
472
|
+
'Undefined',
|
|
473
|
+
kit.getStructDecoder([['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 48)]]),
|
|
474
|
+
],
|
|
475
|
+
[
|
|
476
|
+
'SplTokenExternal',
|
|
477
|
+
kit.getStructDecoder([
|
|
478
|
+
['fields', kit.getTupleDecoder([getSplTokenExternalStateDecoder()])],
|
|
479
|
+
]),
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
'SplTokenSwap',
|
|
483
|
+
kit.getStructDecoder([
|
|
484
|
+
['fields', kit.getTupleDecoder([getSplTokenSwapStateDecoder()])],
|
|
485
|
+
]),
|
|
486
|
+
],
|
|
487
|
+
[
|
|
488
|
+
'CctpBridge',
|
|
489
|
+
kit.getStructDecoder([
|
|
490
|
+
['fields', kit.getTupleDecoder([getCctpBridgeStateDecoder()])],
|
|
491
|
+
]),
|
|
492
|
+
],
|
|
493
|
+
[
|
|
494
|
+
'LzBridge',
|
|
495
|
+
kit.getStructDecoder([
|
|
496
|
+
['fields', kit.getTupleDecoder([getLzBridgeStateDecoder()])],
|
|
497
|
+
]),
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
'AtomicSwap',
|
|
501
|
+
kit.getStructDecoder([
|
|
502
|
+
['fields', kit.getTupleDecoder([getAtomicSwapStateDecoder()])],
|
|
503
|
+
]),
|
|
504
|
+
],
|
|
505
|
+
]);
|
|
506
|
+
}
|
|
507
|
+
function getIntegrationStateCodec() {
|
|
508
|
+
return kit.combineCodec(getIntegrationStateEncoder(), getIntegrationStateDecoder());
|
|
509
|
+
}
|
|
510
|
+
function integrationState(kind, data) {
|
|
511
|
+
return Array.isArray(data)
|
|
512
|
+
? { __kind: kind, fields: data }
|
|
513
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
514
|
+
}
|
|
515
|
+
function isIntegrationState(kind, value) {
|
|
516
|
+
return value.__kind === kind;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
exports.IntegrationStatus = void 0;
|
|
520
|
+
(function (IntegrationStatus) {
|
|
521
|
+
IntegrationStatus[IntegrationStatus["Suspended"] = 0] = "Suspended";
|
|
522
|
+
IntegrationStatus[IntegrationStatus["Active"] = 1] = "Active";
|
|
523
|
+
})(exports.IntegrationStatus || (exports.IntegrationStatus = {}));
|
|
524
|
+
function getIntegrationStatusEncoder() {
|
|
525
|
+
return kit.getEnumEncoder(exports.IntegrationStatus);
|
|
526
|
+
}
|
|
527
|
+
function getIntegrationStatusDecoder() {
|
|
528
|
+
return kit.getEnumDecoder(exports.IntegrationStatus);
|
|
529
|
+
}
|
|
530
|
+
function getIntegrationStatusCodec() {
|
|
531
|
+
return kit.combineCodec(getIntegrationStatusEncoder(), getIntegrationStatusDecoder());
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
exports.IntegrationType = void 0;
|
|
535
|
+
(function (IntegrationType) {
|
|
536
|
+
IntegrationType[IntegrationType["SplTokenExternal"] = 0] = "SplTokenExternal";
|
|
537
|
+
IntegrationType[IntegrationType["SplTokenSwap"] = 1] = "SplTokenSwap";
|
|
538
|
+
IntegrationType[IntegrationType["CctpBridge"] = 2] = "CctpBridge";
|
|
539
|
+
IntegrationType[IntegrationType["LzBridge"] = 3] = "LzBridge";
|
|
540
|
+
IntegrationType[IntegrationType["AtomicSwap"] = 4] = "AtomicSwap";
|
|
541
|
+
})(exports.IntegrationType || (exports.IntegrationType = {}));
|
|
542
|
+
function getIntegrationTypeEncoder() {
|
|
543
|
+
return kit.getEnumEncoder(exports.IntegrationType);
|
|
544
|
+
}
|
|
545
|
+
function getIntegrationTypeDecoder() {
|
|
546
|
+
return kit.getEnumDecoder(exports.IntegrationType);
|
|
547
|
+
}
|
|
548
|
+
function getIntegrationTypeCodec() {
|
|
549
|
+
return kit.combineCodec(getIntegrationTypeEncoder(), getIntegrationTypeDecoder());
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function getIntegrationUpdateEventEncoder() {
|
|
553
|
+
return kit.getStructEncoder([
|
|
554
|
+
['authority', kit.getAddressEncoder()],
|
|
555
|
+
['controller', kit.getAddressEncoder()],
|
|
556
|
+
['integration', kit.getAddressEncoder()],
|
|
557
|
+
['oldState', kit.getOptionEncoder(getIntegrationEncoder())],
|
|
558
|
+
['newState', kit.getOptionEncoder(getIntegrationEncoder())],
|
|
559
|
+
]);
|
|
560
|
+
}
|
|
561
|
+
function getIntegrationUpdateEventDecoder() {
|
|
562
|
+
return kit.getStructDecoder([
|
|
563
|
+
['authority', kit.getAddressDecoder()],
|
|
564
|
+
['controller', kit.getAddressDecoder()],
|
|
565
|
+
['integration', kit.getAddressDecoder()],
|
|
566
|
+
['oldState', kit.getOptionDecoder(getIntegrationDecoder())],
|
|
567
|
+
['newState', kit.getOptionDecoder(getIntegrationDecoder())],
|
|
568
|
+
]);
|
|
569
|
+
}
|
|
570
|
+
function getIntegrationUpdateEventCodec() {
|
|
571
|
+
return kit.combineCodec(getIntegrationUpdateEventEncoder(), getIntegrationUpdateEventDecoder());
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function getLocalTokenEncoder() {
|
|
575
|
+
return kit.getStructEncoder([
|
|
576
|
+
['custody', kit.getAddressEncoder()],
|
|
577
|
+
['mint', kit.getAddressEncoder()],
|
|
578
|
+
['burnLimitPerMessage', kit.getU64Encoder()],
|
|
579
|
+
['messagesSent', kit.getU64Encoder()],
|
|
580
|
+
['messagesReceived', kit.getU64Encoder()],
|
|
581
|
+
['amountSent', kit.getU128Encoder()],
|
|
582
|
+
['amountReceived', kit.getU128Encoder()],
|
|
583
|
+
['bump', kit.getU8Encoder()],
|
|
584
|
+
['custodyBump', kit.getU8Encoder()],
|
|
585
|
+
]);
|
|
586
|
+
}
|
|
587
|
+
function getLocalTokenDecoder() {
|
|
588
|
+
return kit.getStructDecoder([
|
|
589
|
+
['custody', kit.getAddressDecoder()],
|
|
590
|
+
['mint', kit.getAddressDecoder()],
|
|
591
|
+
['burnLimitPerMessage', kit.getU64Decoder()],
|
|
592
|
+
['messagesSent', kit.getU64Decoder()],
|
|
593
|
+
['messagesReceived', kit.getU64Decoder()],
|
|
594
|
+
['amountSent', kit.getU128Decoder()],
|
|
595
|
+
['amountReceived', kit.getU128Decoder()],
|
|
596
|
+
['bump', kit.getU8Decoder()],
|
|
597
|
+
['custodyBump', kit.getU8Decoder()],
|
|
598
|
+
]);
|
|
599
|
+
}
|
|
600
|
+
function getLocalTokenCodec() {
|
|
601
|
+
return kit.combineCodec(getLocalTokenEncoder(), getLocalTokenDecoder());
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function getLzBridgeConfigEncoder() {
|
|
605
|
+
return kit.getStructEncoder([
|
|
606
|
+
['program', kit.getAddressEncoder()],
|
|
607
|
+
['mint', kit.getAddressEncoder()],
|
|
608
|
+
['oftStore', kit.getAddressEncoder()],
|
|
609
|
+
['peerConfig', kit.getAddressEncoder()],
|
|
610
|
+
['oftTokenEscrow', kit.getAddressEncoder()],
|
|
611
|
+
['destinationAddress', kit.getAddressEncoder()],
|
|
612
|
+
['destinationEid', kit.getU32Encoder()],
|
|
613
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 28)],
|
|
614
|
+
]);
|
|
615
|
+
}
|
|
616
|
+
function getLzBridgeConfigDecoder() {
|
|
617
|
+
return kit.getStructDecoder([
|
|
618
|
+
['program', kit.getAddressDecoder()],
|
|
619
|
+
['mint', kit.getAddressDecoder()],
|
|
620
|
+
['oftStore', kit.getAddressDecoder()],
|
|
621
|
+
['peerConfig', kit.getAddressDecoder()],
|
|
622
|
+
['oftTokenEscrow', kit.getAddressDecoder()],
|
|
623
|
+
['destinationAddress', kit.getAddressDecoder()],
|
|
624
|
+
['destinationEid', kit.getU32Decoder()],
|
|
625
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 28)],
|
|
626
|
+
]);
|
|
627
|
+
}
|
|
628
|
+
function getLzBridgeConfigCodec() {
|
|
629
|
+
return kit.combineCodec(getLzBridgeConfigEncoder(), getLzBridgeConfigDecoder());
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function getLzBridgeStateEncoder() {
|
|
633
|
+
return kit.getStructEncoder([
|
|
634
|
+
['pushInFlight', kit.getBooleanEncoder()],
|
|
635
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 47)],
|
|
636
|
+
]);
|
|
637
|
+
}
|
|
638
|
+
function getLzBridgeStateDecoder() {
|
|
639
|
+
return kit.getStructDecoder([
|
|
640
|
+
['pushInFlight', kit.getBooleanDecoder()],
|
|
641
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 47)],
|
|
642
|
+
]);
|
|
643
|
+
}
|
|
644
|
+
function getLzBridgeStateCodec() {
|
|
645
|
+
return kit.combineCodec(getLzBridgeStateEncoder(), getLzBridgeStateDecoder());
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function getOftSendParamsEncoder() {
|
|
649
|
+
return kit.getStructEncoder([
|
|
650
|
+
['dstEid', kit.getU32Encoder()],
|
|
651
|
+
['to', kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
652
|
+
['amountLd', kit.getU64Encoder()],
|
|
653
|
+
]);
|
|
654
|
+
}
|
|
655
|
+
function getOftSendParamsDecoder() {
|
|
656
|
+
return kit.getStructDecoder([
|
|
657
|
+
['dstEid', kit.getU32Decoder()],
|
|
658
|
+
['to', kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
659
|
+
['amountLd', kit.getU64Decoder()],
|
|
660
|
+
]);
|
|
661
|
+
}
|
|
662
|
+
function getOftSendParamsCodec() {
|
|
663
|
+
return kit.combineCodec(getOftSendParamsEncoder(), getOftSendParamsDecoder());
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function getOFTStoreEncoder() {
|
|
667
|
+
return kit.getStructEncoder([
|
|
668
|
+
['oftType', kit.getU8Encoder()],
|
|
669
|
+
['ld2sdRate', kit.getU64Encoder()],
|
|
670
|
+
['tokenMint', kit.getAddressEncoder()],
|
|
671
|
+
['tokenEscrow', kit.getAddressEncoder()],
|
|
672
|
+
['endpointProgram', kit.getAddressEncoder()],
|
|
673
|
+
['bump', kit.getU8Encoder()],
|
|
674
|
+
['tvlLd', kit.getU64Encoder()],
|
|
675
|
+
['admin', kit.getAddressEncoder()],
|
|
676
|
+
['defaultFeeBps', kit.getU16Encoder()],
|
|
677
|
+
['paused', kit.getBooleanEncoder()],
|
|
678
|
+
]);
|
|
679
|
+
}
|
|
680
|
+
function getOFTStoreDecoder() {
|
|
681
|
+
return kit.getStructDecoder([
|
|
682
|
+
['oftType', kit.getU8Decoder()],
|
|
683
|
+
['ld2sdRate', kit.getU64Decoder()],
|
|
684
|
+
['tokenMint', kit.getAddressDecoder()],
|
|
685
|
+
['tokenEscrow', kit.getAddressDecoder()],
|
|
686
|
+
['endpointProgram', kit.getAddressDecoder()],
|
|
687
|
+
['bump', kit.getU8Decoder()],
|
|
688
|
+
['tvlLd', kit.getU64Decoder()],
|
|
689
|
+
['admin', kit.getAddressDecoder()],
|
|
690
|
+
['defaultFeeBps', kit.getU16Decoder()],
|
|
691
|
+
['paused', kit.getBooleanDecoder()],
|
|
692
|
+
]);
|
|
693
|
+
}
|
|
694
|
+
function getOFTStoreCodec() {
|
|
695
|
+
return kit.combineCodec(getOFTStoreEncoder(), getOFTStoreDecoder());
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
function getOracleUpdateEventEncoder() {
|
|
699
|
+
return kit.getStructEncoder([
|
|
700
|
+
['authority', kit.getAddressEncoder()],
|
|
701
|
+
['controller', kit.getAddressEncoder()],
|
|
702
|
+
['oracle', kit.getAddressEncoder()],
|
|
703
|
+
['oldState', kit.getOptionEncoder(getOracleEncoder())],
|
|
704
|
+
['newState', kit.getOptionEncoder(getOracleEncoder())],
|
|
705
|
+
]);
|
|
706
|
+
}
|
|
707
|
+
function getOracleUpdateEventDecoder() {
|
|
708
|
+
return kit.getStructDecoder([
|
|
709
|
+
['authority', kit.getAddressDecoder()],
|
|
710
|
+
['controller', kit.getAddressDecoder()],
|
|
711
|
+
['oracle', kit.getAddressDecoder()],
|
|
712
|
+
['oldState', kit.getOptionDecoder(getOracleDecoder())],
|
|
713
|
+
['newState', kit.getOptionDecoder(getOracleDecoder())],
|
|
714
|
+
]);
|
|
715
|
+
}
|
|
716
|
+
function getOracleUpdateEventCodec() {
|
|
717
|
+
return kit.combineCodec(getOracleUpdateEventEncoder(), getOracleUpdateEventDecoder());
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function getPeerConfigEncoder() {
|
|
721
|
+
return kit.getStructEncoder([
|
|
722
|
+
['peerAddress', kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
723
|
+
]);
|
|
724
|
+
}
|
|
725
|
+
function getPeerConfigDecoder() {
|
|
726
|
+
return kit.getStructDecoder([
|
|
727
|
+
['peerAddress', kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
728
|
+
]);
|
|
729
|
+
}
|
|
730
|
+
function getPeerConfigCodec() {
|
|
731
|
+
return kit.combineCodec(getPeerConfigEncoder(), getPeerConfigDecoder());
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
exports.PermissionStatus = void 0;
|
|
735
|
+
(function (PermissionStatus) {
|
|
736
|
+
PermissionStatus[PermissionStatus["Suspended"] = 0] = "Suspended";
|
|
737
|
+
PermissionStatus[PermissionStatus["Active"] = 1] = "Active";
|
|
738
|
+
})(exports.PermissionStatus || (exports.PermissionStatus = {}));
|
|
739
|
+
function getPermissionStatusEncoder() {
|
|
740
|
+
return kit.getEnumEncoder(exports.PermissionStatus);
|
|
741
|
+
}
|
|
742
|
+
function getPermissionStatusDecoder() {
|
|
743
|
+
return kit.getEnumDecoder(exports.PermissionStatus);
|
|
744
|
+
}
|
|
745
|
+
function getPermissionStatusCodec() {
|
|
746
|
+
return kit.combineCodec(getPermissionStatusEncoder(), getPermissionStatusDecoder());
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
function getPermissionUpdateEventEncoder() {
|
|
750
|
+
return kit.getStructEncoder([
|
|
751
|
+
['authority', kit.getAddressEncoder()],
|
|
752
|
+
['controller', kit.getAddressEncoder()],
|
|
753
|
+
['permission', kit.getAddressEncoder()],
|
|
754
|
+
['oldState', kit.getOptionEncoder(getPermissionEncoder())],
|
|
755
|
+
['newState', kit.getOptionEncoder(getPermissionEncoder())],
|
|
756
|
+
]);
|
|
757
|
+
}
|
|
758
|
+
function getPermissionUpdateEventDecoder() {
|
|
759
|
+
return kit.getStructDecoder([
|
|
760
|
+
['authority', kit.getAddressDecoder()],
|
|
761
|
+
['controller', kit.getAddressDecoder()],
|
|
762
|
+
['permission', kit.getAddressDecoder()],
|
|
763
|
+
['oldState', kit.getOptionDecoder(getPermissionDecoder())],
|
|
764
|
+
['newState', kit.getOptionDecoder(getPermissionDecoder())],
|
|
765
|
+
]);
|
|
766
|
+
}
|
|
767
|
+
function getPermissionUpdateEventCodec() {
|
|
768
|
+
return kit.combineCodec(getPermissionUpdateEventEncoder(), getPermissionUpdateEventDecoder());
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function getPullArgsEncoder() {
|
|
772
|
+
return kit.getDiscriminatedUnionEncoder([
|
|
773
|
+
['SplTokenExternal', kit.getUnitEncoder()],
|
|
774
|
+
[
|
|
775
|
+
'SplTokenSwap',
|
|
776
|
+
kit.getStructEncoder([
|
|
777
|
+
['amountA', kit.getU64Encoder()],
|
|
778
|
+
['amountB', kit.getU64Encoder()],
|
|
779
|
+
['maximumPoolTokenAmountA', kit.getU64Encoder()],
|
|
780
|
+
['maximumPoolTokenAmountB', kit.getU64Encoder()],
|
|
781
|
+
]),
|
|
782
|
+
],
|
|
783
|
+
['CctpBridge', kit.getUnitEncoder()],
|
|
784
|
+
['LzBridge', kit.getUnitEncoder()],
|
|
785
|
+
]);
|
|
786
|
+
}
|
|
787
|
+
function getPullArgsDecoder() {
|
|
788
|
+
return kit.getDiscriminatedUnionDecoder([
|
|
789
|
+
['SplTokenExternal', kit.getUnitDecoder()],
|
|
790
|
+
[
|
|
791
|
+
'SplTokenSwap',
|
|
792
|
+
kit.getStructDecoder([
|
|
793
|
+
['amountA', kit.getU64Decoder()],
|
|
794
|
+
['amountB', kit.getU64Decoder()],
|
|
795
|
+
['maximumPoolTokenAmountA', kit.getU64Decoder()],
|
|
796
|
+
['maximumPoolTokenAmountB', kit.getU64Decoder()],
|
|
797
|
+
]),
|
|
798
|
+
],
|
|
799
|
+
['CctpBridge', kit.getUnitDecoder()],
|
|
800
|
+
['LzBridge', kit.getUnitDecoder()],
|
|
801
|
+
]);
|
|
802
|
+
}
|
|
803
|
+
function getPullArgsCodec() {
|
|
804
|
+
return kit.combineCodec(getPullArgsEncoder(), getPullArgsDecoder());
|
|
805
|
+
}
|
|
806
|
+
function pullArgs(kind, data) {
|
|
807
|
+
return Array.isArray(data)
|
|
808
|
+
? { __kind: kind, fields: data }
|
|
809
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
810
|
+
}
|
|
811
|
+
function isPullArgs(kind, value) {
|
|
812
|
+
return value.__kind === kind;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
function getPushArgsEncoder() {
|
|
816
|
+
return kit.getDiscriminatedUnionEncoder([
|
|
817
|
+
['SplTokenExternal', kit.getStructEncoder([['amount', kit.getU64Encoder()]])],
|
|
818
|
+
[
|
|
819
|
+
'SplTokenSwap',
|
|
820
|
+
kit.getStructEncoder([
|
|
821
|
+
['amountA', kit.getU64Encoder()],
|
|
822
|
+
['amountB', kit.getU64Encoder()],
|
|
823
|
+
['minimumPoolTokenAmountA', kit.getU64Encoder()],
|
|
824
|
+
['minimumPoolTokenAmountB', kit.getU64Encoder()],
|
|
825
|
+
]),
|
|
826
|
+
],
|
|
827
|
+
['CctpBridge', kit.getStructEncoder([['amount', kit.getU64Encoder()]])],
|
|
828
|
+
['LzBridge', kit.getStructEncoder([['amount', kit.getU64Encoder()]])],
|
|
829
|
+
]);
|
|
830
|
+
}
|
|
831
|
+
function getPushArgsDecoder() {
|
|
832
|
+
return kit.getDiscriminatedUnionDecoder([
|
|
833
|
+
['SplTokenExternal', kit.getStructDecoder([['amount', kit.getU64Decoder()]])],
|
|
834
|
+
[
|
|
835
|
+
'SplTokenSwap',
|
|
836
|
+
kit.getStructDecoder([
|
|
837
|
+
['amountA', kit.getU64Decoder()],
|
|
838
|
+
['amountB', kit.getU64Decoder()],
|
|
839
|
+
['minimumPoolTokenAmountA', kit.getU64Decoder()],
|
|
840
|
+
['minimumPoolTokenAmountB', kit.getU64Decoder()],
|
|
841
|
+
]),
|
|
842
|
+
],
|
|
843
|
+
['CctpBridge', kit.getStructDecoder([['amount', kit.getU64Decoder()]])],
|
|
844
|
+
['LzBridge', kit.getStructDecoder([['amount', kit.getU64Decoder()]])],
|
|
845
|
+
]);
|
|
846
|
+
}
|
|
847
|
+
function getPushArgsCodec() {
|
|
848
|
+
return kit.combineCodec(getPushArgsEncoder(), getPushArgsDecoder());
|
|
849
|
+
}
|
|
850
|
+
function pushArgs(kind, data) {
|
|
851
|
+
return Array.isArray(data)
|
|
852
|
+
? { __kind: kind, fields: data }
|
|
853
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
854
|
+
}
|
|
855
|
+
function isPushArgs(kind, value) {
|
|
856
|
+
return value.__kind === kind;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
function getRemoteTokenMessengerEncoder() {
|
|
860
|
+
return kit.getStructEncoder([
|
|
861
|
+
['domain', kit.getU32Encoder()],
|
|
862
|
+
['tokenMessenger', kit.getAddressEncoder()],
|
|
863
|
+
]);
|
|
864
|
+
}
|
|
865
|
+
function getRemoteTokenMessengerDecoder() {
|
|
866
|
+
return kit.getStructDecoder([
|
|
867
|
+
['domain', kit.getU32Decoder()],
|
|
868
|
+
['tokenMessenger', kit.getAddressDecoder()],
|
|
869
|
+
]);
|
|
870
|
+
}
|
|
871
|
+
function getRemoteTokenMessengerCodec() {
|
|
872
|
+
return kit.combineCodec(getRemoteTokenMessengerEncoder(), getRemoteTokenMessengerDecoder());
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
exports.ReserveStatus = void 0;
|
|
876
|
+
(function (ReserveStatus) {
|
|
877
|
+
ReserveStatus[ReserveStatus["Suspended"] = 0] = "Suspended";
|
|
878
|
+
ReserveStatus[ReserveStatus["Active"] = 1] = "Active";
|
|
879
|
+
})(exports.ReserveStatus || (exports.ReserveStatus = {}));
|
|
880
|
+
function getReserveStatusEncoder() {
|
|
881
|
+
return kit.getEnumEncoder(exports.ReserveStatus);
|
|
882
|
+
}
|
|
883
|
+
function getReserveStatusDecoder() {
|
|
884
|
+
return kit.getEnumDecoder(exports.ReserveStatus);
|
|
885
|
+
}
|
|
886
|
+
function getReserveStatusCodec() {
|
|
887
|
+
return kit.combineCodec(getReserveStatusEncoder(), getReserveStatusDecoder());
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
function getReserveUpdateEventEncoder() {
|
|
891
|
+
return kit.getStructEncoder([
|
|
892
|
+
['authority', kit.getAddressEncoder()],
|
|
893
|
+
['controller', kit.getAddressEncoder()],
|
|
894
|
+
['reserve', kit.getAddressEncoder()],
|
|
895
|
+
['oldState', kit.getOptionEncoder(getReserveEncoder())],
|
|
896
|
+
['newState', kit.getOptionEncoder(getReserveEncoder())],
|
|
897
|
+
]);
|
|
898
|
+
}
|
|
899
|
+
function getReserveUpdateEventDecoder() {
|
|
900
|
+
return kit.getStructDecoder([
|
|
901
|
+
['authority', kit.getAddressDecoder()],
|
|
902
|
+
['controller', kit.getAddressDecoder()],
|
|
903
|
+
['reserve', kit.getAddressDecoder()],
|
|
904
|
+
['oldState', kit.getOptionDecoder(getReserveDecoder())],
|
|
905
|
+
['newState', kit.getOptionDecoder(getReserveDecoder())],
|
|
906
|
+
]);
|
|
907
|
+
}
|
|
908
|
+
function getReserveUpdateEventCodec() {
|
|
909
|
+
return kit.combineCodec(getReserveUpdateEventEncoder(), getReserveUpdateEventDecoder());
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
function getSplTokenExternalConfigEncoder() {
|
|
913
|
+
return kit.getStructEncoder([
|
|
914
|
+
['program', kit.getAddressEncoder()],
|
|
915
|
+
['mint', kit.getAddressEncoder()],
|
|
916
|
+
['recipient', kit.getAddressEncoder()],
|
|
917
|
+
['tokenAccount', kit.getAddressEncoder()],
|
|
918
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 96)],
|
|
919
|
+
]);
|
|
920
|
+
}
|
|
921
|
+
function getSplTokenExternalConfigDecoder() {
|
|
922
|
+
return kit.getStructDecoder([
|
|
923
|
+
['program', kit.getAddressDecoder()],
|
|
924
|
+
['mint', kit.getAddressDecoder()],
|
|
925
|
+
['recipient', kit.getAddressDecoder()],
|
|
926
|
+
['tokenAccount', kit.getAddressDecoder()],
|
|
927
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 96)],
|
|
928
|
+
]);
|
|
929
|
+
}
|
|
930
|
+
function getSplTokenExternalConfigCodec() {
|
|
931
|
+
return kit.combineCodec(getSplTokenExternalConfigEncoder(), getSplTokenExternalConfigDecoder());
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
function getSplTokenExternalStateEncoder() {
|
|
935
|
+
return kit.getStructEncoder([['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 48)]]);
|
|
936
|
+
}
|
|
937
|
+
function getSplTokenExternalStateDecoder() {
|
|
938
|
+
return kit.getStructDecoder([['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 48)]]);
|
|
939
|
+
}
|
|
940
|
+
function getSplTokenExternalStateCodec() {
|
|
941
|
+
return kit.combineCodec(getSplTokenExternalStateEncoder(), getSplTokenExternalStateDecoder());
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function getSplTokenSwapConfigEncoder() {
|
|
945
|
+
return kit.getStructEncoder([
|
|
946
|
+
['program', kit.getAddressEncoder()],
|
|
947
|
+
['swap', kit.getAddressEncoder()],
|
|
948
|
+
['mintA', kit.getAddressEncoder()],
|
|
949
|
+
['mintB', kit.getAddressEncoder()],
|
|
950
|
+
['lpMint', kit.getAddressEncoder()],
|
|
951
|
+
['lpTokenAccount', kit.getAddressEncoder()],
|
|
952
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
953
|
+
]);
|
|
954
|
+
}
|
|
955
|
+
function getSplTokenSwapConfigDecoder() {
|
|
956
|
+
return kit.getStructDecoder([
|
|
957
|
+
['program', kit.getAddressDecoder()],
|
|
958
|
+
['swap', kit.getAddressDecoder()],
|
|
959
|
+
['mintA', kit.getAddressDecoder()],
|
|
960
|
+
['mintB', kit.getAddressDecoder()],
|
|
961
|
+
['lpMint', kit.getAddressDecoder()],
|
|
962
|
+
['lpTokenAccount', kit.getAddressDecoder()],
|
|
963
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
964
|
+
]);
|
|
965
|
+
}
|
|
966
|
+
function getSplTokenSwapConfigCodec() {
|
|
967
|
+
return kit.combineCodec(getSplTokenSwapConfigEncoder(), getSplTokenSwapConfigDecoder());
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
function getSplTokenSwapStateEncoder() {
|
|
971
|
+
return kit.getStructEncoder([
|
|
972
|
+
['lastBalanceA', kit.getU64Encoder()],
|
|
973
|
+
['lastBalanceB', kit.getU64Encoder()],
|
|
974
|
+
['lastBalanceLp', kit.getU64Encoder()],
|
|
975
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 24)],
|
|
976
|
+
]);
|
|
977
|
+
}
|
|
978
|
+
function getSplTokenSwapStateDecoder() {
|
|
979
|
+
return kit.getStructDecoder([
|
|
980
|
+
['lastBalanceA', kit.getU64Decoder()],
|
|
981
|
+
['lastBalanceB', kit.getU64Decoder()],
|
|
982
|
+
['lastBalanceLp', kit.getU64Decoder()],
|
|
983
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 24)],
|
|
984
|
+
]);
|
|
985
|
+
}
|
|
986
|
+
function getSplTokenSwapStateCodec() {
|
|
987
|
+
return kit.combineCodec(getSplTokenSwapStateEncoder(), getSplTokenSwapStateDecoder());
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
function getSvmAlmControllerEventEncoder() {
|
|
991
|
+
return kit.getDiscriminatedUnionEncoder([
|
|
992
|
+
[
|
|
993
|
+
'ControllerUpdate',
|
|
994
|
+
kit.getStructEncoder([
|
|
995
|
+
['fields', kit.getTupleEncoder([getControllerUpdateEventEncoder()])],
|
|
996
|
+
]),
|
|
997
|
+
],
|
|
998
|
+
[
|
|
999
|
+
'PermissionUpdate',
|
|
1000
|
+
kit.getStructEncoder([
|
|
1001
|
+
['fields', kit.getTupleEncoder([getPermissionUpdateEventEncoder()])],
|
|
1002
|
+
]),
|
|
1003
|
+
],
|
|
1004
|
+
[
|
|
1005
|
+
'ReserveUpdate',
|
|
1006
|
+
kit.getStructEncoder([
|
|
1007
|
+
['fields', kit.getTupleEncoder([getReserveUpdateEventEncoder()])],
|
|
1008
|
+
]),
|
|
1009
|
+
],
|
|
1010
|
+
[
|
|
1011
|
+
'IntegrationUpdate',
|
|
1012
|
+
kit.getStructEncoder([
|
|
1013
|
+
['fields', kit.getTupleEncoder([getIntegrationUpdateEventEncoder()])],
|
|
1014
|
+
]),
|
|
1015
|
+
],
|
|
1016
|
+
[
|
|
1017
|
+
'AccountingEvent',
|
|
1018
|
+
kit.getStructEncoder([
|
|
1019
|
+
['fields', kit.getTupleEncoder([getAccountingEventEncoder()])],
|
|
1020
|
+
]),
|
|
1021
|
+
],
|
|
1022
|
+
[
|
|
1023
|
+
'OracleUpdate',
|
|
1024
|
+
kit.getStructEncoder([
|
|
1025
|
+
['fields', kit.getTupleEncoder([getOracleUpdateEventEncoder()])],
|
|
1026
|
+
]),
|
|
1027
|
+
],
|
|
1028
|
+
]);
|
|
1029
|
+
}
|
|
1030
|
+
function getSvmAlmControllerEventDecoder() {
|
|
1031
|
+
return kit.getDiscriminatedUnionDecoder([
|
|
1032
|
+
[
|
|
1033
|
+
'ControllerUpdate',
|
|
1034
|
+
kit.getStructDecoder([
|
|
1035
|
+
['fields', kit.getTupleDecoder([getControllerUpdateEventDecoder()])],
|
|
1036
|
+
]),
|
|
1037
|
+
],
|
|
1038
|
+
[
|
|
1039
|
+
'PermissionUpdate',
|
|
1040
|
+
kit.getStructDecoder([
|
|
1041
|
+
['fields', kit.getTupleDecoder([getPermissionUpdateEventDecoder()])],
|
|
1042
|
+
]),
|
|
1043
|
+
],
|
|
1044
|
+
[
|
|
1045
|
+
'ReserveUpdate',
|
|
1046
|
+
kit.getStructDecoder([
|
|
1047
|
+
['fields', kit.getTupleDecoder([getReserveUpdateEventDecoder()])],
|
|
1048
|
+
]),
|
|
1049
|
+
],
|
|
1050
|
+
[
|
|
1051
|
+
'IntegrationUpdate',
|
|
1052
|
+
kit.getStructDecoder([
|
|
1053
|
+
['fields', kit.getTupleDecoder([getIntegrationUpdateEventDecoder()])],
|
|
1054
|
+
]),
|
|
1055
|
+
],
|
|
1056
|
+
[
|
|
1057
|
+
'AccountingEvent',
|
|
1058
|
+
kit.getStructDecoder([
|
|
1059
|
+
['fields', kit.getTupleDecoder([getAccountingEventDecoder()])],
|
|
1060
|
+
]),
|
|
1061
|
+
],
|
|
1062
|
+
[
|
|
1063
|
+
'OracleUpdate',
|
|
1064
|
+
kit.getStructDecoder([
|
|
1065
|
+
['fields', kit.getTupleDecoder([getOracleUpdateEventDecoder()])],
|
|
1066
|
+
]),
|
|
1067
|
+
],
|
|
1068
|
+
]);
|
|
1069
|
+
}
|
|
1070
|
+
function getSvmAlmControllerEventCodec() {
|
|
1071
|
+
return kit.combineCodec(getSvmAlmControllerEventEncoder(), getSvmAlmControllerEventDecoder());
|
|
1072
|
+
}
|
|
1073
|
+
function svmAlmControllerEvent(kind, data) {
|
|
1074
|
+
return Array.isArray(data)
|
|
1075
|
+
? { __kind: kind, fields: data }
|
|
1076
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
1077
|
+
}
|
|
1078
|
+
function isSvmAlmControllerEvent(kind, value) {
|
|
1079
|
+
return value.__kind === kind;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
function getSwapV1SubsetEncoder() {
|
|
1083
|
+
return kit.getStructEncoder([
|
|
1084
|
+
['isInitialized', kit.getBooleanEncoder()],
|
|
1085
|
+
['bumpSeed', kit.getU8Encoder()],
|
|
1086
|
+
['tokenProgramId', kit.getAddressEncoder()],
|
|
1087
|
+
['tokenA', kit.getAddressEncoder()],
|
|
1088
|
+
['tokenB', kit.getAddressEncoder()],
|
|
1089
|
+
['poolMint', kit.getAddressEncoder()],
|
|
1090
|
+
['tokenAMint', kit.getAddressEncoder()],
|
|
1091
|
+
['tokenBMint', kit.getAddressEncoder()],
|
|
1092
|
+
['poolFeeAccount', kit.getAddressEncoder()],
|
|
1093
|
+
]);
|
|
1094
|
+
}
|
|
1095
|
+
function getSwapV1SubsetDecoder() {
|
|
1096
|
+
return kit.getStructDecoder([
|
|
1097
|
+
['isInitialized', kit.getBooleanDecoder()],
|
|
1098
|
+
['bumpSeed', kit.getU8Decoder()],
|
|
1099
|
+
['tokenProgramId', kit.getAddressDecoder()],
|
|
1100
|
+
['tokenA', kit.getAddressDecoder()],
|
|
1101
|
+
['tokenB', kit.getAddressDecoder()],
|
|
1102
|
+
['poolMint', kit.getAddressDecoder()],
|
|
1103
|
+
['tokenAMint', kit.getAddressDecoder()],
|
|
1104
|
+
['tokenBMint', kit.getAddressDecoder()],
|
|
1105
|
+
['poolFeeAccount', kit.getAddressDecoder()],
|
|
1106
|
+
]);
|
|
1107
|
+
}
|
|
1108
|
+
function getSwapV1SubsetCodec() {
|
|
1109
|
+
return kit.combineCodec(getSwapV1SubsetEncoder(), getSwapV1SubsetDecoder());
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
function getWithdrawSingleTokenTypeExactAmountOutArgsEncoder() {
|
|
1113
|
+
return kit.getStructEncoder([
|
|
1114
|
+
['destinationTokenAmount', kit.getU64Encoder()],
|
|
1115
|
+
['maximumPoolTokenAmount', kit.getU64Encoder()],
|
|
1116
|
+
]);
|
|
1117
|
+
}
|
|
1118
|
+
function getWithdrawSingleTokenTypeExactAmountOutArgsDecoder() {
|
|
1119
|
+
return kit.getStructDecoder([
|
|
1120
|
+
['destinationTokenAmount', kit.getU64Decoder()],
|
|
1121
|
+
['maximumPoolTokenAmount', kit.getU64Decoder()],
|
|
1122
|
+
]);
|
|
1123
|
+
}
|
|
1124
|
+
function getWithdrawSingleTokenTypeExactAmountOutArgsCodec() {
|
|
1125
|
+
return kit.combineCodec(getWithdrawSingleTokenTypeExactAmountOutArgsEncoder(), getWithdrawSingleTokenTypeExactAmountOutArgsDecoder());
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
function getControllerEncoder() {
|
|
1129
|
+
return kit.getStructEncoder([
|
|
1130
|
+
['id', kit.getU16Encoder()],
|
|
1131
|
+
['bump', kit.getU8Encoder()],
|
|
1132
|
+
['status', getControllerStatusEncoder()],
|
|
1133
|
+
['authority', kit.getAddressEncoder()],
|
|
1134
|
+
['authorityBump', kit.getU8Encoder()],
|
|
1135
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 128)],
|
|
1136
|
+
]);
|
|
1137
|
+
}
|
|
1138
|
+
function getControllerDecoder() {
|
|
1139
|
+
return kit.getStructDecoder([
|
|
1140
|
+
['id', kit.getU16Decoder()],
|
|
1141
|
+
['bump', kit.getU8Decoder()],
|
|
1142
|
+
['status', getControllerStatusDecoder()],
|
|
1143
|
+
['authority', kit.getAddressDecoder()],
|
|
1144
|
+
['authorityBump', kit.getU8Decoder()],
|
|
1145
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 128)],
|
|
1146
|
+
]);
|
|
1147
|
+
}
|
|
1148
|
+
function getControllerCodec() {
|
|
1149
|
+
return kit.combineCodec(getControllerEncoder(), getControllerDecoder());
|
|
1150
|
+
}
|
|
1151
|
+
function decodeController(encodedAccount) {
|
|
1152
|
+
return kit.decodeAccount(encodedAccount, getControllerDecoder());
|
|
1153
|
+
}
|
|
1154
|
+
async function fetchController(rpc, address, config) {
|
|
1155
|
+
const maybeAccount = await fetchMaybeController(rpc, address, config);
|
|
1156
|
+
kit.assertAccountExists(maybeAccount);
|
|
1157
|
+
return maybeAccount;
|
|
1158
|
+
}
|
|
1159
|
+
async function fetchMaybeController(rpc, address, config) {
|
|
1160
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address, config);
|
|
1161
|
+
return decodeController(maybeAccount);
|
|
1162
|
+
}
|
|
1163
|
+
async function fetchAllController(rpc, addresses, config) {
|
|
1164
|
+
const maybeAccounts = await fetchAllMaybeController(rpc, addresses, config);
|
|
1165
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
1166
|
+
return maybeAccounts;
|
|
1167
|
+
}
|
|
1168
|
+
async function fetchAllMaybeController(rpc, addresses, config) {
|
|
1169
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
1170
|
+
return maybeAccounts.map((maybeAccount) => decodeController(maybeAccount));
|
|
1171
|
+
}
|
|
1172
|
+
function getControllerSize() {
|
|
1173
|
+
return 165;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
function getIntegrationEncoder() {
|
|
1177
|
+
return kit.getStructEncoder([
|
|
1178
|
+
['controller', kit.getAddressEncoder()],
|
|
1179
|
+
['description', kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
1180
|
+
['hash', kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
1181
|
+
['status', getIntegrationStatusEncoder()],
|
|
1182
|
+
['rateLimitSlope', kit.getU64Encoder()],
|
|
1183
|
+
['rateLimitMaxOutflow', kit.getU64Encoder()],
|
|
1184
|
+
['rateLimitOutflowAmountAvailable', kit.getU64Encoder()],
|
|
1185
|
+
['rateLimitRemainder', kit.getU64Encoder()],
|
|
1186
|
+
['lastRefreshTimestamp', kit.getI64Encoder()],
|
|
1187
|
+
['lastRefreshSlot', kit.getU64Encoder()],
|
|
1188
|
+
['config', getIntegrationConfigEncoder()],
|
|
1189
|
+
['state', getIntegrationStateEncoder()],
|
|
1190
|
+
['permitLiquidation', kit.getBooleanEncoder()],
|
|
1191
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 87)],
|
|
1192
|
+
]);
|
|
1193
|
+
}
|
|
1194
|
+
function getIntegrationDecoder() {
|
|
1195
|
+
return kit.getStructDecoder([
|
|
1196
|
+
['controller', kit.getAddressDecoder()],
|
|
1197
|
+
['description', kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
1198
|
+
['hash', kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
1199
|
+
['status', getIntegrationStatusDecoder()],
|
|
1200
|
+
['rateLimitSlope', kit.getU64Decoder()],
|
|
1201
|
+
['rateLimitMaxOutflow', kit.getU64Decoder()],
|
|
1202
|
+
['rateLimitOutflowAmountAvailable', kit.getU64Decoder()],
|
|
1203
|
+
['rateLimitRemainder', kit.getU64Decoder()],
|
|
1204
|
+
['lastRefreshTimestamp', kit.getI64Decoder()],
|
|
1205
|
+
['lastRefreshSlot', kit.getU64Decoder()],
|
|
1206
|
+
['config', getIntegrationConfigDecoder()],
|
|
1207
|
+
['state', getIntegrationStateDecoder()],
|
|
1208
|
+
['permitLiquidation', kit.getBooleanDecoder()],
|
|
1209
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 87)],
|
|
1210
|
+
]);
|
|
1211
|
+
}
|
|
1212
|
+
function getIntegrationCodec() {
|
|
1213
|
+
return kit.combineCodec(getIntegrationEncoder(), getIntegrationDecoder());
|
|
1214
|
+
}
|
|
1215
|
+
function decodeIntegration(encodedAccount) {
|
|
1216
|
+
return kit.decodeAccount(encodedAccount, getIntegrationDecoder());
|
|
1217
|
+
}
|
|
1218
|
+
async function fetchIntegration(rpc, address, config) {
|
|
1219
|
+
const maybeAccount = await fetchMaybeIntegration(rpc, address, config);
|
|
1220
|
+
kit.assertAccountExists(maybeAccount);
|
|
1221
|
+
return maybeAccount;
|
|
1222
|
+
}
|
|
1223
|
+
async function fetchMaybeIntegration(rpc, address, config) {
|
|
1224
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address, config);
|
|
1225
|
+
return decodeIntegration(maybeAccount);
|
|
1226
|
+
}
|
|
1227
|
+
async function fetchAllIntegration(rpc, addresses, config) {
|
|
1228
|
+
const maybeAccounts = await fetchAllMaybeIntegration(rpc, addresses, config);
|
|
1229
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
1230
|
+
return maybeAccounts;
|
|
1231
|
+
}
|
|
1232
|
+
async function fetchAllMaybeIntegration(rpc, addresses, config) {
|
|
1233
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
1234
|
+
return maybeAccounts.map((maybeAccount) => decodeIntegration(maybeAccount));
|
|
1235
|
+
}
|
|
1236
|
+
function getIntegrationSize() {
|
|
1237
|
+
return 507;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
function getOracleEncoder() {
|
|
1241
|
+
return kit.getStructEncoder([
|
|
1242
|
+
['version', kit.getU8Encoder()],
|
|
1243
|
+
['authority', kit.getAddressEncoder()],
|
|
1244
|
+
['nonce', kit.getAddressEncoder()],
|
|
1245
|
+
['value', kit.getI128Encoder()],
|
|
1246
|
+
['precision', kit.getU32Encoder()],
|
|
1247
|
+
['lastUpdateSlot', kit.getU64Encoder()],
|
|
1248
|
+
['controller', kit.getAddressEncoder()],
|
|
1249
|
+
['baseMint', kit.getAddressEncoder()],
|
|
1250
|
+
['quoteMint', kit.getAddressEncoder()],
|
|
1251
|
+
['reserved', kit.fixEncoderSize(kit.getBytesEncoder(), 64)],
|
|
1252
|
+
['feeds', kit.getArrayEncoder(getFeedEncoder(), { size: 1 })],
|
|
1253
|
+
]);
|
|
1254
|
+
}
|
|
1255
|
+
function getOracleDecoder() {
|
|
1256
|
+
return kit.getStructDecoder([
|
|
1257
|
+
['version', kit.getU8Decoder()],
|
|
1258
|
+
['authority', kit.getAddressDecoder()],
|
|
1259
|
+
['nonce', kit.getAddressDecoder()],
|
|
1260
|
+
['value', kit.getI128Decoder()],
|
|
1261
|
+
['precision', kit.getU32Decoder()],
|
|
1262
|
+
['lastUpdateSlot', kit.getU64Decoder()],
|
|
1263
|
+
['controller', kit.getAddressDecoder()],
|
|
1264
|
+
['baseMint', kit.getAddressDecoder()],
|
|
1265
|
+
['quoteMint', kit.getAddressDecoder()],
|
|
1266
|
+
['reserved', kit.fixDecoderSize(kit.getBytesDecoder(), 64)],
|
|
1267
|
+
['feeds', kit.getArrayDecoder(getFeedDecoder(), { size: 1 })],
|
|
1268
|
+
]);
|
|
1269
|
+
}
|
|
1270
|
+
function getOracleCodec() {
|
|
1271
|
+
return kit.combineCodec(getOracleEncoder(), getOracleDecoder());
|
|
1272
|
+
}
|
|
1273
|
+
function decodeOracle(encodedAccount) {
|
|
1274
|
+
return kit.decodeAccount(encodedAccount, getOracleDecoder());
|
|
1275
|
+
}
|
|
1276
|
+
async function fetchOracle(rpc, address, config) {
|
|
1277
|
+
const maybeAccount = await fetchMaybeOracle(rpc, address, config);
|
|
1278
|
+
kit.assertAccountExists(maybeAccount);
|
|
1279
|
+
return maybeAccount;
|
|
1280
|
+
}
|
|
1281
|
+
async function fetchMaybeOracle(rpc, address, config) {
|
|
1282
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address, config);
|
|
1283
|
+
return decodeOracle(maybeAccount);
|
|
1284
|
+
}
|
|
1285
|
+
async function fetchAllOracle(rpc, addresses, config) {
|
|
1286
|
+
const maybeAccounts = await fetchAllMaybeOracle(rpc, addresses, config);
|
|
1287
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
1288
|
+
return maybeAccounts;
|
|
1289
|
+
}
|
|
1290
|
+
async function fetchAllMaybeOracle(rpc, addresses, config) {
|
|
1291
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
1292
|
+
return maybeAccounts.map((maybeAccount) => decodeOracle(maybeAccount));
|
|
1293
|
+
}
|
|
1294
|
+
function getOracleSize() {
|
|
1295
|
+
return 349;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
function getPermissionEncoder() {
|
|
1299
|
+
return kit.getStructEncoder([
|
|
1300
|
+
['controller', kit.getAddressEncoder()],
|
|
1301
|
+
['authority', kit.getAddressEncoder()],
|
|
1302
|
+
['status', getPermissionStatusEncoder()],
|
|
1303
|
+
['canManagePermissions', kit.getBooleanEncoder()],
|
|
1304
|
+
['canInvokeExternalTransfer', kit.getBooleanEncoder()],
|
|
1305
|
+
['canExecuteSwap', kit.getBooleanEncoder()],
|
|
1306
|
+
['canReallocate', kit.getBooleanEncoder()],
|
|
1307
|
+
['canFreezeController', kit.getBooleanEncoder()],
|
|
1308
|
+
['canUnfreezeController', kit.getBooleanEncoder()],
|
|
1309
|
+
['canManageReservesAndIntegrations', kit.getBooleanEncoder()],
|
|
1310
|
+
['canSuspendPermissions', kit.getBooleanEncoder()],
|
|
1311
|
+
['canLiquidate', kit.getBooleanEncoder()],
|
|
1312
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 30)],
|
|
1313
|
+
]);
|
|
1314
|
+
}
|
|
1315
|
+
function getPermissionDecoder() {
|
|
1316
|
+
return kit.getStructDecoder([
|
|
1317
|
+
['controller', kit.getAddressDecoder()],
|
|
1318
|
+
['authority', kit.getAddressDecoder()],
|
|
1319
|
+
['status', getPermissionStatusDecoder()],
|
|
1320
|
+
['canManagePermissions', kit.getBooleanDecoder()],
|
|
1321
|
+
['canInvokeExternalTransfer', kit.getBooleanDecoder()],
|
|
1322
|
+
['canExecuteSwap', kit.getBooleanDecoder()],
|
|
1323
|
+
['canReallocate', kit.getBooleanDecoder()],
|
|
1324
|
+
['canFreezeController', kit.getBooleanDecoder()],
|
|
1325
|
+
['canUnfreezeController', kit.getBooleanDecoder()],
|
|
1326
|
+
['canManageReservesAndIntegrations', kit.getBooleanDecoder()],
|
|
1327
|
+
['canSuspendPermissions', kit.getBooleanDecoder()],
|
|
1328
|
+
['canLiquidate', kit.getBooleanDecoder()],
|
|
1329
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 30)],
|
|
1330
|
+
]);
|
|
1331
|
+
}
|
|
1332
|
+
function getPermissionCodec() {
|
|
1333
|
+
return kit.combineCodec(getPermissionEncoder(), getPermissionDecoder());
|
|
1334
|
+
}
|
|
1335
|
+
function decodePermission(encodedAccount) {
|
|
1336
|
+
return kit.decodeAccount(encodedAccount, getPermissionDecoder());
|
|
1337
|
+
}
|
|
1338
|
+
async function fetchPermission(rpc, address, config) {
|
|
1339
|
+
const maybeAccount = await fetchMaybePermission(rpc, address, config);
|
|
1340
|
+
kit.assertAccountExists(maybeAccount);
|
|
1341
|
+
return maybeAccount;
|
|
1342
|
+
}
|
|
1343
|
+
async function fetchMaybePermission(rpc, address, config) {
|
|
1344
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address, config);
|
|
1345
|
+
return decodePermission(maybeAccount);
|
|
1346
|
+
}
|
|
1347
|
+
async function fetchAllPermission(rpc, addresses, config) {
|
|
1348
|
+
const maybeAccounts = await fetchAllMaybePermission(rpc, addresses, config);
|
|
1349
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
1350
|
+
return maybeAccounts;
|
|
1351
|
+
}
|
|
1352
|
+
async function fetchAllMaybePermission(rpc, addresses, config) {
|
|
1353
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
1354
|
+
return maybeAccounts.map((maybeAccount) => decodePermission(maybeAccount));
|
|
1355
|
+
}
|
|
1356
|
+
function getPermissionSize() {
|
|
1357
|
+
return 104;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
function getReserveEncoder() {
|
|
1361
|
+
return kit.getStructEncoder([
|
|
1362
|
+
['controller', kit.getAddressEncoder()],
|
|
1363
|
+
['mint', kit.getAddressEncoder()],
|
|
1364
|
+
['vault', kit.getAddressEncoder()],
|
|
1365
|
+
['status', getReserveStatusEncoder()],
|
|
1366
|
+
['rateLimitSlope', kit.getU64Encoder()],
|
|
1367
|
+
['rateLimitMaxOutflow', kit.getU64Encoder()],
|
|
1368
|
+
['rateLimitOutflowAmountAvailable', kit.getU64Encoder()],
|
|
1369
|
+
['rateLimitRemainder', kit.getU64Encoder()],
|
|
1370
|
+
['lastBalance', kit.getU64Encoder()],
|
|
1371
|
+
['lastRefreshTimestamp', kit.getI64Encoder()],
|
|
1372
|
+
['lastRefreshSlot', kit.getU64Encoder()],
|
|
1373
|
+
['padding', kit.fixEncoderSize(kit.getBytesEncoder(), 120)],
|
|
1374
|
+
]);
|
|
1375
|
+
}
|
|
1376
|
+
function getReserveDecoder() {
|
|
1377
|
+
return kit.getStructDecoder([
|
|
1378
|
+
['controller', kit.getAddressDecoder()],
|
|
1379
|
+
['mint', kit.getAddressDecoder()],
|
|
1380
|
+
['vault', kit.getAddressDecoder()],
|
|
1381
|
+
['status', getReserveStatusDecoder()],
|
|
1382
|
+
['rateLimitSlope', kit.getU64Decoder()],
|
|
1383
|
+
['rateLimitMaxOutflow', kit.getU64Decoder()],
|
|
1384
|
+
['rateLimitOutflowAmountAvailable', kit.getU64Decoder()],
|
|
1385
|
+
['rateLimitRemainder', kit.getU64Decoder()],
|
|
1386
|
+
['lastBalance', kit.getU64Decoder()],
|
|
1387
|
+
['lastRefreshTimestamp', kit.getI64Decoder()],
|
|
1388
|
+
['lastRefreshSlot', kit.getU64Decoder()],
|
|
1389
|
+
['padding', kit.fixDecoderSize(kit.getBytesDecoder(), 120)],
|
|
1390
|
+
]);
|
|
1391
|
+
}
|
|
1392
|
+
function getReserveCodec() {
|
|
1393
|
+
return kit.combineCodec(getReserveEncoder(), getReserveDecoder());
|
|
1394
|
+
}
|
|
1395
|
+
function decodeReserve(encodedAccount) {
|
|
1396
|
+
return kit.decodeAccount(encodedAccount, getReserveDecoder());
|
|
1397
|
+
}
|
|
1398
|
+
async function fetchReserve(rpc, address, config) {
|
|
1399
|
+
const maybeAccount = await fetchMaybeReserve(rpc, address, config);
|
|
1400
|
+
kit.assertAccountExists(maybeAccount);
|
|
1401
|
+
return maybeAccount;
|
|
1402
|
+
}
|
|
1403
|
+
async function fetchMaybeReserve(rpc, address, config) {
|
|
1404
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address, config);
|
|
1405
|
+
return decodeReserve(maybeAccount);
|
|
1406
|
+
}
|
|
1407
|
+
async function fetchAllReserve(rpc, addresses, config) {
|
|
1408
|
+
const maybeAccounts = await fetchAllMaybeReserve(rpc, addresses, config);
|
|
1409
|
+
kit.assertAccountsExist(maybeAccounts);
|
|
1410
|
+
return maybeAccounts;
|
|
1411
|
+
}
|
|
1412
|
+
async function fetchAllMaybeReserve(rpc, addresses, config) {
|
|
1413
|
+
const maybeAccounts = await kit.fetchEncodedAccounts(rpc, addresses, config);
|
|
1414
|
+
return maybeAccounts.map((maybeAccount) => decodeReserve(maybeAccount));
|
|
1415
|
+
}
|
|
1416
|
+
function getReserveSize() {
|
|
1417
|
+
return 273;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
const SVM_ALM_CONTROLLER_PROGRAM_ADDRESS = 'H3BpbuheXwBnfxjb2L66mxZ9nFhRmUentYwQDspd6yJ9';
|
|
1421
|
+
exports.SvmAlmControllerAccount = void 0;
|
|
1422
|
+
(function (SvmAlmControllerAccount) {
|
|
1423
|
+
SvmAlmControllerAccount[SvmAlmControllerAccount["Controller"] = 0] = "Controller";
|
|
1424
|
+
SvmAlmControllerAccount[SvmAlmControllerAccount["Integration"] = 1] = "Integration";
|
|
1425
|
+
SvmAlmControllerAccount[SvmAlmControllerAccount["Oracle"] = 2] = "Oracle";
|
|
1426
|
+
SvmAlmControllerAccount[SvmAlmControllerAccount["Permission"] = 3] = "Permission";
|
|
1427
|
+
SvmAlmControllerAccount[SvmAlmControllerAccount["Reserve"] = 4] = "Reserve";
|
|
1428
|
+
})(exports.SvmAlmControllerAccount || (exports.SvmAlmControllerAccount = {}));
|
|
1429
|
+
exports.SvmAlmControllerInstruction = void 0;
|
|
1430
|
+
(function (SvmAlmControllerInstruction) {
|
|
1431
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["EmitEvent"] = 0] = "EmitEvent";
|
|
1432
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["InitializeController"] = 1] = "InitializeController";
|
|
1433
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["ManageController"] = 2] = "ManageController";
|
|
1434
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["ManagePermission"] = 3] = "ManagePermission";
|
|
1435
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["InitializeReserve"] = 4] = "InitializeReserve";
|
|
1436
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["ManageReserve"] = 5] = "ManageReserve";
|
|
1437
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["InitializeIntegration"] = 6] = "InitializeIntegration";
|
|
1438
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["ManageIntegration"] = 7] = "ManageIntegration";
|
|
1439
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["SyncReserve"] = 8] = "SyncReserve";
|
|
1440
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["Sync"] = 9] = "Sync";
|
|
1441
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["Push"] = 10] = "Push";
|
|
1442
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["Pull"] = 11] = "Pull";
|
|
1443
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["InitializeOracle"] = 12] = "InitializeOracle";
|
|
1444
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["UpdateOracle"] = 13] = "UpdateOracle";
|
|
1445
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["RefreshOracle"] = 14] = "RefreshOracle";
|
|
1446
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["AtomicSwapBorrow"] = 15] = "AtomicSwapBorrow";
|
|
1447
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["AtomicSwapRepay"] = 16] = "AtomicSwapRepay";
|
|
1448
|
+
SvmAlmControllerInstruction[SvmAlmControllerInstruction["ResetLzPushInFlight"] = 17] = "ResetLzPushInFlight";
|
|
1449
|
+
})(exports.SvmAlmControllerInstruction || (exports.SvmAlmControllerInstruction = {}));
|
|
1450
|
+
function identifySvmAlmControllerInstruction(instruction) {
|
|
1451
|
+
const data = 'data' in instruction ? instruction.data : instruction;
|
|
1452
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(0), 0)) {
|
|
1453
|
+
return exports.SvmAlmControllerInstruction.EmitEvent;
|
|
1454
|
+
}
|
|
1455
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(1), 0)) {
|
|
1456
|
+
return exports.SvmAlmControllerInstruction.InitializeController;
|
|
1457
|
+
}
|
|
1458
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(2), 0)) {
|
|
1459
|
+
return exports.SvmAlmControllerInstruction.ManageController;
|
|
1460
|
+
}
|
|
1461
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(3), 0)) {
|
|
1462
|
+
return exports.SvmAlmControllerInstruction.ManagePermission;
|
|
1463
|
+
}
|
|
1464
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(4), 0)) {
|
|
1465
|
+
return exports.SvmAlmControllerInstruction.InitializeReserve;
|
|
1466
|
+
}
|
|
1467
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(5), 0)) {
|
|
1468
|
+
return exports.SvmAlmControllerInstruction.ManageReserve;
|
|
1469
|
+
}
|
|
1470
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(6), 0)) {
|
|
1471
|
+
return exports.SvmAlmControllerInstruction.InitializeIntegration;
|
|
1472
|
+
}
|
|
1473
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(7), 0)) {
|
|
1474
|
+
return exports.SvmAlmControllerInstruction.ManageIntegration;
|
|
1475
|
+
}
|
|
1476
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(8), 0)) {
|
|
1477
|
+
return exports.SvmAlmControllerInstruction.SyncReserve;
|
|
1478
|
+
}
|
|
1479
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(9), 0)) {
|
|
1480
|
+
return exports.SvmAlmControllerInstruction.Sync;
|
|
1481
|
+
}
|
|
1482
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(10), 0)) {
|
|
1483
|
+
return exports.SvmAlmControllerInstruction.Push;
|
|
1484
|
+
}
|
|
1485
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(11), 0)) {
|
|
1486
|
+
return exports.SvmAlmControllerInstruction.Pull;
|
|
1487
|
+
}
|
|
1488
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(12), 0)) {
|
|
1489
|
+
return exports.SvmAlmControllerInstruction.InitializeOracle;
|
|
1490
|
+
}
|
|
1491
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(13), 0)) {
|
|
1492
|
+
return exports.SvmAlmControllerInstruction.UpdateOracle;
|
|
1493
|
+
}
|
|
1494
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(14), 0)) {
|
|
1495
|
+
return exports.SvmAlmControllerInstruction.RefreshOracle;
|
|
1496
|
+
}
|
|
1497
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(15), 0)) {
|
|
1498
|
+
return exports.SvmAlmControllerInstruction.AtomicSwapBorrow;
|
|
1499
|
+
}
|
|
1500
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(16), 0)) {
|
|
1501
|
+
return exports.SvmAlmControllerInstruction.AtomicSwapRepay;
|
|
1502
|
+
}
|
|
1503
|
+
if (kit.containsBytes(data, kit.getU8Encoder().encode(17), 0)) {
|
|
1504
|
+
return exports.SvmAlmControllerInstruction.ResetLzPushInFlight;
|
|
1505
|
+
}
|
|
1506
|
+
throw new Error('The provided instruction could not be identified as a svmAlmController instruction.');
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
function expectAddress(value) {
|
|
1510
|
+
if (!value) {
|
|
1511
|
+
throw new Error('Expected a Address.');
|
|
1512
|
+
}
|
|
1513
|
+
if (typeof value === 'object' && 'address' in value) {
|
|
1514
|
+
return value.address;
|
|
1515
|
+
}
|
|
1516
|
+
if (Array.isArray(value)) {
|
|
1517
|
+
return value[0];
|
|
1518
|
+
}
|
|
1519
|
+
return value;
|
|
1520
|
+
}
|
|
1521
|
+
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
1522
|
+
return (account) => {
|
|
1523
|
+
if (!account.value) {
|
|
1524
|
+
return Object.freeze({
|
|
1525
|
+
address: programAddress,
|
|
1526
|
+
role: kit.AccountRole.READONLY,
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
const writableRole = account.isWritable
|
|
1530
|
+
? kit.AccountRole.WRITABLE
|
|
1531
|
+
: kit.AccountRole.READONLY;
|
|
1532
|
+
return Object.freeze({
|
|
1533
|
+
address: expectAddress(account.value),
|
|
1534
|
+
role: isTransactionSigner(account.value)
|
|
1535
|
+
? kit.upgradeRoleToSigner(writableRole)
|
|
1536
|
+
: writableRole,
|
|
1537
|
+
...(isTransactionSigner(account.value) ? { signer: account.value } : {}),
|
|
1538
|
+
});
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
function isTransactionSigner(value) {
|
|
1542
|
+
return (!!value &&
|
|
1543
|
+
typeof value === 'object' &&
|
|
1544
|
+
'address' in value &&
|
|
1545
|
+
kit.isTransactionSigner(value));
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
const ATOMIC_SWAP_BORROW_DISCRIMINATOR = 15;
|
|
1549
|
+
function getAtomicSwapBorrowDiscriminatorBytes() {
|
|
1550
|
+
return kit.getU8Encoder().encode(ATOMIC_SWAP_BORROW_DISCRIMINATOR);
|
|
1551
|
+
}
|
|
1552
|
+
function getAtomicSwapBorrowInstructionDataEncoder() {
|
|
1553
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
1554
|
+
['discriminator', kit.getU8Encoder()],
|
|
1555
|
+
['amount', kit.getU64Encoder()],
|
|
1556
|
+
]), (value) => ({ ...value, discriminator: ATOMIC_SWAP_BORROW_DISCRIMINATOR }));
|
|
1557
|
+
}
|
|
1558
|
+
function getAtomicSwapBorrowInstructionDataDecoder() {
|
|
1559
|
+
return kit.getStructDecoder([
|
|
1560
|
+
['discriminator', kit.getU8Decoder()],
|
|
1561
|
+
['amount', kit.getU64Decoder()],
|
|
1562
|
+
]);
|
|
1563
|
+
}
|
|
1564
|
+
function getAtomicSwapBorrowInstructionDataCodec() {
|
|
1565
|
+
return kit.combineCodec(getAtomicSwapBorrowInstructionDataEncoder(), getAtomicSwapBorrowInstructionDataDecoder());
|
|
1566
|
+
}
|
|
1567
|
+
function getAtomicSwapBorrowInstruction(input, config) {
|
|
1568
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
1569
|
+
const originalAccounts = {
|
|
1570
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
1571
|
+
controllerAuthority: {
|
|
1572
|
+
value: input.controllerAuthority ?? null,
|
|
1573
|
+
isWritable: false,
|
|
1574
|
+
},
|
|
1575
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
1576
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
1577
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
1578
|
+
reserveA: { value: input.reserveA ?? null, isWritable: true },
|
|
1579
|
+
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
1580
|
+
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
1581
|
+
reserveB: { value: input.reserveB ?? null, isWritable: true },
|
|
1582
|
+
vaultB: { value: input.vaultB ?? null, isWritable: false },
|
|
1583
|
+
recipientTokenAccountA: {
|
|
1584
|
+
value: input.recipientTokenAccountA ?? null,
|
|
1585
|
+
isWritable: true,
|
|
1586
|
+
},
|
|
1587
|
+
recipientTokenAccountB: {
|
|
1588
|
+
value: input.recipientTokenAccountB ?? null,
|
|
1589
|
+
isWritable: true,
|
|
1590
|
+
},
|
|
1591
|
+
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
1592
|
+
sysvarInstruction: {
|
|
1593
|
+
value: input.sysvarInstruction ?? null,
|
|
1594
|
+
isWritable: false,
|
|
1595
|
+
},
|
|
1596
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
1597
|
+
};
|
|
1598
|
+
const accounts = originalAccounts;
|
|
1599
|
+
const args = { ...input };
|
|
1600
|
+
if (!accounts.sysvarInstruction.value) {
|
|
1601
|
+
accounts.sysvarInstruction.value =
|
|
1602
|
+
'Sysvar1nstructions1111111111111111111111111';
|
|
1603
|
+
}
|
|
1604
|
+
if (!accounts.programId.value) {
|
|
1605
|
+
accounts.programId.value = programAddress;
|
|
1606
|
+
accounts.programId.isWritable = false;
|
|
1607
|
+
}
|
|
1608
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1609
|
+
return Object.freeze({
|
|
1610
|
+
accounts: [
|
|
1611
|
+
getAccountMeta(accounts.controller),
|
|
1612
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
1613
|
+
getAccountMeta(accounts.authority),
|
|
1614
|
+
getAccountMeta(accounts.permission),
|
|
1615
|
+
getAccountMeta(accounts.integration),
|
|
1616
|
+
getAccountMeta(accounts.reserveA),
|
|
1617
|
+
getAccountMeta(accounts.vaultA),
|
|
1618
|
+
getAccountMeta(accounts.mintA),
|
|
1619
|
+
getAccountMeta(accounts.reserveB),
|
|
1620
|
+
getAccountMeta(accounts.vaultB),
|
|
1621
|
+
getAccountMeta(accounts.recipientTokenAccountA),
|
|
1622
|
+
getAccountMeta(accounts.recipientTokenAccountB),
|
|
1623
|
+
getAccountMeta(accounts.tokenProgramA),
|
|
1624
|
+
getAccountMeta(accounts.sysvarInstruction),
|
|
1625
|
+
getAccountMeta(accounts.programId),
|
|
1626
|
+
],
|
|
1627
|
+
data: getAtomicSwapBorrowInstructionDataEncoder().encode(args),
|
|
1628
|
+
programAddress,
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
function parseAtomicSwapBorrowInstruction(instruction) {
|
|
1632
|
+
if (instruction.accounts.length < 15) {
|
|
1633
|
+
throw new Error('Not enough accounts');
|
|
1634
|
+
}
|
|
1635
|
+
let accountIndex = 0;
|
|
1636
|
+
const getNextAccount = () => {
|
|
1637
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1638
|
+
accountIndex += 1;
|
|
1639
|
+
return accountMeta;
|
|
1640
|
+
};
|
|
1641
|
+
return {
|
|
1642
|
+
programAddress: instruction.programAddress,
|
|
1643
|
+
accounts: {
|
|
1644
|
+
controller: getNextAccount(),
|
|
1645
|
+
controllerAuthority: getNextAccount(),
|
|
1646
|
+
authority: getNextAccount(),
|
|
1647
|
+
permission: getNextAccount(),
|
|
1648
|
+
integration: getNextAccount(),
|
|
1649
|
+
reserveA: getNextAccount(),
|
|
1650
|
+
vaultA: getNextAccount(),
|
|
1651
|
+
mintA: getNextAccount(),
|
|
1652
|
+
reserveB: getNextAccount(),
|
|
1653
|
+
vaultB: getNextAccount(),
|
|
1654
|
+
recipientTokenAccountA: getNextAccount(),
|
|
1655
|
+
recipientTokenAccountB: getNextAccount(),
|
|
1656
|
+
tokenProgramA: getNextAccount(),
|
|
1657
|
+
sysvarInstruction: getNextAccount(),
|
|
1658
|
+
programId: getNextAccount(),
|
|
1659
|
+
},
|
|
1660
|
+
data: getAtomicSwapBorrowInstructionDataDecoder().decode(instruction.data),
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
const ATOMIC_SWAP_REPAY_DISCRIMINATOR = 16;
|
|
1665
|
+
function getAtomicSwapRepayDiscriminatorBytes() {
|
|
1666
|
+
return kit.getU8Encoder().encode(ATOMIC_SWAP_REPAY_DISCRIMINATOR);
|
|
1667
|
+
}
|
|
1668
|
+
function getAtomicSwapRepayInstructionDataEncoder() {
|
|
1669
|
+
return kit.transformEncoder(kit.getStructEncoder([['discriminator', kit.getU8Encoder()]]), (value) => ({ ...value, discriminator: ATOMIC_SWAP_REPAY_DISCRIMINATOR }));
|
|
1670
|
+
}
|
|
1671
|
+
function getAtomicSwapRepayInstructionDataDecoder() {
|
|
1672
|
+
return kit.getStructDecoder([['discriminator', kit.getU8Decoder()]]);
|
|
1673
|
+
}
|
|
1674
|
+
function getAtomicSwapRepayInstructionDataCodec() {
|
|
1675
|
+
return kit.combineCodec(getAtomicSwapRepayInstructionDataEncoder(), getAtomicSwapRepayInstructionDataDecoder());
|
|
1676
|
+
}
|
|
1677
|
+
function getAtomicSwapRepayInstruction(input, config) {
|
|
1678
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
1679
|
+
const originalAccounts = {
|
|
1680
|
+
payer: { value: input.payer ?? null, isWritable: false },
|
|
1681
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
1682
|
+
controllerAuthority: {
|
|
1683
|
+
value: input.controllerAuthority ?? null,
|
|
1684
|
+
isWritable: false,
|
|
1685
|
+
},
|
|
1686
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
1687
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
1688
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
1689
|
+
reserveA: { value: input.reserveA ?? null, isWritable: true },
|
|
1690
|
+
vaultA: { value: input.vaultA ?? null, isWritable: true },
|
|
1691
|
+
mintA: { value: input.mintA ?? null, isWritable: false },
|
|
1692
|
+
reserveB: { value: input.reserveB ?? null, isWritable: true },
|
|
1693
|
+
vaultB: { value: input.vaultB ?? null, isWritable: true },
|
|
1694
|
+
mintB: { value: input.mintB ?? null, isWritable: false },
|
|
1695
|
+
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
1696
|
+
payerAccountA: { value: input.payerAccountA ?? null, isWritable: true },
|
|
1697
|
+
payerAccountB: { value: input.payerAccountB ?? null, isWritable: true },
|
|
1698
|
+
tokenProgramA: { value: input.tokenProgramA ?? null, isWritable: false },
|
|
1699
|
+
tokenProgramB: { value: input.tokenProgramB ?? null, isWritable: false },
|
|
1700
|
+
};
|
|
1701
|
+
const accounts = originalAccounts;
|
|
1702
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1703
|
+
return Object.freeze({
|
|
1704
|
+
accounts: [
|
|
1705
|
+
getAccountMeta(accounts.payer),
|
|
1706
|
+
getAccountMeta(accounts.controller),
|
|
1707
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
1708
|
+
getAccountMeta(accounts.authority),
|
|
1709
|
+
getAccountMeta(accounts.permission),
|
|
1710
|
+
getAccountMeta(accounts.integration),
|
|
1711
|
+
getAccountMeta(accounts.reserveA),
|
|
1712
|
+
getAccountMeta(accounts.vaultA),
|
|
1713
|
+
getAccountMeta(accounts.mintA),
|
|
1714
|
+
getAccountMeta(accounts.reserveB),
|
|
1715
|
+
getAccountMeta(accounts.vaultB),
|
|
1716
|
+
getAccountMeta(accounts.mintB),
|
|
1717
|
+
getAccountMeta(accounts.oracle),
|
|
1718
|
+
getAccountMeta(accounts.payerAccountA),
|
|
1719
|
+
getAccountMeta(accounts.payerAccountB),
|
|
1720
|
+
getAccountMeta(accounts.tokenProgramA),
|
|
1721
|
+
getAccountMeta(accounts.tokenProgramB),
|
|
1722
|
+
],
|
|
1723
|
+
data: getAtomicSwapRepayInstructionDataEncoder().encode({}),
|
|
1724
|
+
programAddress,
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
function parseAtomicSwapRepayInstruction(instruction) {
|
|
1728
|
+
if (instruction.accounts.length < 17) {
|
|
1729
|
+
throw new Error('Not enough accounts');
|
|
1730
|
+
}
|
|
1731
|
+
let accountIndex = 0;
|
|
1732
|
+
const getNextAccount = () => {
|
|
1733
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1734
|
+
accountIndex += 1;
|
|
1735
|
+
return accountMeta;
|
|
1736
|
+
};
|
|
1737
|
+
return {
|
|
1738
|
+
programAddress: instruction.programAddress,
|
|
1739
|
+
accounts: {
|
|
1740
|
+
payer: getNextAccount(),
|
|
1741
|
+
controller: getNextAccount(),
|
|
1742
|
+
controllerAuthority: getNextAccount(),
|
|
1743
|
+
authority: getNextAccount(),
|
|
1744
|
+
permission: getNextAccount(),
|
|
1745
|
+
integration: getNextAccount(),
|
|
1746
|
+
reserveA: getNextAccount(),
|
|
1747
|
+
vaultA: getNextAccount(),
|
|
1748
|
+
mintA: getNextAccount(),
|
|
1749
|
+
reserveB: getNextAccount(),
|
|
1750
|
+
vaultB: getNextAccount(),
|
|
1751
|
+
mintB: getNextAccount(),
|
|
1752
|
+
oracle: getNextAccount(),
|
|
1753
|
+
payerAccountA: getNextAccount(),
|
|
1754
|
+
payerAccountB: getNextAccount(),
|
|
1755
|
+
tokenProgramA: getNextAccount(),
|
|
1756
|
+
tokenProgramB: getNextAccount(),
|
|
1757
|
+
},
|
|
1758
|
+
data: getAtomicSwapRepayInstructionDataDecoder().decode(instruction.data),
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
const EMIT_EVENT_DISCRIMINATOR = 0;
|
|
1763
|
+
function getEmitEventDiscriminatorBytes() {
|
|
1764
|
+
return kit.getU8Encoder().encode(EMIT_EVENT_DISCRIMINATOR);
|
|
1765
|
+
}
|
|
1766
|
+
function getEmitEventInstructionDataEncoder() {
|
|
1767
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
1768
|
+
['discriminator', kit.getU8Encoder()],
|
|
1769
|
+
['controllerId', kit.fixEncoderSize(kit.getBytesEncoder(), 2)],
|
|
1770
|
+
['data', kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())],
|
|
1771
|
+
]), (value) => ({ ...value, discriminator: EMIT_EVENT_DISCRIMINATOR }));
|
|
1772
|
+
}
|
|
1773
|
+
function getEmitEventInstructionDataDecoder() {
|
|
1774
|
+
return kit.getStructDecoder([
|
|
1775
|
+
['discriminator', kit.getU8Decoder()],
|
|
1776
|
+
['controllerId', kit.fixDecoderSize(kit.getBytesDecoder(), 2)],
|
|
1777
|
+
['data', kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())],
|
|
1778
|
+
]);
|
|
1779
|
+
}
|
|
1780
|
+
function getEmitEventInstructionDataCodec() {
|
|
1781
|
+
return kit.combineCodec(getEmitEventInstructionDataEncoder(), getEmitEventInstructionDataDecoder());
|
|
1782
|
+
}
|
|
1783
|
+
function getEmitEventInstruction(input, config) {
|
|
1784
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
1785
|
+
const originalAccounts = {
|
|
1786
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
1787
|
+
};
|
|
1788
|
+
const accounts = originalAccounts;
|
|
1789
|
+
const args = { ...input };
|
|
1790
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1791
|
+
return Object.freeze({
|
|
1792
|
+
accounts: [getAccountMeta(accounts.authority)],
|
|
1793
|
+
data: getEmitEventInstructionDataEncoder().encode(args),
|
|
1794
|
+
programAddress,
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
function parseEmitEventInstruction(instruction) {
|
|
1798
|
+
if (instruction.accounts.length < 1) {
|
|
1799
|
+
throw new Error('Not enough accounts');
|
|
1800
|
+
}
|
|
1801
|
+
let accountIndex = 0;
|
|
1802
|
+
const getNextAccount = () => {
|
|
1803
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1804
|
+
accountIndex += 1;
|
|
1805
|
+
return accountMeta;
|
|
1806
|
+
};
|
|
1807
|
+
return {
|
|
1808
|
+
programAddress: instruction.programAddress,
|
|
1809
|
+
accounts: { authority: getNextAccount() },
|
|
1810
|
+
data: getEmitEventInstructionDataDecoder().decode(instruction.data),
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
const INITIALIZE_CONTROLLER_DISCRIMINATOR = 1;
|
|
1815
|
+
function getInitializeControllerDiscriminatorBytes() {
|
|
1816
|
+
return kit.getU8Encoder().encode(INITIALIZE_CONTROLLER_DISCRIMINATOR);
|
|
1817
|
+
}
|
|
1818
|
+
function getInitializeControllerInstructionDataEncoder() {
|
|
1819
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
1820
|
+
['discriminator', kit.getU8Encoder()],
|
|
1821
|
+
['id', kit.getU16Encoder()],
|
|
1822
|
+
['status', getControllerStatusEncoder()],
|
|
1823
|
+
]), (value) => ({
|
|
1824
|
+
...value,
|
|
1825
|
+
discriminator: INITIALIZE_CONTROLLER_DISCRIMINATOR,
|
|
1826
|
+
}));
|
|
1827
|
+
}
|
|
1828
|
+
function getInitializeControllerInstructionDataDecoder() {
|
|
1829
|
+
return kit.getStructDecoder([
|
|
1830
|
+
['discriminator', kit.getU8Decoder()],
|
|
1831
|
+
['id', kit.getU16Decoder()],
|
|
1832
|
+
['status', getControllerStatusDecoder()],
|
|
1833
|
+
]);
|
|
1834
|
+
}
|
|
1835
|
+
function getInitializeControllerInstructionDataCodec() {
|
|
1836
|
+
return kit.combineCodec(getInitializeControllerInstructionDataEncoder(), getInitializeControllerInstructionDataDecoder());
|
|
1837
|
+
}
|
|
1838
|
+
function getInitializeControllerInstruction(input, config) {
|
|
1839
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
1840
|
+
const originalAccounts = {
|
|
1841
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
1842
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
1843
|
+
controller: { value: input.controller ?? null, isWritable: true },
|
|
1844
|
+
controllerAuthority: {
|
|
1845
|
+
value: input.controllerAuthority ?? null,
|
|
1846
|
+
isWritable: false,
|
|
1847
|
+
},
|
|
1848
|
+
permission: { value: input.permission ?? null, isWritable: true },
|
|
1849
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
1850
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1851
|
+
};
|
|
1852
|
+
const accounts = originalAccounts;
|
|
1853
|
+
const args = { ...input };
|
|
1854
|
+
if (!accounts.programId.value) {
|
|
1855
|
+
accounts.programId.value = programAddress;
|
|
1856
|
+
accounts.programId.isWritable = false;
|
|
1857
|
+
}
|
|
1858
|
+
if (!accounts.systemProgram.value) {
|
|
1859
|
+
accounts.systemProgram.value =
|
|
1860
|
+
'11111111111111111111111111111111';
|
|
1861
|
+
}
|
|
1862
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1863
|
+
return Object.freeze({
|
|
1864
|
+
accounts: [
|
|
1865
|
+
getAccountMeta(accounts.payer),
|
|
1866
|
+
getAccountMeta(accounts.authority),
|
|
1867
|
+
getAccountMeta(accounts.controller),
|
|
1868
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
1869
|
+
getAccountMeta(accounts.permission),
|
|
1870
|
+
getAccountMeta(accounts.programId),
|
|
1871
|
+
getAccountMeta(accounts.systemProgram),
|
|
1872
|
+
],
|
|
1873
|
+
data: getInitializeControllerInstructionDataEncoder().encode(args),
|
|
1874
|
+
programAddress,
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
function parseInitializeControllerInstruction(instruction) {
|
|
1878
|
+
if (instruction.accounts.length < 7) {
|
|
1879
|
+
throw new Error('Not enough accounts');
|
|
1880
|
+
}
|
|
1881
|
+
let accountIndex = 0;
|
|
1882
|
+
const getNextAccount = () => {
|
|
1883
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1884
|
+
accountIndex += 1;
|
|
1885
|
+
return accountMeta;
|
|
1886
|
+
};
|
|
1887
|
+
return {
|
|
1888
|
+
programAddress: instruction.programAddress,
|
|
1889
|
+
accounts: {
|
|
1890
|
+
payer: getNextAccount(),
|
|
1891
|
+
authority: getNextAccount(),
|
|
1892
|
+
controller: getNextAccount(),
|
|
1893
|
+
controllerAuthority: getNextAccount(),
|
|
1894
|
+
permission: getNextAccount(),
|
|
1895
|
+
programId: getNextAccount(),
|
|
1896
|
+
systemProgram: getNextAccount(),
|
|
1897
|
+
},
|
|
1898
|
+
data: getInitializeControllerInstructionDataDecoder().decode(instruction.data),
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
const INITIALIZE_INTEGRATION_DISCRIMINATOR = 6;
|
|
1903
|
+
function getInitializeIntegrationDiscriminatorBytes() {
|
|
1904
|
+
return kit.getU8Encoder().encode(INITIALIZE_INTEGRATION_DISCRIMINATOR);
|
|
1905
|
+
}
|
|
1906
|
+
function getInitializeIntegrationInstructionDataEncoder() {
|
|
1907
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
1908
|
+
['discriminator', kit.getU8Encoder()],
|
|
1909
|
+
['integrationType', getIntegrationTypeEncoder()],
|
|
1910
|
+
['status', getIntegrationStatusEncoder()],
|
|
1911
|
+
['description', kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
1912
|
+
['rateLimitSlope', kit.getU64Encoder()],
|
|
1913
|
+
['rateLimitMaxOutflow', kit.getU64Encoder()],
|
|
1914
|
+
['permitLiquidation', kit.getBooleanEncoder()],
|
|
1915
|
+
['innerArgs', getInitializeArgsEncoder()],
|
|
1916
|
+
]), (value) => ({
|
|
1917
|
+
...value,
|
|
1918
|
+
discriminator: INITIALIZE_INTEGRATION_DISCRIMINATOR,
|
|
1919
|
+
}));
|
|
1920
|
+
}
|
|
1921
|
+
function getInitializeIntegrationInstructionDataDecoder() {
|
|
1922
|
+
return kit.getStructDecoder([
|
|
1923
|
+
['discriminator', kit.getU8Decoder()],
|
|
1924
|
+
['integrationType', getIntegrationTypeDecoder()],
|
|
1925
|
+
['status', getIntegrationStatusDecoder()],
|
|
1926
|
+
['description', kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
1927
|
+
['rateLimitSlope', kit.getU64Decoder()],
|
|
1928
|
+
['rateLimitMaxOutflow', kit.getU64Decoder()],
|
|
1929
|
+
['permitLiquidation', kit.getBooleanDecoder()],
|
|
1930
|
+
['innerArgs', getInitializeArgsDecoder()],
|
|
1931
|
+
]);
|
|
1932
|
+
}
|
|
1933
|
+
function getInitializeIntegrationInstructionDataCodec() {
|
|
1934
|
+
return kit.combineCodec(getInitializeIntegrationInstructionDataEncoder(), getInitializeIntegrationInstructionDataDecoder());
|
|
1935
|
+
}
|
|
1936
|
+
function getInitializeIntegrationInstruction(input, config) {
|
|
1937
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
1938
|
+
const originalAccounts = {
|
|
1939
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
1940
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
1941
|
+
controllerAuthority: {
|
|
1942
|
+
value: input.controllerAuthority ?? null,
|
|
1943
|
+
isWritable: false,
|
|
1944
|
+
},
|
|
1945
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
1946
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
1947
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
1948
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
1949
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1950
|
+
};
|
|
1951
|
+
const accounts = originalAccounts;
|
|
1952
|
+
const args = { ...input };
|
|
1953
|
+
if (!accounts.programId.value) {
|
|
1954
|
+
accounts.programId.value = programAddress;
|
|
1955
|
+
accounts.programId.isWritable = false;
|
|
1956
|
+
}
|
|
1957
|
+
if (!accounts.systemProgram.value) {
|
|
1958
|
+
accounts.systemProgram.value =
|
|
1959
|
+
'11111111111111111111111111111111';
|
|
1960
|
+
}
|
|
1961
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
1962
|
+
return Object.freeze({
|
|
1963
|
+
accounts: [
|
|
1964
|
+
getAccountMeta(accounts.payer),
|
|
1965
|
+
getAccountMeta(accounts.controller),
|
|
1966
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
1967
|
+
getAccountMeta(accounts.authority),
|
|
1968
|
+
getAccountMeta(accounts.permission),
|
|
1969
|
+
getAccountMeta(accounts.integration),
|
|
1970
|
+
getAccountMeta(accounts.programId),
|
|
1971
|
+
getAccountMeta(accounts.systemProgram),
|
|
1972
|
+
],
|
|
1973
|
+
data: getInitializeIntegrationInstructionDataEncoder().encode(args),
|
|
1974
|
+
programAddress,
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
function parseInitializeIntegrationInstruction(instruction) {
|
|
1978
|
+
if (instruction.accounts.length < 8) {
|
|
1979
|
+
throw new Error('Not enough accounts');
|
|
1980
|
+
}
|
|
1981
|
+
let accountIndex = 0;
|
|
1982
|
+
const getNextAccount = () => {
|
|
1983
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1984
|
+
accountIndex += 1;
|
|
1985
|
+
return accountMeta;
|
|
1986
|
+
};
|
|
1987
|
+
return {
|
|
1988
|
+
programAddress: instruction.programAddress,
|
|
1989
|
+
accounts: {
|
|
1990
|
+
payer: getNextAccount(),
|
|
1991
|
+
controller: getNextAccount(),
|
|
1992
|
+
controllerAuthority: getNextAccount(),
|
|
1993
|
+
authority: getNextAccount(),
|
|
1994
|
+
permission: getNextAccount(),
|
|
1995
|
+
integration: getNextAccount(),
|
|
1996
|
+
programId: getNextAccount(),
|
|
1997
|
+
systemProgram: getNextAccount(),
|
|
1998
|
+
},
|
|
1999
|
+
data: getInitializeIntegrationInstructionDataDecoder().decode(instruction.data),
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
const INITIALIZE_ORACLE_DISCRIMINATOR = 12;
|
|
2004
|
+
function getInitializeOracleDiscriminatorBytes() {
|
|
2005
|
+
return kit.getU8Encoder().encode(INITIALIZE_ORACLE_DISCRIMINATOR);
|
|
2006
|
+
}
|
|
2007
|
+
function getInitializeOracleInstructionDataEncoder() {
|
|
2008
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2009
|
+
['discriminator', kit.getU8Encoder()],
|
|
2010
|
+
['oracleType', kit.getU8Encoder()],
|
|
2011
|
+
['nonce', kit.getAddressEncoder()],
|
|
2012
|
+
['baseMint', kit.getAddressEncoder()],
|
|
2013
|
+
['quoteMint', kit.getAddressEncoder()],
|
|
2014
|
+
]), (value) => ({ ...value, discriminator: INITIALIZE_ORACLE_DISCRIMINATOR }));
|
|
2015
|
+
}
|
|
2016
|
+
function getInitializeOracleInstructionDataDecoder() {
|
|
2017
|
+
return kit.getStructDecoder([
|
|
2018
|
+
['discriminator', kit.getU8Decoder()],
|
|
2019
|
+
['oracleType', kit.getU8Decoder()],
|
|
2020
|
+
['nonce', kit.getAddressDecoder()],
|
|
2021
|
+
['baseMint', kit.getAddressDecoder()],
|
|
2022
|
+
['quoteMint', kit.getAddressDecoder()],
|
|
2023
|
+
]);
|
|
2024
|
+
}
|
|
2025
|
+
function getInitializeOracleInstructionDataCodec() {
|
|
2026
|
+
return kit.combineCodec(getInitializeOracleInstructionDataEncoder(), getInitializeOracleInstructionDataDecoder());
|
|
2027
|
+
}
|
|
2028
|
+
function getInitializeOracleInstruction(input, config) {
|
|
2029
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2030
|
+
const originalAccounts = {
|
|
2031
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
2032
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2033
|
+
controllerAuthority: {
|
|
2034
|
+
value: input.controllerAuthority ?? null,
|
|
2035
|
+
isWritable: false,
|
|
2036
|
+
},
|
|
2037
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2038
|
+
priceFeed: { value: input.priceFeed ?? null, isWritable: false },
|
|
2039
|
+
oracle: { value: input.oracle ?? null, isWritable: true },
|
|
2040
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
2041
|
+
};
|
|
2042
|
+
const accounts = originalAccounts;
|
|
2043
|
+
const args = { ...input };
|
|
2044
|
+
if (!accounts.systemProgram.value) {
|
|
2045
|
+
accounts.systemProgram.value =
|
|
2046
|
+
'11111111111111111111111111111111';
|
|
2047
|
+
}
|
|
2048
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2049
|
+
return Object.freeze({
|
|
2050
|
+
accounts: [
|
|
2051
|
+
getAccountMeta(accounts.payer),
|
|
2052
|
+
getAccountMeta(accounts.controller),
|
|
2053
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2054
|
+
getAccountMeta(accounts.authority),
|
|
2055
|
+
getAccountMeta(accounts.priceFeed),
|
|
2056
|
+
getAccountMeta(accounts.oracle),
|
|
2057
|
+
getAccountMeta(accounts.systemProgram),
|
|
2058
|
+
],
|
|
2059
|
+
data: getInitializeOracleInstructionDataEncoder().encode(args),
|
|
2060
|
+
programAddress,
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
function parseInitializeOracleInstruction(instruction) {
|
|
2064
|
+
if (instruction.accounts.length < 7) {
|
|
2065
|
+
throw new Error('Not enough accounts');
|
|
2066
|
+
}
|
|
2067
|
+
let accountIndex = 0;
|
|
2068
|
+
const getNextAccount = () => {
|
|
2069
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2070
|
+
accountIndex += 1;
|
|
2071
|
+
return accountMeta;
|
|
2072
|
+
};
|
|
2073
|
+
return {
|
|
2074
|
+
programAddress: instruction.programAddress,
|
|
2075
|
+
accounts: {
|
|
2076
|
+
payer: getNextAccount(),
|
|
2077
|
+
controller: getNextAccount(),
|
|
2078
|
+
controllerAuthority: getNextAccount(),
|
|
2079
|
+
authority: getNextAccount(),
|
|
2080
|
+
priceFeed: getNextAccount(),
|
|
2081
|
+
oracle: getNextAccount(),
|
|
2082
|
+
systemProgram: getNextAccount(),
|
|
2083
|
+
},
|
|
2084
|
+
data: getInitializeOracleInstructionDataDecoder().decode(instruction.data),
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
const INITIALIZE_RESERVE_DISCRIMINATOR = 4;
|
|
2089
|
+
function getInitializeReserveDiscriminatorBytes() {
|
|
2090
|
+
return kit.getU8Encoder().encode(INITIALIZE_RESERVE_DISCRIMINATOR);
|
|
2091
|
+
}
|
|
2092
|
+
function getInitializeReserveInstructionDataEncoder() {
|
|
2093
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2094
|
+
['discriminator', kit.getU8Encoder()],
|
|
2095
|
+
['status', getReserveStatusEncoder()],
|
|
2096
|
+
['rateLimitSlope', kit.getU64Encoder()],
|
|
2097
|
+
['rateLimitMaxOutflow', kit.getU64Encoder()],
|
|
2098
|
+
]), (value) => ({ ...value, discriminator: INITIALIZE_RESERVE_DISCRIMINATOR }));
|
|
2099
|
+
}
|
|
2100
|
+
function getInitializeReserveInstructionDataDecoder() {
|
|
2101
|
+
return kit.getStructDecoder([
|
|
2102
|
+
['discriminator', kit.getU8Decoder()],
|
|
2103
|
+
['status', getReserveStatusDecoder()],
|
|
2104
|
+
['rateLimitSlope', kit.getU64Decoder()],
|
|
2105
|
+
['rateLimitMaxOutflow', kit.getU64Decoder()],
|
|
2106
|
+
]);
|
|
2107
|
+
}
|
|
2108
|
+
function getInitializeReserveInstructionDataCodec() {
|
|
2109
|
+
return kit.combineCodec(getInitializeReserveInstructionDataEncoder(), getInitializeReserveInstructionDataDecoder());
|
|
2110
|
+
}
|
|
2111
|
+
function getInitializeReserveInstruction(input, config) {
|
|
2112
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2113
|
+
const originalAccounts = {
|
|
2114
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
2115
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2116
|
+
controllerAuthority: {
|
|
2117
|
+
value: input.controllerAuthority ?? null,
|
|
2118
|
+
isWritable: false,
|
|
2119
|
+
},
|
|
2120
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2121
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
2122
|
+
reserve: { value: input.reserve ?? null, isWritable: true },
|
|
2123
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
2124
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
2125
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
2126
|
+
associatedTokenProgram: {
|
|
2127
|
+
value: input.associatedTokenProgram ?? null,
|
|
2128
|
+
isWritable: false,
|
|
2129
|
+
},
|
|
2130
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2131
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
2132
|
+
};
|
|
2133
|
+
const accounts = originalAccounts;
|
|
2134
|
+
const args = { ...input };
|
|
2135
|
+
if (!accounts.tokenProgram.value) {
|
|
2136
|
+
accounts.tokenProgram.value =
|
|
2137
|
+
'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
|
|
2138
|
+
}
|
|
2139
|
+
if (!accounts.programId.value) {
|
|
2140
|
+
accounts.programId.value = programAddress;
|
|
2141
|
+
accounts.programId.isWritable = false;
|
|
2142
|
+
}
|
|
2143
|
+
if (!accounts.systemProgram.value) {
|
|
2144
|
+
accounts.systemProgram.value =
|
|
2145
|
+
'11111111111111111111111111111111';
|
|
2146
|
+
}
|
|
2147
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2148
|
+
return Object.freeze({
|
|
2149
|
+
accounts: [
|
|
2150
|
+
getAccountMeta(accounts.payer),
|
|
2151
|
+
getAccountMeta(accounts.controller),
|
|
2152
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2153
|
+
getAccountMeta(accounts.authority),
|
|
2154
|
+
getAccountMeta(accounts.permission),
|
|
2155
|
+
getAccountMeta(accounts.reserve),
|
|
2156
|
+
getAccountMeta(accounts.mint),
|
|
2157
|
+
getAccountMeta(accounts.vault),
|
|
2158
|
+
getAccountMeta(accounts.tokenProgram),
|
|
2159
|
+
getAccountMeta(accounts.associatedTokenProgram),
|
|
2160
|
+
getAccountMeta(accounts.programId),
|
|
2161
|
+
getAccountMeta(accounts.systemProgram),
|
|
2162
|
+
],
|
|
2163
|
+
data: getInitializeReserveInstructionDataEncoder().encode(args),
|
|
2164
|
+
programAddress,
|
|
2165
|
+
});
|
|
2166
|
+
}
|
|
2167
|
+
function parseInitializeReserveInstruction(instruction) {
|
|
2168
|
+
if (instruction.accounts.length < 12) {
|
|
2169
|
+
throw new Error('Not enough accounts');
|
|
2170
|
+
}
|
|
2171
|
+
let accountIndex = 0;
|
|
2172
|
+
const getNextAccount = () => {
|
|
2173
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2174
|
+
accountIndex += 1;
|
|
2175
|
+
return accountMeta;
|
|
2176
|
+
};
|
|
2177
|
+
return {
|
|
2178
|
+
programAddress: instruction.programAddress,
|
|
2179
|
+
accounts: {
|
|
2180
|
+
payer: getNextAccount(),
|
|
2181
|
+
controller: getNextAccount(),
|
|
2182
|
+
controllerAuthority: getNextAccount(),
|
|
2183
|
+
authority: getNextAccount(),
|
|
2184
|
+
permission: getNextAccount(),
|
|
2185
|
+
reserve: getNextAccount(),
|
|
2186
|
+
mint: getNextAccount(),
|
|
2187
|
+
vault: getNextAccount(),
|
|
2188
|
+
tokenProgram: getNextAccount(),
|
|
2189
|
+
associatedTokenProgram: getNextAccount(),
|
|
2190
|
+
programId: getNextAccount(),
|
|
2191
|
+
systemProgram: getNextAccount(),
|
|
2192
|
+
},
|
|
2193
|
+
data: getInitializeReserveInstructionDataDecoder().decode(instruction.data),
|
|
2194
|
+
};
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
const MANAGE_CONTROLLER_DISCRIMINATOR = 2;
|
|
2198
|
+
function getManageControllerDiscriminatorBytes() {
|
|
2199
|
+
return kit.getU8Encoder().encode(MANAGE_CONTROLLER_DISCRIMINATOR);
|
|
2200
|
+
}
|
|
2201
|
+
function getManageControllerInstructionDataEncoder() {
|
|
2202
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2203
|
+
['discriminator', kit.getU8Encoder()],
|
|
2204
|
+
['status', getControllerStatusEncoder()],
|
|
2205
|
+
]), (value) => ({ ...value, discriminator: MANAGE_CONTROLLER_DISCRIMINATOR }));
|
|
2206
|
+
}
|
|
2207
|
+
function getManageControllerInstructionDataDecoder() {
|
|
2208
|
+
return kit.getStructDecoder([
|
|
2209
|
+
['discriminator', kit.getU8Decoder()],
|
|
2210
|
+
['status', getControllerStatusDecoder()],
|
|
2211
|
+
]);
|
|
2212
|
+
}
|
|
2213
|
+
function getManageControllerInstructionDataCodec() {
|
|
2214
|
+
return kit.combineCodec(getManageControllerInstructionDataEncoder(), getManageControllerInstructionDataDecoder());
|
|
2215
|
+
}
|
|
2216
|
+
function getManageControllerInstruction(input, config) {
|
|
2217
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2218
|
+
const originalAccounts = {
|
|
2219
|
+
controller: { value: input.controller ?? null, isWritable: true },
|
|
2220
|
+
controllerAuthority: {
|
|
2221
|
+
value: input.controllerAuthority ?? null,
|
|
2222
|
+
isWritable: false,
|
|
2223
|
+
},
|
|
2224
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2225
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
2226
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2227
|
+
};
|
|
2228
|
+
const accounts = originalAccounts;
|
|
2229
|
+
const args = { ...input };
|
|
2230
|
+
if (!accounts.programId.value) {
|
|
2231
|
+
accounts.programId.value = programAddress;
|
|
2232
|
+
accounts.programId.isWritable = false;
|
|
2233
|
+
}
|
|
2234
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2235
|
+
return Object.freeze({
|
|
2236
|
+
accounts: [
|
|
2237
|
+
getAccountMeta(accounts.controller),
|
|
2238
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2239
|
+
getAccountMeta(accounts.authority),
|
|
2240
|
+
getAccountMeta(accounts.permission),
|
|
2241
|
+
getAccountMeta(accounts.programId),
|
|
2242
|
+
],
|
|
2243
|
+
data: getManageControllerInstructionDataEncoder().encode(args),
|
|
2244
|
+
programAddress,
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
function parseManageControllerInstruction(instruction) {
|
|
2248
|
+
if (instruction.accounts.length < 5) {
|
|
2249
|
+
throw new Error('Not enough accounts');
|
|
2250
|
+
}
|
|
2251
|
+
let accountIndex = 0;
|
|
2252
|
+
const getNextAccount = () => {
|
|
2253
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2254
|
+
accountIndex += 1;
|
|
2255
|
+
return accountMeta;
|
|
2256
|
+
};
|
|
2257
|
+
return {
|
|
2258
|
+
programAddress: instruction.programAddress,
|
|
2259
|
+
accounts: {
|
|
2260
|
+
controller: getNextAccount(),
|
|
2261
|
+
controllerAuthority: getNextAccount(),
|
|
2262
|
+
authority: getNextAccount(),
|
|
2263
|
+
permission: getNextAccount(),
|
|
2264
|
+
programId: getNextAccount(),
|
|
2265
|
+
},
|
|
2266
|
+
data: getManageControllerInstructionDataDecoder().decode(instruction.data),
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
const MANAGE_INTEGRATION_DISCRIMINATOR = 7;
|
|
2271
|
+
function getManageIntegrationDiscriminatorBytes() {
|
|
2272
|
+
return kit.getU8Encoder().encode(MANAGE_INTEGRATION_DISCRIMINATOR);
|
|
2273
|
+
}
|
|
2274
|
+
function getManageIntegrationInstructionDataEncoder() {
|
|
2275
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2276
|
+
['discriminator', kit.getU8Encoder()],
|
|
2277
|
+
['status', kit.getOptionEncoder(getIntegrationStatusEncoder())],
|
|
2278
|
+
['description', kit.getOptionEncoder(kit.fixEncoderSize(kit.getBytesEncoder(), 32))],
|
|
2279
|
+
['rateLimitSlope', kit.getOptionEncoder(kit.getU64Encoder())],
|
|
2280
|
+
['rateLimitMaxOutflow', kit.getOptionEncoder(kit.getU64Encoder())],
|
|
2281
|
+
]), (value) => ({ ...value, discriminator: MANAGE_INTEGRATION_DISCRIMINATOR }));
|
|
2282
|
+
}
|
|
2283
|
+
function getManageIntegrationInstructionDataDecoder() {
|
|
2284
|
+
return kit.getStructDecoder([
|
|
2285
|
+
['discriminator', kit.getU8Decoder()],
|
|
2286
|
+
['status', kit.getOptionDecoder(getIntegrationStatusDecoder())],
|
|
2287
|
+
['description', kit.getOptionDecoder(kit.fixDecoderSize(kit.getBytesDecoder(), 32))],
|
|
2288
|
+
['rateLimitSlope', kit.getOptionDecoder(kit.getU64Decoder())],
|
|
2289
|
+
['rateLimitMaxOutflow', kit.getOptionDecoder(kit.getU64Decoder())],
|
|
2290
|
+
]);
|
|
2291
|
+
}
|
|
2292
|
+
function getManageIntegrationInstructionDataCodec() {
|
|
2293
|
+
return kit.combineCodec(getManageIntegrationInstructionDataEncoder(), getManageIntegrationInstructionDataDecoder());
|
|
2294
|
+
}
|
|
2295
|
+
function getManageIntegrationInstruction(input, config) {
|
|
2296
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2297
|
+
const originalAccounts = {
|
|
2298
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2299
|
+
controllerAuthority: {
|
|
2300
|
+
value: input.controllerAuthority ?? null,
|
|
2301
|
+
isWritable: false,
|
|
2302
|
+
},
|
|
2303
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2304
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
2305
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
2306
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2307
|
+
};
|
|
2308
|
+
const accounts = originalAccounts;
|
|
2309
|
+
const args = { ...input };
|
|
2310
|
+
if (!accounts.programId.value) {
|
|
2311
|
+
accounts.programId.value = programAddress;
|
|
2312
|
+
accounts.programId.isWritable = false;
|
|
2313
|
+
}
|
|
2314
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2315
|
+
return Object.freeze({
|
|
2316
|
+
accounts: [
|
|
2317
|
+
getAccountMeta(accounts.controller),
|
|
2318
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2319
|
+
getAccountMeta(accounts.authority),
|
|
2320
|
+
getAccountMeta(accounts.permission),
|
|
2321
|
+
getAccountMeta(accounts.integration),
|
|
2322
|
+
getAccountMeta(accounts.programId),
|
|
2323
|
+
],
|
|
2324
|
+
data: getManageIntegrationInstructionDataEncoder().encode(args),
|
|
2325
|
+
programAddress,
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
function parseManageIntegrationInstruction(instruction) {
|
|
2329
|
+
if (instruction.accounts.length < 6) {
|
|
2330
|
+
throw new Error('Not enough accounts');
|
|
2331
|
+
}
|
|
2332
|
+
let accountIndex = 0;
|
|
2333
|
+
const getNextAccount = () => {
|
|
2334
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2335
|
+
accountIndex += 1;
|
|
2336
|
+
return accountMeta;
|
|
2337
|
+
};
|
|
2338
|
+
return {
|
|
2339
|
+
programAddress: instruction.programAddress,
|
|
2340
|
+
accounts: {
|
|
2341
|
+
controller: getNextAccount(),
|
|
2342
|
+
controllerAuthority: getNextAccount(),
|
|
2343
|
+
authority: getNextAccount(),
|
|
2344
|
+
permission: getNextAccount(),
|
|
2345
|
+
integration: getNextAccount(),
|
|
2346
|
+
programId: getNextAccount(),
|
|
2347
|
+
},
|
|
2348
|
+
data: getManageIntegrationInstructionDataDecoder().decode(instruction.data),
|
|
2349
|
+
};
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
const MANAGE_PERMISSION_DISCRIMINATOR = 3;
|
|
2353
|
+
function getManagePermissionDiscriminatorBytes() {
|
|
2354
|
+
return kit.getU8Encoder().encode(MANAGE_PERMISSION_DISCRIMINATOR);
|
|
2355
|
+
}
|
|
2356
|
+
function getManagePermissionInstructionDataEncoder() {
|
|
2357
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2358
|
+
['discriminator', kit.getU8Encoder()],
|
|
2359
|
+
['status', getPermissionStatusEncoder()],
|
|
2360
|
+
['canManagePermissions', kit.getBooleanEncoder()],
|
|
2361
|
+
['canInvokeExternalTransfer', kit.getBooleanEncoder()],
|
|
2362
|
+
['canExecuteSwap', kit.getBooleanEncoder()],
|
|
2363
|
+
['canReallocate', kit.getBooleanEncoder()],
|
|
2364
|
+
['canFreezeController', kit.getBooleanEncoder()],
|
|
2365
|
+
['canUnfreezeController', kit.getBooleanEncoder()],
|
|
2366
|
+
['canManageReservesAndIntegrations', kit.getBooleanEncoder()],
|
|
2367
|
+
['canSuspendPermissions', kit.getBooleanEncoder()],
|
|
2368
|
+
['canLiquidate', kit.getBooleanEncoder()],
|
|
2369
|
+
]), (value) => ({ ...value, discriminator: MANAGE_PERMISSION_DISCRIMINATOR }));
|
|
2370
|
+
}
|
|
2371
|
+
function getManagePermissionInstructionDataDecoder() {
|
|
2372
|
+
return kit.getStructDecoder([
|
|
2373
|
+
['discriminator', kit.getU8Decoder()],
|
|
2374
|
+
['status', getPermissionStatusDecoder()],
|
|
2375
|
+
['canManagePermissions', kit.getBooleanDecoder()],
|
|
2376
|
+
['canInvokeExternalTransfer', kit.getBooleanDecoder()],
|
|
2377
|
+
['canExecuteSwap', kit.getBooleanDecoder()],
|
|
2378
|
+
['canReallocate', kit.getBooleanDecoder()],
|
|
2379
|
+
['canFreezeController', kit.getBooleanDecoder()],
|
|
2380
|
+
['canUnfreezeController', kit.getBooleanDecoder()],
|
|
2381
|
+
['canManageReservesAndIntegrations', kit.getBooleanDecoder()],
|
|
2382
|
+
['canSuspendPermissions', kit.getBooleanDecoder()],
|
|
2383
|
+
['canLiquidate', kit.getBooleanDecoder()],
|
|
2384
|
+
]);
|
|
2385
|
+
}
|
|
2386
|
+
function getManagePermissionInstructionDataCodec() {
|
|
2387
|
+
return kit.combineCodec(getManagePermissionInstructionDataEncoder(), getManagePermissionInstructionDataDecoder());
|
|
2388
|
+
}
|
|
2389
|
+
function getManagePermissionInstruction(input, config) {
|
|
2390
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2391
|
+
const originalAccounts = {
|
|
2392
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
2393
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2394
|
+
controllerAuthority: {
|
|
2395
|
+
value: input.controllerAuthority ?? null,
|
|
2396
|
+
isWritable: false,
|
|
2397
|
+
},
|
|
2398
|
+
superAuthority: { value: input.superAuthority ?? null, isWritable: false },
|
|
2399
|
+
superPermission: {
|
|
2400
|
+
value: input.superPermission ?? null,
|
|
2401
|
+
isWritable: false,
|
|
2402
|
+
},
|
|
2403
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2404
|
+
permission: { value: input.permission ?? null, isWritable: true },
|
|
2405
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2406
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
2407
|
+
};
|
|
2408
|
+
const accounts = originalAccounts;
|
|
2409
|
+
const args = { ...input };
|
|
2410
|
+
if (!accounts.programId.value) {
|
|
2411
|
+
accounts.programId.value = programAddress;
|
|
2412
|
+
accounts.programId.isWritable = false;
|
|
2413
|
+
}
|
|
2414
|
+
if (!accounts.systemProgram.value) {
|
|
2415
|
+
accounts.systemProgram.value =
|
|
2416
|
+
'11111111111111111111111111111111';
|
|
2417
|
+
}
|
|
2418
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2419
|
+
return Object.freeze({
|
|
2420
|
+
accounts: [
|
|
2421
|
+
getAccountMeta(accounts.payer),
|
|
2422
|
+
getAccountMeta(accounts.controller),
|
|
2423
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2424
|
+
getAccountMeta(accounts.superAuthority),
|
|
2425
|
+
getAccountMeta(accounts.superPermission),
|
|
2426
|
+
getAccountMeta(accounts.authority),
|
|
2427
|
+
getAccountMeta(accounts.permission),
|
|
2428
|
+
getAccountMeta(accounts.programId),
|
|
2429
|
+
getAccountMeta(accounts.systemProgram),
|
|
2430
|
+
],
|
|
2431
|
+
data: getManagePermissionInstructionDataEncoder().encode(args),
|
|
2432
|
+
programAddress,
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
function parseManagePermissionInstruction(instruction) {
|
|
2436
|
+
if (instruction.accounts.length < 9) {
|
|
2437
|
+
throw new Error('Not enough accounts');
|
|
2438
|
+
}
|
|
2439
|
+
let accountIndex = 0;
|
|
2440
|
+
const getNextAccount = () => {
|
|
2441
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2442
|
+
accountIndex += 1;
|
|
2443
|
+
return accountMeta;
|
|
2444
|
+
};
|
|
2445
|
+
return {
|
|
2446
|
+
programAddress: instruction.programAddress,
|
|
2447
|
+
accounts: {
|
|
2448
|
+
payer: getNextAccount(),
|
|
2449
|
+
controller: getNextAccount(),
|
|
2450
|
+
controllerAuthority: getNextAccount(),
|
|
2451
|
+
superAuthority: getNextAccount(),
|
|
2452
|
+
superPermission: getNextAccount(),
|
|
2453
|
+
authority: getNextAccount(),
|
|
2454
|
+
permission: getNextAccount(),
|
|
2455
|
+
programId: getNextAccount(),
|
|
2456
|
+
systemProgram: getNextAccount(),
|
|
2457
|
+
},
|
|
2458
|
+
data: getManagePermissionInstructionDataDecoder().decode(instruction.data),
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
const MANAGE_RESERVE_DISCRIMINATOR = 5;
|
|
2463
|
+
function getManageReserveDiscriminatorBytes() {
|
|
2464
|
+
return kit.getU8Encoder().encode(MANAGE_RESERVE_DISCRIMINATOR);
|
|
2465
|
+
}
|
|
2466
|
+
function getManageReserveInstructionDataEncoder() {
|
|
2467
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2468
|
+
['discriminator', kit.getU8Encoder()],
|
|
2469
|
+
['status', kit.getOptionEncoder(getReserveStatusEncoder())],
|
|
2470
|
+
['rateLimitSlope', kit.getOptionEncoder(kit.getU64Encoder())],
|
|
2471
|
+
['rateLimitMaxOutflow', kit.getOptionEncoder(kit.getU64Encoder())],
|
|
2472
|
+
]), (value) => ({ ...value, discriminator: MANAGE_RESERVE_DISCRIMINATOR }));
|
|
2473
|
+
}
|
|
2474
|
+
function getManageReserveInstructionDataDecoder() {
|
|
2475
|
+
return kit.getStructDecoder([
|
|
2476
|
+
['discriminator', kit.getU8Decoder()],
|
|
2477
|
+
['status', kit.getOptionDecoder(getReserveStatusDecoder())],
|
|
2478
|
+
['rateLimitSlope', kit.getOptionDecoder(kit.getU64Decoder())],
|
|
2479
|
+
['rateLimitMaxOutflow', kit.getOptionDecoder(kit.getU64Decoder())],
|
|
2480
|
+
]);
|
|
2481
|
+
}
|
|
2482
|
+
function getManageReserveInstructionDataCodec() {
|
|
2483
|
+
return kit.combineCodec(getManageReserveInstructionDataEncoder(), getManageReserveInstructionDataDecoder());
|
|
2484
|
+
}
|
|
2485
|
+
function getManageReserveInstruction(input, config) {
|
|
2486
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2487
|
+
const originalAccounts = {
|
|
2488
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2489
|
+
controllerAuthority: {
|
|
2490
|
+
value: input.controllerAuthority ?? null,
|
|
2491
|
+
isWritable: false,
|
|
2492
|
+
},
|
|
2493
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2494
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
2495
|
+
reserve: { value: input.reserve ?? null, isWritable: true },
|
|
2496
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2497
|
+
};
|
|
2498
|
+
const accounts = originalAccounts;
|
|
2499
|
+
const args = { ...input };
|
|
2500
|
+
if (!accounts.programId.value) {
|
|
2501
|
+
accounts.programId.value = programAddress;
|
|
2502
|
+
accounts.programId.isWritable = false;
|
|
2503
|
+
}
|
|
2504
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2505
|
+
return Object.freeze({
|
|
2506
|
+
accounts: [
|
|
2507
|
+
getAccountMeta(accounts.controller),
|
|
2508
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2509
|
+
getAccountMeta(accounts.authority),
|
|
2510
|
+
getAccountMeta(accounts.permission),
|
|
2511
|
+
getAccountMeta(accounts.reserve),
|
|
2512
|
+
getAccountMeta(accounts.programId),
|
|
2513
|
+
],
|
|
2514
|
+
data: getManageReserveInstructionDataEncoder().encode(args),
|
|
2515
|
+
programAddress,
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
function parseManageReserveInstruction(instruction) {
|
|
2519
|
+
if (instruction.accounts.length < 6) {
|
|
2520
|
+
throw new Error('Not enough accounts');
|
|
2521
|
+
}
|
|
2522
|
+
let accountIndex = 0;
|
|
2523
|
+
const getNextAccount = () => {
|
|
2524
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2525
|
+
accountIndex += 1;
|
|
2526
|
+
return accountMeta;
|
|
2527
|
+
};
|
|
2528
|
+
return {
|
|
2529
|
+
programAddress: instruction.programAddress,
|
|
2530
|
+
accounts: {
|
|
2531
|
+
controller: getNextAccount(),
|
|
2532
|
+
controllerAuthority: getNextAccount(),
|
|
2533
|
+
authority: getNextAccount(),
|
|
2534
|
+
permission: getNextAccount(),
|
|
2535
|
+
reserve: getNextAccount(),
|
|
2536
|
+
programId: getNextAccount(),
|
|
2537
|
+
},
|
|
2538
|
+
data: getManageReserveInstructionDataDecoder().decode(instruction.data),
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
const PULL_DISCRIMINATOR = 11;
|
|
2543
|
+
function getPullDiscriminatorBytes() {
|
|
2544
|
+
return kit.getU8Encoder().encode(PULL_DISCRIMINATOR);
|
|
2545
|
+
}
|
|
2546
|
+
function getPullInstructionDataEncoder() {
|
|
2547
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2548
|
+
['discriminator', kit.getU8Encoder()],
|
|
2549
|
+
['pullArgs', getPullArgsEncoder()],
|
|
2550
|
+
]), (value) => ({ ...value, discriminator: PULL_DISCRIMINATOR }));
|
|
2551
|
+
}
|
|
2552
|
+
function getPullInstructionDataDecoder() {
|
|
2553
|
+
return kit.getStructDecoder([
|
|
2554
|
+
['discriminator', kit.getU8Decoder()],
|
|
2555
|
+
['pullArgs', getPullArgsDecoder()],
|
|
2556
|
+
]);
|
|
2557
|
+
}
|
|
2558
|
+
function getPullInstructionDataCodec() {
|
|
2559
|
+
return kit.combineCodec(getPullInstructionDataEncoder(), getPullInstructionDataDecoder());
|
|
2560
|
+
}
|
|
2561
|
+
function getPullInstruction(input, config) {
|
|
2562
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2563
|
+
const originalAccounts = {
|
|
2564
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2565
|
+
controllerAuthority: {
|
|
2566
|
+
value: input.controllerAuthority ?? null,
|
|
2567
|
+
isWritable: false,
|
|
2568
|
+
},
|
|
2569
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2570
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
2571
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
2572
|
+
reserveA: { value: input.reserveA ?? null, isWritable: true },
|
|
2573
|
+
reserveB: { value: input.reserveB ?? null, isWritable: true },
|
|
2574
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2575
|
+
};
|
|
2576
|
+
const accounts = originalAccounts;
|
|
2577
|
+
const args = { ...input };
|
|
2578
|
+
if (!accounts.programId.value) {
|
|
2579
|
+
accounts.programId.value = programAddress;
|
|
2580
|
+
accounts.programId.isWritable = false;
|
|
2581
|
+
}
|
|
2582
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2583
|
+
return Object.freeze({
|
|
2584
|
+
accounts: [
|
|
2585
|
+
getAccountMeta(accounts.controller),
|
|
2586
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2587
|
+
getAccountMeta(accounts.authority),
|
|
2588
|
+
getAccountMeta(accounts.permission),
|
|
2589
|
+
getAccountMeta(accounts.integration),
|
|
2590
|
+
getAccountMeta(accounts.reserveA),
|
|
2591
|
+
getAccountMeta(accounts.reserveB),
|
|
2592
|
+
getAccountMeta(accounts.programId),
|
|
2593
|
+
],
|
|
2594
|
+
data: getPullInstructionDataEncoder().encode(args),
|
|
2595
|
+
programAddress,
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
function parsePullInstruction(instruction) {
|
|
2599
|
+
if (instruction.accounts.length < 8) {
|
|
2600
|
+
throw new Error('Not enough accounts');
|
|
2601
|
+
}
|
|
2602
|
+
let accountIndex = 0;
|
|
2603
|
+
const getNextAccount = () => {
|
|
2604
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2605
|
+
accountIndex += 1;
|
|
2606
|
+
return accountMeta;
|
|
2607
|
+
};
|
|
2608
|
+
return {
|
|
2609
|
+
programAddress: instruction.programAddress,
|
|
2610
|
+
accounts: {
|
|
2611
|
+
controller: getNextAccount(),
|
|
2612
|
+
controllerAuthority: getNextAccount(),
|
|
2613
|
+
authority: getNextAccount(),
|
|
2614
|
+
permission: getNextAccount(),
|
|
2615
|
+
integration: getNextAccount(),
|
|
2616
|
+
reserveA: getNextAccount(),
|
|
2617
|
+
reserveB: getNextAccount(),
|
|
2618
|
+
programId: getNextAccount(),
|
|
2619
|
+
},
|
|
2620
|
+
data: getPullInstructionDataDecoder().decode(instruction.data),
|
|
2621
|
+
};
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
const PUSH_DISCRIMINATOR = 10;
|
|
2625
|
+
function getPushDiscriminatorBytes() {
|
|
2626
|
+
return kit.getU8Encoder().encode(PUSH_DISCRIMINATOR);
|
|
2627
|
+
}
|
|
2628
|
+
function getPushInstructionDataEncoder() {
|
|
2629
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2630
|
+
['discriminator', kit.getU8Encoder()],
|
|
2631
|
+
['pushArgs', getPushArgsEncoder()],
|
|
2632
|
+
]), (value) => ({ ...value, discriminator: PUSH_DISCRIMINATOR }));
|
|
2633
|
+
}
|
|
2634
|
+
function getPushInstructionDataDecoder() {
|
|
2635
|
+
return kit.getStructDecoder([
|
|
2636
|
+
['discriminator', kit.getU8Decoder()],
|
|
2637
|
+
['pushArgs', getPushArgsDecoder()],
|
|
2638
|
+
]);
|
|
2639
|
+
}
|
|
2640
|
+
function getPushInstructionDataCodec() {
|
|
2641
|
+
return kit.combineCodec(getPushInstructionDataEncoder(), getPushInstructionDataDecoder());
|
|
2642
|
+
}
|
|
2643
|
+
function getPushInstruction(input, config) {
|
|
2644
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2645
|
+
const originalAccounts = {
|
|
2646
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2647
|
+
controllerAuthority: {
|
|
2648
|
+
value: input.controllerAuthority ?? null,
|
|
2649
|
+
isWritable: false,
|
|
2650
|
+
},
|
|
2651
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2652
|
+
permission: { value: input.permission ?? null, isWritable: false },
|
|
2653
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
2654
|
+
reserveA: { value: input.reserveA ?? null, isWritable: true },
|
|
2655
|
+
reserveB: { value: input.reserveB ?? null, isWritable: true },
|
|
2656
|
+
programId: { value: input.programId ?? null, isWritable: false },
|
|
2657
|
+
};
|
|
2658
|
+
const accounts = originalAccounts;
|
|
2659
|
+
const args = { ...input };
|
|
2660
|
+
if (!accounts.programId.value) {
|
|
2661
|
+
accounts.programId.value = programAddress;
|
|
2662
|
+
accounts.programId.isWritable = false;
|
|
2663
|
+
}
|
|
2664
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2665
|
+
return Object.freeze({
|
|
2666
|
+
accounts: [
|
|
2667
|
+
getAccountMeta(accounts.controller),
|
|
2668
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2669
|
+
getAccountMeta(accounts.authority),
|
|
2670
|
+
getAccountMeta(accounts.permission),
|
|
2671
|
+
getAccountMeta(accounts.integration),
|
|
2672
|
+
getAccountMeta(accounts.reserveA),
|
|
2673
|
+
getAccountMeta(accounts.reserveB),
|
|
2674
|
+
getAccountMeta(accounts.programId),
|
|
2675
|
+
],
|
|
2676
|
+
data: getPushInstructionDataEncoder().encode(args),
|
|
2677
|
+
programAddress,
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
function parsePushInstruction(instruction) {
|
|
2681
|
+
if (instruction.accounts.length < 8) {
|
|
2682
|
+
throw new Error('Not enough accounts');
|
|
2683
|
+
}
|
|
2684
|
+
let accountIndex = 0;
|
|
2685
|
+
const getNextAccount = () => {
|
|
2686
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2687
|
+
accountIndex += 1;
|
|
2688
|
+
return accountMeta;
|
|
2689
|
+
};
|
|
2690
|
+
return {
|
|
2691
|
+
programAddress: instruction.programAddress,
|
|
2692
|
+
accounts: {
|
|
2693
|
+
controller: getNextAccount(),
|
|
2694
|
+
controllerAuthority: getNextAccount(),
|
|
2695
|
+
authority: getNextAccount(),
|
|
2696
|
+
permission: getNextAccount(),
|
|
2697
|
+
integration: getNextAccount(),
|
|
2698
|
+
reserveA: getNextAccount(),
|
|
2699
|
+
reserveB: getNextAccount(),
|
|
2700
|
+
programId: getNextAccount(),
|
|
2701
|
+
},
|
|
2702
|
+
data: getPushInstructionDataDecoder().decode(instruction.data),
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
const REFRESH_ORACLE_DISCRIMINATOR = 14;
|
|
2707
|
+
function getRefreshOracleDiscriminatorBytes() {
|
|
2708
|
+
return kit.getU8Encoder().encode(REFRESH_ORACLE_DISCRIMINATOR);
|
|
2709
|
+
}
|
|
2710
|
+
function getRefreshOracleInstructionDataEncoder() {
|
|
2711
|
+
return kit.transformEncoder(kit.getStructEncoder([['discriminator', kit.getU8Encoder()]]), (value) => ({ ...value, discriminator: REFRESH_ORACLE_DISCRIMINATOR }));
|
|
2712
|
+
}
|
|
2713
|
+
function getRefreshOracleInstructionDataDecoder() {
|
|
2714
|
+
return kit.getStructDecoder([['discriminator', kit.getU8Decoder()]]);
|
|
2715
|
+
}
|
|
2716
|
+
function getRefreshOracleInstructionDataCodec() {
|
|
2717
|
+
return kit.combineCodec(getRefreshOracleInstructionDataEncoder(), getRefreshOracleInstructionDataDecoder());
|
|
2718
|
+
}
|
|
2719
|
+
function getRefreshOracleInstruction(input, config) {
|
|
2720
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2721
|
+
const originalAccounts = {
|
|
2722
|
+
priceFeed: { value: input.priceFeed ?? null, isWritable: false },
|
|
2723
|
+
oracle: { value: input.oracle ?? null, isWritable: true },
|
|
2724
|
+
};
|
|
2725
|
+
const accounts = originalAccounts;
|
|
2726
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2727
|
+
return Object.freeze({
|
|
2728
|
+
accounts: [
|
|
2729
|
+
getAccountMeta(accounts.priceFeed),
|
|
2730
|
+
getAccountMeta(accounts.oracle),
|
|
2731
|
+
],
|
|
2732
|
+
data: getRefreshOracleInstructionDataEncoder().encode({}),
|
|
2733
|
+
programAddress,
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
function parseRefreshOracleInstruction(instruction) {
|
|
2737
|
+
if (instruction.accounts.length < 2) {
|
|
2738
|
+
throw new Error('Not enough accounts');
|
|
2739
|
+
}
|
|
2740
|
+
let accountIndex = 0;
|
|
2741
|
+
const getNextAccount = () => {
|
|
2742
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2743
|
+
accountIndex += 1;
|
|
2744
|
+
return accountMeta;
|
|
2745
|
+
};
|
|
2746
|
+
return {
|
|
2747
|
+
programAddress: instruction.programAddress,
|
|
2748
|
+
accounts: { priceFeed: getNextAccount(), oracle: getNextAccount() },
|
|
2749
|
+
data: getRefreshOracleInstructionDataDecoder().decode(instruction.data),
|
|
2750
|
+
};
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
const RESET_LZ_PUSH_IN_FLIGHT_DISCRIMINATOR = 17;
|
|
2754
|
+
function getResetLzPushInFlightDiscriminatorBytes() {
|
|
2755
|
+
return kit.getU8Encoder().encode(RESET_LZ_PUSH_IN_FLIGHT_DISCRIMINATOR);
|
|
2756
|
+
}
|
|
2757
|
+
function getResetLzPushInFlightInstructionDataEncoder() {
|
|
2758
|
+
return kit.transformEncoder(kit.getStructEncoder([['discriminator', kit.getU8Encoder()]]), (value) => ({
|
|
2759
|
+
...value,
|
|
2760
|
+
discriminator: RESET_LZ_PUSH_IN_FLIGHT_DISCRIMINATOR,
|
|
2761
|
+
}));
|
|
2762
|
+
}
|
|
2763
|
+
function getResetLzPushInFlightInstructionDataDecoder() {
|
|
2764
|
+
return kit.getStructDecoder([['discriminator', kit.getU8Decoder()]]);
|
|
2765
|
+
}
|
|
2766
|
+
function getResetLzPushInFlightInstructionDataCodec() {
|
|
2767
|
+
return kit.combineCodec(getResetLzPushInFlightInstructionDataEncoder(), getResetLzPushInFlightInstructionDataDecoder());
|
|
2768
|
+
}
|
|
2769
|
+
function getResetLzPushInFlightInstruction(input, config) {
|
|
2770
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2771
|
+
const originalAccounts = {
|
|
2772
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2773
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
2774
|
+
sysvarInstruction: {
|
|
2775
|
+
value: input.sysvarInstruction ?? null,
|
|
2776
|
+
isWritable: false,
|
|
2777
|
+
},
|
|
2778
|
+
};
|
|
2779
|
+
const accounts = originalAccounts;
|
|
2780
|
+
if (!accounts.sysvarInstruction.value) {
|
|
2781
|
+
accounts.sysvarInstruction.value =
|
|
2782
|
+
'Sysvar1nstructions1111111111111111111111111';
|
|
2783
|
+
}
|
|
2784
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2785
|
+
return Object.freeze({
|
|
2786
|
+
accounts: [
|
|
2787
|
+
getAccountMeta(accounts.controller),
|
|
2788
|
+
getAccountMeta(accounts.integration),
|
|
2789
|
+
getAccountMeta(accounts.sysvarInstruction),
|
|
2790
|
+
],
|
|
2791
|
+
data: getResetLzPushInFlightInstructionDataEncoder().encode({}),
|
|
2792
|
+
programAddress,
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
function parseResetLzPushInFlightInstruction(instruction) {
|
|
2796
|
+
if (instruction.accounts.length < 3) {
|
|
2797
|
+
throw new Error('Not enough accounts');
|
|
2798
|
+
}
|
|
2799
|
+
let accountIndex = 0;
|
|
2800
|
+
const getNextAccount = () => {
|
|
2801
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2802
|
+
accountIndex += 1;
|
|
2803
|
+
return accountMeta;
|
|
2804
|
+
};
|
|
2805
|
+
return {
|
|
2806
|
+
programAddress: instruction.programAddress,
|
|
2807
|
+
accounts: {
|
|
2808
|
+
controller: getNextAccount(),
|
|
2809
|
+
integration: getNextAccount(),
|
|
2810
|
+
sysvarInstruction: getNextAccount(),
|
|
2811
|
+
},
|
|
2812
|
+
data: getResetLzPushInFlightInstructionDataDecoder().decode(instruction.data),
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
const SYNC_DISCRIMINATOR = 9;
|
|
2817
|
+
function getSyncDiscriminatorBytes() {
|
|
2818
|
+
return kit.getU8Encoder().encode(SYNC_DISCRIMINATOR);
|
|
2819
|
+
}
|
|
2820
|
+
function getSyncInstructionDataEncoder() {
|
|
2821
|
+
return kit.transformEncoder(kit.getStructEncoder([['discriminator', kit.getU8Encoder()]]), (value) => ({ ...value, discriminator: SYNC_DISCRIMINATOR }));
|
|
2822
|
+
}
|
|
2823
|
+
function getSyncInstructionDataDecoder() {
|
|
2824
|
+
return kit.getStructDecoder([['discriminator', kit.getU8Decoder()]]);
|
|
2825
|
+
}
|
|
2826
|
+
function getSyncInstructionDataCodec() {
|
|
2827
|
+
return kit.combineCodec(getSyncInstructionDataEncoder(), getSyncInstructionDataDecoder());
|
|
2828
|
+
}
|
|
2829
|
+
function getSyncInstruction(input, config) {
|
|
2830
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2831
|
+
const originalAccounts = {
|
|
2832
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2833
|
+
controllerAuthority: {
|
|
2834
|
+
value: input.controllerAuthority ?? null,
|
|
2835
|
+
isWritable: false,
|
|
2836
|
+
},
|
|
2837
|
+
integration: { value: input.integration ?? null, isWritable: true },
|
|
2838
|
+
};
|
|
2839
|
+
const accounts = originalAccounts;
|
|
2840
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2841
|
+
return Object.freeze({
|
|
2842
|
+
accounts: [
|
|
2843
|
+
getAccountMeta(accounts.controller),
|
|
2844
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2845
|
+
getAccountMeta(accounts.integration),
|
|
2846
|
+
],
|
|
2847
|
+
data: getSyncInstructionDataEncoder().encode({}),
|
|
2848
|
+
programAddress,
|
|
2849
|
+
});
|
|
2850
|
+
}
|
|
2851
|
+
function parseSyncInstruction(instruction) {
|
|
2852
|
+
if (instruction.accounts.length < 3) {
|
|
2853
|
+
throw new Error('Not enough accounts');
|
|
2854
|
+
}
|
|
2855
|
+
let accountIndex = 0;
|
|
2856
|
+
const getNextAccount = () => {
|
|
2857
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2858
|
+
accountIndex += 1;
|
|
2859
|
+
return accountMeta;
|
|
2860
|
+
};
|
|
2861
|
+
return {
|
|
2862
|
+
programAddress: instruction.programAddress,
|
|
2863
|
+
accounts: {
|
|
2864
|
+
controller: getNextAccount(),
|
|
2865
|
+
controllerAuthority: getNextAccount(),
|
|
2866
|
+
integration: getNextAccount(),
|
|
2867
|
+
},
|
|
2868
|
+
data: getSyncInstructionDataDecoder().decode(instruction.data),
|
|
2869
|
+
};
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
const SYNC_RESERVE_DISCRIMINATOR = 8;
|
|
2873
|
+
function getSyncReserveDiscriminatorBytes() {
|
|
2874
|
+
return kit.getU8Encoder().encode(SYNC_RESERVE_DISCRIMINATOR);
|
|
2875
|
+
}
|
|
2876
|
+
function getSyncReserveInstructionDataEncoder() {
|
|
2877
|
+
return kit.transformEncoder(kit.getStructEncoder([['discriminator', kit.getU8Encoder()]]), (value) => ({ ...value, discriminator: SYNC_RESERVE_DISCRIMINATOR }));
|
|
2878
|
+
}
|
|
2879
|
+
function getSyncReserveInstructionDataDecoder() {
|
|
2880
|
+
return kit.getStructDecoder([['discriminator', kit.getU8Decoder()]]);
|
|
2881
|
+
}
|
|
2882
|
+
function getSyncReserveInstructionDataCodec() {
|
|
2883
|
+
return kit.combineCodec(getSyncReserveInstructionDataEncoder(), getSyncReserveInstructionDataDecoder());
|
|
2884
|
+
}
|
|
2885
|
+
function getSyncReserveInstruction(input, config) {
|
|
2886
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2887
|
+
const originalAccounts = {
|
|
2888
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2889
|
+
controllerAuthority: {
|
|
2890
|
+
value: input.controllerAuthority ?? null,
|
|
2891
|
+
isWritable: false,
|
|
2892
|
+
},
|
|
2893
|
+
reserve: { value: input.reserve ?? null, isWritable: true },
|
|
2894
|
+
vault: { value: input.vault ?? null, isWritable: false },
|
|
2895
|
+
};
|
|
2896
|
+
const accounts = originalAccounts;
|
|
2897
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2898
|
+
return Object.freeze({
|
|
2899
|
+
accounts: [
|
|
2900
|
+
getAccountMeta(accounts.controller),
|
|
2901
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2902
|
+
getAccountMeta(accounts.reserve),
|
|
2903
|
+
getAccountMeta(accounts.vault),
|
|
2904
|
+
],
|
|
2905
|
+
data: getSyncReserveInstructionDataEncoder().encode({}),
|
|
2906
|
+
programAddress,
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
function parseSyncReserveInstruction(instruction) {
|
|
2910
|
+
if (instruction.accounts.length < 4) {
|
|
2911
|
+
throw new Error('Not enough accounts');
|
|
2912
|
+
}
|
|
2913
|
+
let accountIndex = 0;
|
|
2914
|
+
const getNextAccount = () => {
|
|
2915
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2916
|
+
accountIndex += 1;
|
|
2917
|
+
return accountMeta;
|
|
2918
|
+
};
|
|
2919
|
+
return {
|
|
2920
|
+
programAddress: instruction.programAddress,
|
|
2921
|
+
accounts: {
|
|
2922
|
+
controller: getNextAccount(),
|
|
2923
|
+
controllerAuthority: getNextAccount(),
|
|
2924
|
+
reserve: getNextAccount(),
|
|
2925
|
+
vault: getNextAccount(),
|
|
2926
|
+
},
|
|
2927
|
+
data: getSyncReserveInstructionDataDecoder().decode(instruction.data),
|
|
2928
|
+
};
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
const UPDATE_ORACLE_DISCRIMINATOR = 13;
|
|
2932
|
+
function getUpdateOracleDiscriminatorBytes() {
|
|
2933
|
+
return kit.getU8Encoder().encode(UPDATE_ORACLE_DISCRIMINATOR);
|
|
2934
|
+
}
|
|
2935
|
+
function getUpdateOracleInstructionDataEncoder() {
|
|
2936
|
+
return kit.transformEncoder(kit.getStructEncoder([
|
|
2937
|
+
['discriminator', kit.getU8Encoder()],
|
|
2938
|
+
['feedArgs', kit.getOptionEncoder(getFeedArgsEncoder())],
|
|
2939
|
+
]), (value) => ({ ...value, discriminator: UPDATE_ORACLE_DISCRIMINATOR }));
|
|
2940
|
+
}
|
|
2941
|
+
function getUpdateOracleInstructionDataDecoder() {
|
|
2942
|
+
return kit.getStructDecoder([
|
|
2943
|
+
['discriminator', kit.getU8Decoder()],
|
|
2944
|
+
['feedArgs', kit.getOptionDecoder(getFeedArgsDecoder())],
|
|
2945
|
+
]);
|
|
2946
|
+
}
|
|
2947
|
+
function getUpdateOracleInstructionDataCodec() {
|
|
2948
|
+
return kit.combineCodec(getUpdateOracleInstructionDataEncoder(), getUpdateOracleInstructionDataDecoder());
|
|
2949
|
+
}
|
|
2950
|
+
function getUpdateOracleInstruction(input, config) {
|
|
2951
|
+
const programAddress = config?.programAddress ?? SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
2952
|
+
const originalAccounts = {
|
|
2953
|
+
controller: { value: input.controller ?? null, isWritable: false },
|
|
2954
|
+
controllerAuthority: {
|
|
2955
|
+
value: input.controllerAuthority ?? null,
|
|
2956
|
+
isWritable: false,
|
|
2957
|
+
},
|
|
2958
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
2959
|
+
priceFeed: { value: input.priceFeed ?? null, isWritable: false },
|
|
2960
|
+
oracle: { value: input.oracle ?? null, isWritable: true },
|
|
2961
|
+
newAuthority: { value: input.newAuthority ?? null, isWritable: false },
|
|
2962
|
+
};
|
|
2963
|
+
const accounts = originalAccounts;
|
|
2964
|
+
const args = { ...input };
|
|
2965
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
2966
|
+
return Object.freeze({
|
|
2967
|
+
accounts: [
|
|
2968
|
+
getAccountMeta(accounts.controller),
|
|
2969
|
+
getAccountMeta(accounts.controllerAuthority),
|
|
2970
|
+
getAccountMeta(accounts.authority),
|
|
2971
|
+
getAccountMeta(accounts.priceFeed),
|
|
2972
|
+
getAccountMeta(accounts.oracle),
|
|
2973
|
+
getAccountMeta(accounts.newAuthority),
|
|
2974
|
+
],
|
|
2975
|
+
data: getUpdateOracleInstructionDataEncoder().encode(args),
|
|
2976
|
+
programAddress,
|
|
2977
|
+
});
|
|
2978
|
+
}
|
|
2979
|
+
function parseUpdateOracleInstruction(instruction) {
|
|
2980
|
+
if (instruction.accounts.length < 6) {
|
|
2981
|
+
throw new Error('Not enough accounts');
|
|
2982
|
+
}
|
|
2983
|
+
let accountIndex = 0;
|
|
2984
|
+
const getNextAccount = () => {
|
|
2985
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2986
|
+
accountIndex += 1;
|
|
2987
|
+
return accountMeta;
|
|
2988
|
+
};
|
|
2989
|
+
const getNextOptionalAccount = () => {
|
|
2990
|
+
const accountMeta = getNextAccount();
|
|
2991
|
+
return accountMeta.address === SVM_ALM_CONTROLLER_PROGRAM_ADDRESS
|
|
2992
|
+
? undefined
|
|
2993
|
+
: accountMeta;
|
|
2994
|
+
};
|
|
2995
|
+
return {
|
|
2996
|
+
programAddress: instruction.programAddress,
|
|
2997
|
+
accounts: {
|
|
2998
|
+
controller: getNextAccount(),
|
|
2999
|
+
controllerAuthority: getNextAccount(),
|
|
3000
|
+
authority: getNextAccount(),
|
|
3001
|
+
priceFeed: getNextAccount(),
|
|
3002
|
+
oracle: getNextAccount(),
|
|
3003
|
+
newAuthority: getNextOptionalAccount(),
|
|
3004
|
+
},
|
|
3005
|
+
data: getUpdateOracleInstructionDataDecoder().decode(instruction.data),
|
|
3006
|
+
};
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
const deriveIntegrationPda = async (controller, integrationHash) => {
|
|
3010
|
+
const addressEncoder = addresses.getAddressEncoder();
|
|
3011
|
+
const [integrationPda] = await addresses.getProgramDerivedAddress({
|
|
3012
|
+
programAddress: addresses.address(SVM_ALM_CONTROLLER_PROGRAM_ADDRESS),
|
|
3013
|
+
seeds: ["integration", addressEncoder.encode(controller), integrationHash],
|
|
3014
|
+
});
|
|
3015
|
+
return integrationPda;
|
|
3016
|
+
};
|
|
3017
|
+
const deriveControllerPda = async (id) => {
|
|
3018
|
+
const [controllerPda] = await addresses.getProgramDerivedAddress({
|
|
3019
|
+
programAddress: addresses.address(SVM_ALM_CONTROLLER_PROGRAM_ADDRESS),
|
|
3020
|
+
seeds: ["controller", Buffer.from(new Uint16Array([id]).buffer)],
|
|
3021
|
+
});
|
|
3022
|
+
return controllerPda;
|
|
3023
|
+
};
|
|
3024
|
+
const deriveControllerAuthorityPda = async (controller) => {
|
|
3025
|
+
const addressEncoder = addresses.getAddressEncoder();
|
|
3026
|
+
const [controllerAuthorityPda] = await addresses.getProgramDerivedAddress({
|
|
3027
|
+
programAddress: addresses.address(SVM_ALM_CONTROLLER_PROGRAM_ADDRESS),
|
|
3028
|
+
seeds: ["controller_authority", addressEncoder.encode(addresses.address(controller))],
|
|
3029
|
+
});
|
|
3030
|
+
return controllerAuthorityPda;
|
|
3031
|
+
};
|
|
3032
|
+
const derivePermissionPda = async (controller, authority) => {
|
|
3033
|
+
const addressEncoder = addresses.getAddressEncoder();
|
|
3034
|
+
const [permissionPda] = await addresses.getProgramDerivedAddress({
|
|
3035
|
+
programAddress: addresses.address(SVM_ALM_CONTROLLER_PROGRAM_ADDRESS),
|
|
3036
|
+
seeds: [
|
|
3037
|
+
"permission",
|
|
3038
|
+
addressEncoder.encode(addresses.address(controller)),
|
|
3039
|
+
addressEncoder.encode(addresses.address(authority)),
|
|
3040
|
+
],
|
|
3041
|
+
});
|
|
3042
|
+
return permissionPda;
|
|
3043
|
+
};
|
|
3044
|
+
const deriveReservePda = async (controller, mint) => {
|
|
3045
|
+
const addressEncoder = addresses.getAddressEncoder();
|
|
3046
|
+
const [reservePda] = await addresses.getProgramDerivedAddress({
|
|
3047
|
+
programAddress: addresses.address(SVM_ALM_CONTROLLER_PROGRAM_ADDRESS),
|
|
3048
|
+
seeds: [
|
|
3049
|
+
"reserve",
|
|
3050
|
+
addressEncoder.encode(addresses.address(controller)),
|
|
3051
|
+
addressEncoder.encode(addresses.address(mint)),
|
|
3052
|
+
],
|
|
3053
|
+
});
|
|
3054
|
+
return reservePda;
|
|
3055
|
+
};
|
|
3056
|
+
const deriveSplTokenSwapLpTokenPda = async (controller, lpMintAddress) => {
|
|
3057
|
+
const addressEncoder = addresses.getAddressEncoder();
|
|
3058
|
+
const [lpTokenPda] = await addresses.getProgramDerivedAddress({
|
|
3059
|
+
programAddress: addresses.address(SVM_ALM_CONTROLLER_PROGRAM_ADDRESS),
|
|
3060
|
+
seeds: [
|
|
3061
|
+
"spl-swap-lp",
|
|
3062
|
+
addressEncoder.encode(addresses.address(controller)),
|
|
3063
|
+
addressEncoder.encode(addresses.address(lpMintAddress)),
|
|
3064
|
+
],
|
|
3065
|
+
});
|
|
3066
|
+
return lpTokenPda;
|
|
3067
|
+
};
|
|
3068
|
+
|
|
3069
|
+
exports.ATOMIC_SWAP_BORROW_DISCRIMINATOR = ATOMIC_SWAP_BORROW_DISCRIMINATOR;
|
|
3070
|
+
exports.ATOMIC_SWAP_REPAY_DISCRIMINATOR = ATOMIC_SWAP_REPAY_DISCRIMINATOR;
|
|
3071
|
+
exports.EMIT_EVENT_DISCRIMINATOR = EMIT_EVENT_DISCRIMINATOR;
|
|
3072
|
+
exports.INITIALIZE_CONTROLLER_DISCRIMINATOR = INITIALIZE_CONTROLLER_DISCRIMINATOR;
|
|
3073
|
+
exports.INITIALIZE_INTEGRATION_DISCRIMINATOR = INITIALIZE_INTEGRATION_DISCRIMINATOR;
|
|
3074
|
+
exports.INITIALIZE_ORACLE_DISCRIMINATOR = INITIALIZE_ORACLE_DISCRIMINATOR;
|
|
3075
|
+
exports.INITIALIZE_RESERVE_DISCRIMINATOR = INITIALIZE_RESERVE_DISCRIMINATOR;
|
|
3076
|
+
exports.MANAGE_CONTROLLER_DISCRIMINATOR = MANAGE_CONTROLLER_DISCRIMINATOR;
|
|
3077
|
+
exports.MANAGE_INTEGRATION_DISCRIMINATOR = MANAGE_INTEGRATION_DISCRIMINATOR;
|
|
3078
|
+
exports.MANAGE_PERMISSION_DISCRIMINATOR = MANAGE_PERMISSION_DISCRIMINATOR;
|
|
3079
|
+
exports.MANAGE_RESERVE_DISCRIMINATOR = MANAGE_RESERVE_DISCRIMINATOR;
|
|
3080
|
+
exports.PULL_DISCRIMINATOR = PULL_DISCRIMINATOR;
|
|
3081
|
+
exports.PUSH_DISCRIMINATOR = PUSH_DISCRIMINATOR;
|
|
3082
|
+
exports.REFRESH_ORACLE_DISCRIMINATOR = REFRESH_ORACLE_DISCRIMINATOR;
|
|
3083
|
+
exports.RESET_LZ_PUSH_IN_FLIGHT_DISCRIMINATOR = RESET_LZ_PUSH_IN_FLIGHT_DISCRIMINATOR;
|
|
3084
|
+
exports.SVM_ALM_CONTROLLER_PROGRAM_ADDRESS = SVM_ALM_CONTROLLER_PROGRAM_ADDRESS;
|
|
3085
|
+
exports.SYNC_DISCRIMINATOR = SYNC_DISCRIMINATOR;
|
|
3086
|
+
exports.SYNC_RESERVE_DISCRIMINATOR = SYNC_RESERVE_DISCRIMINATOR;
|
|
3087
|
+
exports.UPDATE_ORACLE_DISCRIMINATOR = UPDATE_ORACLE_DISCRIMINATOR;
|
|
3088
|
+
exports.decodeController = decodeController;
|
|
3089
|
+
exports.decodeIntegration = decodeIntegration;
|
|
3090
|
+
exports.decodeOracle = decodeOracle;
|
|
3091
|
+
exports.decodePermission = decodePermission;
|
|
3092
|
+
exports.decodeReserve = decodeReserve;
|
|
3093
|
+
exports.deriveControllerAuthorityPda = deriveControllerAuthorityPda;
|
|
3094
|
+
exports.deriveControllerPda = deriveControllerPda;
|
|
3095
|
+
exports.deriveIntegrationPda = deriveIntegrationPda;
|
|
3096
|
+
exports.derivePermissionPda = derivePermissionPda;
|
|
3097
|
+
exports.deriveReservePda = deriveReservePda;
|
|
3098
|
+
exports.deriveSplTokenSwapLpTokenPda = deriveSplTokenSwapLpTokenPda;
|
|
3099
|
+
exports.fetchAllController = fetchAllController;
|
|
3100
|
+
exports.fetchAllIntegration = fetchAllIntegration;
|
|
3101
|
+
exports.fetchAllMaybeController = fetchAllMaybeController;
|
|
3102
|
+
exports.fetchAllMaybeIntegration = fetchAllMaybeIntegration;
|
|
3103
|
+
exports.fetchAllMaybeOracle = fetchAllMaybeOracle;
|
|
3104
|
+
exports.fetchAllMaybePermission = fetchAllMaybePermission;
|
|
3105
|
+
exports.fetchAllMaybeReserve = fetchAllMaybeReserve;
|
|
3106
|
+
exports.fetchAllOracle = fetchAllOracle;
|
|
3107
|
+
exports.fetchAllPermission = fetchAllPermission;
|
|
3108
|
+
exports.fetchAllReserve = fetchAllReserve;
|
|
3109
|
+
exports.fetchController = fetchController;
|
|
3110
|
+
exports.fetchIntegration = fetchIntegration;
|
|
3111
|
+
exports.fetchMaybeController = fetchMaybeController;
|
|
3112
|
+
exports.fetchMaybeIntegration = fetchMaybeIntegration;
|
|
3113
|
+
exports.fetchMaybeOracle = fetchMaybeOracle;
|
|
3114
|
+
exports.fetchMaybePermission = fetchMaybePermission;
|
|
3115
|
+
exports.fetchMaybeReserve = fetchMaybeReserve;
|
|
3116
|
+
exports.fetchOracle = fetchOracle;
|
|
3117
|
+
exports.fetchPermission = fetchPermission;
|
|
3118
|
+
exports.fetchReserve = fetchReserve;
|
|
3119
|
+
exports.getAccountDiscriminatorsCodec = getAccountDiscriminatorsCodec;
|
|
3120
|
+
exports.getAccountDiscriminatorsDecoder = getAccountDiscriminatorsDecoder;
|
|
3121
|
+
exports.getAccountDiscriminatorsEncoder = getAccountDiscriminatorsEncoder;
|
|
3122
|
+
exports.getAccountingActionCodec = getAccountingActionCodec;
|
|
3123
|
+
exports.getAccountingActionDecoder = getAccountingActionDecoder;
|
|
3124
|
+
exports.getAccountingActionEncoder = getAccountingActionEncoder;
|
|
3125
|
+
exports.getAccountingDirectionCodec = getAccountingDirectionCodec;
|
|
3126
|
+
exports.getAccountingDirectionDecoder = getAccountingDirectionDecoder;
|
|
3127
|
+
exports.getAccountingDirectionEncoder = getAccountingDirectionEncoder;
|
|
3128
|
+
exports.getAccountingEventCodec = getAccountingEventCodec;
|
|
3129
|
+
exports.getAccountingEventDecoder = getAccountingEventDecoder;
|
|
3130
|
+
exports.getAccountingEventEncoder = getAccountingEventEncoder;
|
|
3131
|
+
exports.getAtomicSwapBorrowDiscriminatorBytes = getAtomicSwapBorrowDiscriminatorBytes;
|
|
3132
|
+
exports.getAtomicSwapBorrowInstruction = getAtomicSwapBorrowInstruction;
|
|
3133
|
+
exports.getAtomicSwapBorrowInstructionDataCodec = getAtomicSwapBorrowInstructionDataCodec;
|
|
3134
|
+
exports.getAtomicSwapBorrowInstructionDataDecoder = getAtomicSwapBorrowInstructionDataDecoder;
|
|
3135
|
+
exports.getAtomicSwapBorrowInstructionDataEncoder = getAtomicSwapBorrowInstructionDataEncoder;
|
|
3136
|
+
exports.getAtomicSwapConfigCodec = getAtomicSwapConfigCodec;
|
|
3137
|
+
exports.getAtomicSwapConfigDecoder = getAtomicSwapConfigDecoder;
|
|
3138
|
+
exports.getAtomicSwapConfigEncoder = getAtomicSwapConfigEncoder;
|
|
3139
|
+
exports.getAtomicSwapRepayDiscriminatorBytes = getAtomicSwapRepayDiscriminatorBytes;
|
|
3140
|
+
exports.getAtomicSwapRepayInstruction = getAtomicSwapRepayInstruction;
|
|
3141
|
+
exports.getAtomicSwapRepayInstructionDataCodec = getAtomicSwapRepayInstructionDataCodec;
|
|
3142
|
+
exports.getAtomicSwapRepayInstructionDataDecoder = getAtomicSwapRepayInstructionDataDecoder;
|
|
3143
|
+
exports.getAtomicSwapRepayInstructionDataEncoder = getAtomicSwapRepayInstructionDataEncoder;
|
|
3144
|
+
exports.getAtomicSwapStateCodec = getAtomicSwapStateCodec;
|
|
3145
|
+
exports.getAtomicSwapStateDecoder = getAtomicSwapStateDecoder;
|
|
3146
|
+
exports.getAtomicSwapStateEncoder = getAtomicSwapStateEncoder;
|
|
3147
|
+
exports.getCctpBridgeConfigCodec = getCctpBridgeConfigCodec;
|
|
3148
|
+
exports.getCctpBridgeConfigDecoder = getCctpBridgeConfigDecoder;
|
|
3149
|
+
exports.getCctpBridgeConfigEncoder = getCctpBridgeConfigEncoder;
|
|
3150
|
+
exports.getCctpBridgeStateCodec = getCctpBridgeStateCodec;
|
|
3151
|
+
exports.getCctpBridgeStateDecoder = getCctpBridgeStateDecoder;
|
|
3152
|
+
exports.getCctpBridgeStateEncoder = getCctpBridgeStateEncoder;
|
|
3153
|
+
exports.getControllerCodec = getControllerCodec;
|
|
3154
|
+
exports.getControllerDecoder = getControllerDecoder;
|
|
3155
|
+
exports.getControllerEncoder = getControllerEncoder;
|
|
3156
|
+
exports.getControllerSize = getControllerSize;
|
|
3157
|
+
exports.getControllerStatusCodec = getControllerStatusCodec;
|
|
3158
|
+
exports.getControllerStatusDecoder = getControllerStatusDecoder;
|
|
3159
|
+
exports.getControllerStatusEncoder = getControllerStatusEncoder;
|
|
3160
|
+
exports.getControllerUpdateEventCodec = getControllerUpdateEventCodec;
|
|
3161
|
+
exports.getControllerUpdateEventDecoder = getControllerUpdateEventDecoder;
|
|
3162
|
+
exports.getControllerUpdateEventEncoder = getControllerUpdateEventEncoder;
|
|
3163
|
+
exports.getDepositForBurnArgsCodec = getDepositForBurnArgsCodec;
|
|
3164
|
+
exports.getDepositForBurnArgsDecoder = getDepositForBurnArgsDecoder;
|
|
3165
|
+
exports.getDepositForBurnArgsEncoder = getDepositForBurnArgsEncoder;
|
|
3166
|
+
exports.getDepositSingleTokenTypeExactAmountInArgsCodec = getDepositSingleTokenTypeExactAmountInArgsCodec;
|
|
3167
|
+
exports.getDepositSingleTokenTypeExactAmountInArgsDecoder = getDepositSingleTokenTypeExactAmountInArgsDecoder;
|
|
3168
|
+
exports.getDepositSingleTokenTypeExactAmountInArgsEncoder = getDepositSingleTokenTypeExactAmountInArgsEncoder;
|
|
3169
|
+
exports.getEmitEventDiscriminatorBytes = getEmitEventDiscriminatorBytes;
|
|
3170
|
+
exports.getEmitEventInstruction = getEmitEventInstruction;
|
|
3171
|
+
exports.getEmitEventInstructionDataCodec = getEmitEventInstructionDataCodec;
|
|
3172
|
+
exports.getEmitEventInstructionDataDecoder = getEmitEventInstructionDataDecoder;
|
|
3173
|
+
exports.getEmitEventInstructionDataEncoder = getEmitEventInstructionDataEncoder;
|
|
3174
|
+
exports.getFeedArgsCodec = getFeedArgsCodec;
|
|
3175
|
+
exports.getFeedArgsDecoder = getFeedArgsDecoder;
|
|
3176
|
+
exports.getFeedArgsEncoder = getFeedArgsEncoder;
|
|
3177
|
+
exports.getFeedCodec = getFeedCodec;
|
|
3178
|
+
exports.getFeedDecoder = getFeedDecoder;
|
|
3179
|
+
exports.getFeedEncoder = getFeedEncoder;
|
|
3180
|
+
exports.getInitializeArgsCodec = getInitializeArgsCodec;
|
|
3181
|
+
exports.getInitializeArgsDecoder = getInitializeArgsDecoder;
|
|
3182
|
+
exports.getInitializeArgsEncoder = getInitializeArgsEncoder;
|
|
3183
|
+
exports.getInitializeControllerDiscriminatorBytes = getInitializeControllerDiscriminatorBytes;
|
|
3184
|
+
exports.getInitializeControllerInstruction = getInitializeControllerInstruction;
|
|
3185
|
+
exports.getInitializeControllerInstructionDataCodec = getInitializeControllerInstructionDataCodec;
|
|
3186
|
+
exports.getInitializeControllerInstructionDataDecoder = getInitializeControllerInstructionDataDecoder;
|
|
3187
|
+
exports.getInitializeControllerInstructionDataEncoder = getInitializeControllerInstructionDataEncoder;
|
|
3188
|
+
exports.getInitializeIntegrationDiscriminatorBytes = getInitializeIntegrationDiscriminatorBytes;
|
|
3189
|
+
exports.getInitializeIntegrationInstruction = getInitializeIntegrationInstruction;
|
|
3190
|
+
exports.getInitializeIntegrationInstructionDataCodec = getInitializeIntegrationInstructionDataCodec;
|
|
3191
|
+
exports.getInitializeIntegrationInstructionDataDecoder = getInitializeIntegrationInstructionDataDecoder;
|
|
3192
|
+
exports.getInitializeIntegrationInstructionDataEncoder = getInitializeIntegrationInstructionDataEncoder;
|
|
3193
|
+
exports.getInitializeOracleDiscriminatorBytes = getInitializeOracleDiscriminatorBytes;
|
|
3194
|
+
exports.getInitializeOracleInstruction = getInitializeOracleInstruction;
|
|
3195
|
+
exports.getInitializeOracleInstructionDataCodec = getInitializeOracleInstructionDataCodec;
|
|
3196
|
+
exports.getInitializeOracleInstructionDataDecoder = getInitializeOracleInstructionDataDecoder;
|
|
3197
|
+
exports.getInitializeOracleInstructionDataEncoder = getInitializeOracleInstructionDataEncoder;
|
|
3198
|
+
exports.getInitializeReserveDiscriminatorBytes = getInitializeReserveDiscriminatorBytes;
|
|
3199
|
+
exports.getInitializeReserveInstruction = getInitializeReserveInstruction;
|
|
3200
|
+
exports.getInitializeReserveInstructionDataCodec = getInitializeReserveInstructionDataCodec;
|
|
3201
|
+
exports.getInitializeReserveInstructionDataDecoder = getInitializeReserveInstructionDataDecoder;
|
|
3202
|
+
exports.getInitializeReserveInstructionDataEncoder = getInitializeReserveInstructionDataEncoder;
|
|
3203
|
+
exports.getIntegrationCodec = getIntegrationCodec;
|
|
3204
|
+
exports.getIntegrationConfigCodec = getIntegrationConfigCodec;
|
|
3205
|
+
exports.getIntegrationConfigDecoder = getIntegrationConfigDecoder;
|
|
3206
|
+
exports.getIntegrationConfigEncoder = getIntegrationConfigEncoder;
|
|
3207
|
+
exports.getIntegrationDecoder = getIntegrationDecoder;
|
|
3208
|
+
exports.getIntegrationEncoder = getIntegrationEncoder;
|
|
3209
|
+
exports.getIntegrationSize = getIntegrationSize;
|
|
3210
|
+
exports.getIntegrationStateCodec = getIntegrationStateCodec;
|
|
3211
|
+
exports.getIntegrationStateDecoder = getIntegrationStateDecoder;
|
|
3212
|
+
exports.getIntegrationStateEncoder = getIntegrationStateEncoder;
|
|
3213
|
+
exports.getIntegrationStatusCodec = getIntegrationStatusCodec;
|
|
3214
|
+
exports.getIntegrationStatusDecoder = getIntegrationStatusDecoder;
|
|
3215
|
+
exports.getIntegrationStatusEncoder = getIntegrationStatusEncoder;
|
|
3216
|
+
exports.getIntegrationTypeCodec = getIntegrationTypeCodec;
|
|
3217
|
+
exports.getIntegrationTypeDecoder = getIntegrationTypeDecoder;
|
|
3218
|
+
exports.getIntegrationTypeEncoder = getIntegrationTypeEncoder;
|
|
3219
|
+
exports.getIntegrationUpdateEventCodec = getIntegrationUpdateEventCodec;
|
|
3220
|
+
exports.getIntegrationUpdateEventDecoder = getIntegrationUpdateEventDecoder;
|
|
3221
|
+
exports.getIntegrationUpdateEventEncoder = getIntegrationUpdateEventEncoder;
|
|
3222
|
+
exports.getLocalTokenCodec = getLocalTokenCodec;
|
|
3223
|
+
exports.getLocalTokenDecoder = getLocalTokenDecoder;
|
|
3224
|
+
exports.getLocalTokenEncoder = getLocalTokenEncoder;
|
|
3225
|
+
exports.getLzBridgeConfigCodec = getLzBridgeConfigCodec;
|
|
3226
|
+
exports.getLzBridgeConfigDecoder = getLzBridgeConfigDecoder;
|
|
3227
|
+
exports.getLzBridgeConfigEncoder = getLzBridgeConfigEncoder;
|
|
3228
|
+
exports.getLzBridgeStateCodec = getLzBridgeStateCodec;
|
|
3229
|
+
exports.getLzBridgeStateDecoder = getLzBridgeStateDecoder;
|
|
3230
|
+
exports.getLzBridgeStateEncoder = getLzBridgeStateEncoder;
|
|
3231
|
+
exports.getManageControllerDiscriminatorBytes = getManageControllerDiscriminatorBytes;
|
|
3232
|
+
exports.getManageControllerInstruction = getManageControllerInstruction;
|
|
3233
|
+
exports.getManageControllerInstructionDataCodec = getManageControllerInstructionDataCodec;
|
|
3234
|
+
exports.getManageControllerInstructionDataDecoder = getManageControllerInstructionDataDecoder;
|
|
3235
|
+
exports.getManageControllerInstructionDataEncoder = getManageControllerInstructionDataEncoder;
|
|
3236
|
+
exports.getManageIntegrationDiscriminatorBytes = getManageIntegrationDiscriminatorBytes;
|
|
3237
|
+
exports.getManageIntegrationInstruction = getManageIntegrationInstruction;
|
|
3238
|
+
exports.getManageIntegrationInstructionDataCodec = getManageIntegrationInstructionDataCodec;
|
|
3239
|
+
exports.getManageIntegrationInstructionDataDecoder = getManageIntegrationInstructionDataDecoder;
|
|
3240
|
+
exports.getManageIntegrationInstructionDataEncoder = getManageIntegrationInstructionDataEncoder;
|
|
3241
|
+
exports.getManagePermissionDiscriminatorBytes = getManagePermissionDiscriminatorBytes;
|
|
3242
|
+
exports.getManagePermissionInstruction = getManagePermissionInstruction;
|
|
3243
|
+
exports.getManagePermissionInstructionDataCodec = getManagePermissionInstructionDataCodec;
|
|
3244
|
+
exports.getManagePermissionInstructionDataDecoder = getManagePermissionInstructionDataDecoder;
|
|
3245
|
+
exports.getManagePermissionInstructionDataEncoder = getManagePermissionInstructionDataEncoder;
|
|
3246
|
+
exports.getManageReserveDiscriminatorBytes = getManageReserveDiscriminatorBytes;
|
|
3247
|
+
exports.getManageReserveInstruction = getManageReserveInstruction;
|
|
3248
|
+
exports.getManageReserveInstructionDataCodec = getManageReserveInstructionDataCodec;
|
|
3249
|
+
exports.getManageReserveInstructionDataDecoder = getManageReserveInstructionDataDecoder;
|
|
3250
|
+
exports.getManageReserveInstructionDataEncoder = getManageReserveInstructionDataEncoder;
|
|
3251
|
+
exports.getOFTStoreCodec = getOFTStoreCodec;
|
|
3252
|
+
exports.getOFTStoreDecoder = getOFTStoreDecoder;
|
|
3253
|
+
exports.getOFTStoreEncoder = getOFTStoreEncoder;
|
|
3254
|
+
exports.getOftSendParamsCodec = getOftSendParamsCodec;
|
|
3255
|
+
exports.getOftSendParamsDecoder = getOftSendParamsDecoder;
|
|
3256
|
+
exports.getOftSendParamsEncoder = getOftSendParamsEncoder;
|
|
3257
|
+
exports.getOracleCodec = getOracleCodec;
|
|
3258
|
+
exports.getOracleDecoder = getOracleDecoder;
|
|
3259
|
+
exports.getOracleEncoder = getOracleEncoder;
|
|
3260
|
+
exports.getOracleSize = getOracleSize;
|
|
3261
|
+
exports.getOracleUpdateEventCodec = getOracleUpdateEventCodec;
|
|
3262
|
+
exports.getOracleUpdateEventDecoder = getOracleUpdateEventDecoder;
|
|
3263
|
+
exports.getOracleUpdateEventEncoder = getOracleUpdateEventEncoder;
|
|
3264
|
+
exports.getPeerConfigCodec = getPeerConfigCodec;
|
|
3265
|
+
exports.getPeerConfigDecoder = getPeerConfigDecoder;
|
|
3266
|
+
exports.getPeerConfigEncoder = getPeerConfigEncoder;
|
|
3267
|
+
exports.getPermissionCodec = getPermissionCodec;
|
|
3268
|
+
exports.getPermissionDecoder = getPermissionDecoder;
|
|
3269
|
+
exports.getPermissionEncoder = getPermissionEncoder;
|
|
3270
|
+
exports.getPermissionSize = getPermissionSize;
|
|
3271
|
+
exports.getPermissionStatusCodec = getPermissionStatusCodec;
|
|
3272
|
+
exports.getPermissionStatusDecoder = getPermissionStatusDecoder;
|
|
3273
|
+
exports.getPermissionStatusEncoder = getPermissionStatusEncoder;
|
|
3274
|
+
exports.getPermissionUpdateEventCodec = getPermissionUpdateEventCodec;
|
|
3275
|
+
exports.getPermissionUpdateEventDecoder = getPermissionUpdateEventDecoder;
|
|
3276
|
+
exports.getPermissionUpdateEventEncoder = getPermissionUpdateEventEncoder;
|
|
3277
|
+
exports.getPullArgsCodec = getPullArgsCodec;
|
|
3278
|
+
exports.getPullArgsDecoder = getPullArgsDecoder;
|
|
3279
|
+
exports.getPullArgsEncoder = getPullArgsEncoder;
|
|
3280
|
+
exports.getPullDiscriminatorBytes = getPullDiscriminatorBytes;
|
|
3281
|
+
exports.getPullInstruction = getPullInstruction;
|
|
3282
|
+
exports.getPullInstructionDataCodec = getPullInstructionDataCodec;
|
|
3283
|
+
exports.getPullInstructionDataDecoder = getPullInstructionDataDecoder;
|
|
3284
|
+
exports.getPullInstructionDataEncoder = getPullInstructionDataEncoder;
|
|
3285
|
+
exports.getPushArgsCodec = getPushArgsCodec;
|
|
3286
|
+
exports.getPushArgsDecoder = getPushArgsDecoder;
|
|
3287
|
+
exports.getPushArgsEncoder = getPushArgsEncoder;
|
|
3288
|
+
exports.getPushDiscriminatorBytes = getPushDiscriminatorBytes;
|
|
3289
|
+
exports.getPushInstruction = getPushInstruction;
|
|
3290
|
+
exports.getPushInstructionDataCodec = getPushInstructionDataCodec;
|
|
3291
|
+
exports.getPushInstructionDataDecoder = getPushInstructionDataDecoder;
|
|
3292
|
+
exports.getPushInstructionDataEncoder = getPushInstructionDataEncoder;
|
|
3293
|
+
exports.getRefreshOracleDiscriminatorBytes = getRefreshOracleDiscriminatorBytes;
|
|
3294
|
+
exports.getRefreshOracleInstruction = getRefreshOracleInstruction;
|
|
3295
|
+
exports.getRefreshOracleInstructionDataCodec = getRefreshOracleInstructionDataCodec;
|
|
3296
|
+
exports.getRefreshOracleInstructionDataDecoder = getRefreshOracleInstructionDataDecoder;
|
|
3297
|
+
exports.getRefreshOracleInstructionDataEncoder = getRefreshOracleInstructionDataEncoder;
|
|
3298
|
+
exports.getRemoteTokenMessengerCodec = getRemoteTokenMessengerCodec;
|
|
3299
|
+
exports.getRemoteTokenMessengerDecoder = getRemoteTokenMessengerDecoder;
|
|
3300
|
+
exports.getRemoteTokenMessengerEncoder = getRemoteTokenMessengerEncoder;
|
|
3301
|
+
exports.getReserveCodec = getReserveCodec;
|
|
3302
|
+
exports.getReserveDecoder = getReserveDecoder;
|
|
3303
|
+
exports.getReserveEncoder = getReserveEncoder;
|
|
3304
|
+
exports.getReserveSize = getReserveSize;
|
|
3305
|
+
exports.getReserveStatusCodec = getReserveStatusCodec;
|
|
3306
|
+
exports.getReserveStatusDecoder = getReserveStatusDecoder;
|
|
3307
|
+
exports.getReserveStatusEncoder = getReserveStatusEncoder;
|
|
3308
|
+
exports.getReserveUpdateEventCodec = getReserveUpdateEventCodec;
|
|
3309
|
+
exports.getReserveUpdateEventDecoder = getReserveUpdateEventDecoder;
|
|
3310
|
+
exports.getReserveUpdateEventEncoder = getReserveUpdateEventEncoder;
|
|
3311
|
+
exports.getResetLzPushInFlightDiscriminatorBytes = getResetLzPushInFlightDiscriminatorBytes;
|
|
3312
|
+
exports.getResetLzPushInFlightInstruction = getResetLzPushInFlightInstruction;
|
|
3313
|
+
exports.getResetLzPushInFlightInstructionDataCodec = getResetLzPushInFlightInstructionDataCodec;
|
|
3314
|
+
exports.getResetLzPushInFlightInstructionDataDecoder = getResetLzPushInFlightInstructionDataDecoder;
|
|
3315
|
+
exports.getResetLzPushInFlightInstructionDataEncoder = getResetLzPushInFlightInstructionDataEncoder;
|
|
3316
|
+
exports.getSplTokenExternalConfigCodec = getSplTokenExternalConfigCodec;
|
|
3317
|
+
exports.getSplTokenExternalConfigDecoder = getSplTokenExternalConfigDecoder;
|
|
3318
|
+
exports.getSplTokenExternalConfigEncoder = getSplTokenExternalConfigEncoder;
|
|
3319
|
+
exports.getSplTokenExternalStateCodec = getSplTokenExternalStateCodec;
|
|
3320
|
+
exports.getSplTokenExternalStateDecoder = getSplTokenExternalStateDecoder;
|
|
3321
|
+
exports.getSplTokenExternalStateEncoder = getSplTokenExternalStateEncoder;
|
|
3322
|
+
exports.getSplTokenSwapConfigCodec = getSplTokenSwapConfigCodec;
|
|
3323
|
+
exports.getSplTokenSwapConfigDecoder = getSplTokenSwapConfigDecoder;
|
|
3324
|
+
exports.getSplTokenSwapConfigEncoder = getSplTokenSwapConfigEncoder;
|
|
3325
|
+
exports.getSplTokenSwapStateCodec = getSplTokenSwapStateCodec;
|
|
3326
|
+
exports.getSplTokenSwapStateDecoder = getSplTokenSwapStateDecoder;
|
|
3327
|
+
exports.getSplTokenSwapStateEncoder = getSplTokenSwapStateEncoder;
|
|
3328
|
+
exports.getSvmAlmControllerEventCodec = getSvmAlmControllerEventCodec;
|
|
3329
|
+
exports.getSvmAlmControllerEventDecoder = getSvmAlmControllerEventDecoder;
|
|
3330
|
+
exports.getSvmAlmControllerEventEncoder = getSvmAlmControllerEventEncoder;
|
|
3331
|
+
exports.getSwapV1SubsetCodec = getSwapV1SubsetCodec;
|
|
3332
|
+
exports.getSwapV1SubsetDecoder = getSwapV1SubsetDecoder;
|
|
3333
|
+
exports.getSwapV1SubsetEncoder = getSwapV1SubsetEncoder;
|
|
3334
|
+
exports.getSyncDiscriminatorBytes = getSyncDiscriminatorBytes;
|
|
3335
|
+
exports.getSyncInstruction = getSyncInstruction;
|
|
3336
|
+
exports.getSyncInstructionDataCodec = getSyncInstructionDataCodec;
|
|
3337
|
+
exports.getSyncInstructionDataDecoder = getSyncInstructionDataDecoder;
|
|
3338
|
+
exports.getSyncInstructionDataEncoder = getSyncInstructionDataEncoder;
|
|
3339
|
+
exports.getSyncReserveDiscriminatorBytes = getSyncReserveDiscriminatorBytes;
|
|
3340
|
+
exports.getSyncReserveInstruction = getSyncReserveInstruction;
|
|
3341
|
+
exports.getSyncReserveInstructionDataCodec = getSyncReserveInstructionDataCodec;
|
|
3342
|
+
exports.getSyncReserveInstructionDataDecoder = getSyncReserveInstructionDataDecoder;
|
|
3343
|
+
exports.getSyncReserveInstructionDataEncoder = getSyncReserveInstructionDataEncoder;
|
|
3344
|
+
exports.getUpdateOracleDiscriminatorBytes = getUpdateOracleDiscriminatorBytes;
|
|
3345
|
+
exports.getUpdateOracleInstruction = getUpdateOracleInstruction;
|
|
3346
|
+
exports.getUpdateOracleInstructionDataCodec = getUpdateOracleInstructionDataCodec;
|
|
3347
|
+
exports.getUpdateOracleInstructionDataDecoder = getUpdateOracleInstructionDataDecoder;
|
|
3348
|
+
exports.getUpdateOracleInstructionDataEncoder = getUpdateOracleInstructionDataEncoder;
|
|
3349
|
+
exports.getWithdrawSingleTokenTypeExactAmountOutArgsCodec = getWithdrawSingleTokenTypeExactAmountOutArgsCodec;
|
|
3350
|
+
exports.getWithdrawSingleTokenTypeExactAmountOutArgsDecoder = getWithdrawSingleTokenTypeExactAmountOutArgsDecoder;
|
|
3351
|
+
exports.getWithdrawSingleTokenTypeExactAmountOutArgsEncoder = getWithdrawSingleTokenTypeExactAmountOutArgsEncoder;
|
|
3352
|
+
exports.identifySvmAlmControllerInstruction = identifySvmAlmControllerInstruction;
|
|
3353
|
+
exports.initializeArgs = initializeArgs;
|
|
3354
|
+
exports.integrationConfig = integrationConfig;
|
|
3355
|
+
exports.integrationState = integrationState;
|
|
3356
|
+
exports.isInitializeArgs = isInitializeArgs;
|
|
3357
|
+
exports.isIntegrationConfig = isIntegrationConfig;
|
|
3358
|
+
exports.isIntegrationState = isIntegrationState;
|
|
3359
|
+
exports.isPullArgs = isPullArgs;
|
|
3360
|
+
exports.isPushArgs = isPushArgs;
|
|
3361
|
+
exports.isSvmAlmControllerEvent = isSvmAlmControllerEvent;
|
|
3362
|
+
exports.parseAtomicSwapBorrowInstruction = parseAtomicSwapBorrowInstruction;
|
|
3363
|
+
exports.parseAtomicSwapRepayInstruction = parseAtomicSwapRepayInstruction;
|
|
3364
|
+
exports.parseEmitEventInstruction = parseEmitEventInstruction;
|
|
3365
|
+
exports.parseInitializeControllerInstruction = parseInitializeControllerInstruction;
|
|
3366
|
+
exports.parseInitializeIntegrationInstruction = parseInitializeIntegrationInstruction;
|
|
3367
|
+
exports.parseInitializeOracleInstruction = parseInitializeOracleInstruction;
|
|
3368
|
+
exports.parseInitializeReserveInstruction = parseInitializeReserveInstruction;
|
|
3369
|
+
exports.parseManageControllerInstruction = parseManageControllerInstruction;
|
|
3370
|
+
exports.parseManageIntegrationInstruction = parseManageIntegrationInstruction;
|
|
3371
|
+
exports.parseManagePermissionInstruction = parseManagePermissionInstruction;
|
|
3372
|
+
exports.parseManageReserveInstruction = parseManageReserveInstruction;
|
|
3373
|
+
exports.parsePullInstruction = parsePullInstruction;
|
|
3374
|
+
exports.parsePushInstruction = parsePushInstruction;
|
|
3375
|
+
exports.parseRefreshOracleInstruction = parseRefreshOracleInstruction;
|
|
3376
|
+
exports.parseResetLzPushInFlightInstruction = parseResetLzPushInFlightInstruction;
|
|
3377
|
+
exports.parseSyncInstruction = parseSyncInstruction;
|
|
3378
|
+
exports.parseSyncReserveInstruction = parseSyncReserveInstruction;
|
|
3379
|
+
exports.parseUpdateOracleInstruction = parseUpdateOracleInstruction;
|
|
3380
|
+
exports.pullArgs = pullArgs;
|
|
3381
|
+
exports.pushArgs = pushArgs;
|
|
3382
|
+
exports.svmAlmControllerEvent = svmAlmControllerEvent;
|