@haven-fi/solauto-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/index.d.ts +2 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +17 -0
- package/dist/clients/solautoClient.d.ts +73 -0
- package/dist/clients/solautoClient.d.ts.map +1 -0
- package/dist/clients/solautoClient.js +416 -0
- package/dist/clients/solautoMarginfiClient.d.ts +40 -0
- package/dist/clients/solautoMarginfiClient.d.ts.map +1 -0
- package/dist/clients/solautoMarginfiClient.js +313 -0
- package/dist/constants/generalAccounts.d.ts +5 -0
- package/dist/constants/generalAccounts.d.ts.map +1 -0
- package/dist/constants/generalAccounts.js +8 -0
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +21 -0
- package/dist/constants/marginfiAccounts.d.ts +7 -0
- package/dist/constants/marginfiAccounts.d.ts.map +1 -0
- package/dist/constants/marginfiAccounts.js +23 -0
- package/dist/constants/pythConstants.d.ts +5 -0
- package/dist/constants/pythConstants.d.ts.map +1 -0
- package/dist/constants/pythConstants.js +10 -0
- package/dist/constants/solautoConstants.d.ts +19 -0
- package/dist/constants/solautoConstants.d.ts.map +1 -0
- package/dist/constants/solautoConstants.js +35 -0
- package/dist/constants/tokenConstants.d.ts +3 -0
- package/dist/constants/tokenConstants.d.ts.map +1 -0
- package/dist/constants/tokenConstants.js +10 -0
- package/dist/generated/accounts/index.d.ts +10 -0
- package/dist/generated/accounts/index.d.ts.map +1 -0
- package/dist/generated/accounts/index.js +25 -0
- package/dist/generated/accounts/referralState.d.ts +37 -0
- package/dist/generated/accounts/referralState.d.ts.map +1 -0
- package/dist/generated/accounts/referralState.js +73 -0
- package/dist/generated/accounts/solautoPosition.d.ts +58 -0
- package/dist/generated/accounts/solautoPosition.d.ts.map +1 -0
- package/dist/generated/accounts/solautoPosition.js +82 -0
- package/dist/generated/errors/index.d.ts +9 -0
- package/dist/generated/errors/index.d.ts.map +1 -0
- package/dist/generated/errors/index.js +24 -0
- package/dist/generated/errors/solauto.d.ts +91 -0
- package/dist/generated/errors/solauto.d.ts.map +1 -0
- package/dist/generated/errors/solauto.js +163 -0
- package/dist/generated/index.d.ts +14 -0
- package/dist/generated/index.d.ts.map +1 -0
- package/dist/generated/index.js +29 -0
- package/dist/generated/instructions/cancelDCA.d.ts +26 -0
- package/dist/generated/instructions/cancelDCA.d.ts.map +1 -0
- package/dist/generated/instructions/cancelDCA.js +92 -0
- package/dist/generated/instructions/claimReferralFees.d.ts +26 -0
- package/dist/generated/instructions/claimReferralFees.d.ts.map +1 -0
- package/dist/generated/instructions/claimReferralFees.js +87 -0
- package/dist/generated/instructions/closePosition.d.ts +28 -0
- package/dist/generated/instructions/closePosition.d.ts.map +1 -0
- package/dist/generated/instructions/closePosition.js +102 -0
- package/dist/generated/instructions/convertReferralFees.d.ts +27 -0
- package/dist/generated/instructions/convertReferralFees.d.ts.map +1 -0
- package/dist/generated/instructions/convertReferralFees.js +96 -0
- package/dist/generated/instructions/index.d.ts +18 -0
- package/dist/generated/instructions/index.d.ts.map +1 -0
- package/dist/generated/instructions/index.js +33 -0
- package/dist/generated/instructions/marginfiOpenPosition.d.ts +46 -0
- package/dist/generated/instructions/marginfiOpenPosition.d.ts.map +1 -0
- package/dist/generated/instructions/marginfiOpenPosition.js +161 -0
- package/dist/generated/instructions/marginfiProtocolInteraction.d.ts +42 -0
- package/dist/generated/instructions/marginfiProtocolInteraction.d.ts.map +1 -0
- package/dist/generated/instructions/marginfiProtocolInteraction.js +150 -0
- package/dist/generated/instructions/marginfiRebalance.d.ts +49 -0
- package/dist/generated/instructions/marginfiRebalance.d.ts.map +1 -0
- package/dist/generated/instructions/marginfiRebalance.js +164 -0
- package/dist/generated/instructions/marginfiRefreshData.d.ts +27 -0
- package/dist/generated/instructions/marginfiRefreshData.d.ts.map +1 -0
- package/dist/generated/instructions/marginfiRefreshData.js +84 -0
- package/dist/generated/instructions/updatePosition.d.ts +30 -0
- package/dist/generated/instructions/updatePosition.d.ts.map +1 -0
- package/dist/generated/instructions/updatePosition.js +87 -0
- package/dist/generated/instructions/updateReferralStates.d.ts +30 -0
- package/dist/generated/instructions/updateReferralStates.d.ts.map +1 -0
- package/dist/generated/instructions/updateReferralStates.js +77 -0
- package/dist/generated/programs/index.d.ts +9 -0
- package/dist/generated/programs/index.d.ts.map +1 -0
- package/dist/generated/programs/index.js +24 -0
- package/dist/generated/programs/solauto.d.ts +13 -0
- package/dist/generated/programs/solauto.d.ts.map +1 -0
- package/dist/generated/programs/solauto.js +36 -0
- package/dist/generated/shared/index.d.ts +54 -0
- package/dist/generated/shared/index.d.ts.map +1 -0
- package/dist/generated/shared/index.js +70 -0
- package/dist/generated/types/automationSettings.d.ts +26 -0
- package/dist/generated/types/automationSettings.d.ts.map +1 -0
- package/dist/generated/types/automationSettings.js +22 -0
- package/dist/generated/types/automationSettingsInp.d.ts +22 -0
- package/dist/generated/types/automationSettingsInp.d.ts.map +1 -0
- package/dist/generated/types/automationSettingsInp.js +20 -0
- package/dist/generated/types/dCASettings.d.ts +21 -0
- package/dist/generated/types/dCASettings.d.ts.map +1 -0
- package/dist/generated/types/dCASettings.js +20 -0
- package/dist/generated/types/dCASettingsInp.d.ts +19 -0
- package/dist/generated/types/dCASettingsInp.d.ts.map +1 -0
- package/dist/generated/types/dCASettingsInp.js +19 -0
- package/dist/generated/types/feeType.d.ts +15 -0
- package/dist/generated/types/feeType.d.ts.map +1 -0
- package/dist/generated/types/feeType.js +20 -0
- package/dist/generated/types/index.d.ts +26 -0
- package/dist/generated/types/index.d.ts.map +1 -0
- package/dist/generated/types/index.js +41 -0
- package/dist/generated/types/lendingPlatform.d.ts +16 -0
- package/dist/generated/types/lendingPlatform.d.ts.map +1 -0
- package/dist/generated/types/lendingPlatform.js +23 -0
- package/dist/generated/types/podBool.d.ts +14 -0
- package/dist/generated/types/podBool.d.ts.map +1 -0
- package/dist/generated/types/podBool.js +17 -0
- package/dist/generated/types/positionData.d.ts +32 -0
- package/dist/generated/types/positionData.d.ts.map +1 -0
- package/dist/generated/types/positionData.js +25 -0
- package/dist/generated/types/positionState.d.ts +35 -0
- package/dist/generated/types/positionState.d.ts.map +1 -0
- package/dist/generated/types/positionState.js +27 -0
- package/dist/generated/types/positionTokenUsage.d.ts +36 -0
- package/dist/generated/types/positionTokenUsage.d.ts.map +1 -0
- package/dist/generated/types/positionTokenUsage.js +27 -0
- package/dist/generated/types/rebalanceData.d.ts +29 -0
- package/dist/generated/types/rebalanceData.d.ts.map +1 -0
- package/dist/generated/types/rebalanceData.js +24 -0
- package/dist/generated/types/solautoAction.d.ts +44 -0
- package/dist/generated/types/solautoAction.d.ts.map +1 -0
- package/dist/generated/types/solautoAction.js +51 -0
- package/dist/generated/types/solautoRebalanceType.d.ts +17 -0
- package/dist/generated/types/solautoRebalanceType.d.ts.map +1 -0
- package/dist/generated/types/solautoRebalanceType.js +24 -0
- package/dist/generated/types/solautoSettingsParameters.d.ts +31 -0
- package/dist/generated/types/solautoSettingsParameters.d.ts.map +1 -0
- package/dist/generated/types/solautoSettingsParameters.js +25 -0
- package/dist/generated/types/solautoSettingsParametersInp.d.ts +28 -0
- package/dist/generated/types/solautoSettingsParametersInp.d.ts.map +1 -0
- package/dist/generated/types/solautoSettingsParametersInp.js +23 -0
- package/dist/generated/types/tokenAmount.d.ts +18 -0
- package/dist/generated/types/tokenAmount.d.ts.map +1 -0
- package/dist/generated/types/tokenAmount.js +18 -0
- package/dist/generated/types/tokenBalanceAmount.d.ts +27 -0
- package/dist/generated/types/tokenBalanceAmount.d.ts.map +1 -0
- package/dist/generated/types/tokenBalanceAmount.js +33 -0
- package/dist/generated/types/updatePositionData.d.ts +22 -0
- package/dist/generated/types/updatePositionData.d.ts.map +1 -0
- package/dist/generated/types/updatePositionData.js +20 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/marginfi-sdk/accounts/bank.d.ts +136 -0
- package/dist/marginfi-sdk/accounts/bank.d.ts.map +1 -0
- package/dist/marginfi-sdk/accounts/bank.js +124 -0
- package/dist/marginfi-sdk/accounts/index.d.ts +11 -0
- package/dist/marginfi-sdk/accounts/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/accounts/index.js +26 -0
- package/dist/marginfi-sdk/accounts/marginfiAccount.d.ts +58 -0
- package/dist/marginfi-sdk/accounts/marginfiAccount.d.ts.map +1 -0
- package/dist/marginfi-sdk/accounts/marginfiAccount.js +76 -0
- package/dist/marginfi-sdk/accounts/marginfiGroup.d.ts +35 -0
- package/dist/marginfi-sdk/accounts/marginfiGroup.d.ts.map +1 -0
- package/dist/marginfi-sdk/accounts/marginfiGroup.js +71 -0
- package/dist/marginfi-sdk/errors/index.d.ts +9 -0
- package/dist/marginfi-sdk/errors/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/errors/index.js +24 -0
- package/dist/marginfi-sdk/errors/marginfi.d.ts +283 -0
- package/dist/marginfi-sdk/errors/marginfi.d.ts.map +1 -0
- package/dist/marginfi-sdk/errors/marginfi.js +515 -0
- package/dist/marginfi-sdk/index.d.ts +14 -0
- package/dist/marginfi-sdk/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/index.js +29 -0
- package/dist/marginfi-sdk/instructions/index.d.ts +32 -0
- package/dist/marginfi-sdk/instructions/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/index.js +47 -0
- package/dist/marginfi-sdk/instructions/lendingAccountBorrow.d.ts +30 -0
- package/dist/marginfi-sdk/instructions/lendingAccountBorrow.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountBorrow.js +83 -0
- package/dist/marginfi-sdk/instructions/lendingAccountCloseBalance.d.ts +22 -0
- package/dist/marginfi-sdk/instructions/lendingAccountCloseBalance.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountCloseBalance.js +53 -0
- package/dist/marginfi-sdk/instructions/lendingAccountDeposit.d.ts +29 -0
- package/dist/marginfi-sdk/instructions/lendingAccountDeposit.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountDeposit.js +81 -0
- package/dist/marginfi-sdk/instructions/lendingAccountEndFlashloan.d.ts +20 -0
- package/dist/marginfi-sdk/instructions/lendingAccountEndFlashloan.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountEndFlashloan.js +50 -0
- package/dist/marginfi-sdk/instructions/lendingAccountLiquidate.d.ts +32 -0
- package/dist/marginfi-sdk/instructions/lendingAccountLiquidate.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountLiquidate.js +100 -0
- package/dist/marginfi-sdk/instructions/lendingAccountRepay.d.ts +31 -0
- package/dist/marginfi-sdk/instructions/lendingAccountRepay.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountRepay.js +82 -0
- package/dist/marginfi-sdk/instructions/lendingAccountSettleEmissions.d.ts +20 -0
- package/dist/marginfi-sdk/instructions/lendingAccountSettleEmissions.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountSettleEmissions.js +46 -0
- package/dist/marginfi-sdk/instructions/lendingAccountStartFlashloan.d.ts +25 -0
- package/dist/marginfi-sdk/instructions/lendingAccountStartFlashloan.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountStartFlashloan.js +62 -0
- package/dist/marginfi-sdk/instructions/lendingAccountWithdraw.d.ts +32 -0
- package/dist/marginfi-sdk/instructions/lendingAccountWithdraw.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountWithdraw.js +87 -0
- package/dist/marginfi-sdk/instructions/lendingAccountWithdrawEmissions.d.ts +27 -0
- package/dist/marginfi-sdk/instructions/lendingAccountWithdrawEmissions.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingAccountWithdrawEmissions.js +86 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAccrueBankInterest.d.ts +20 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAccrueBankInterest.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAccrueBankInterest.js +46 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAddBank.d.ts +37 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAddBank.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAddBank.js +127 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAddBankWithSeed.d.ts +39 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAddBankWithSeed.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolAddBankWithSeed.js +128 -0
- package/dist/marginfi-sdk/instructions/lendingPoolCollectBankFees.d.ts +25 -0
- package/dist/marginfi-sdk/instructions/lendingPoolCollectBankFees.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolCollectBankFees.js +76 -0
- package/dist/marginfi-sdk/instructions/lendingPoolConfigureBank.d.ts +46 -0
- package/dist/marginfi-sdk/instructions/lendingPoolConfigureBank.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolConfigureBank.js +67 -0
- package/dist/marginfi-sdk/instructions/lendingPoolHandleBankruptcy.d.ts +26 -0
- package/dist/marginfi-sdk/instructions/lendingPoolHandleBankruptcy.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolHandleBankruptcy.js +81 -0
- package/dist/marginfi-sdk/instructions/lendingPoolSetupEmissions.d.ts +35 -0
- package/dist/marginfi-sdk/instructions/lendingPoolSetupEmissions.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolSetupEmissions.js +97 -0
- package/dist/marginfi-sdk/instructions/lendingPoolUpdateEmissionsParameters.d.ts +33 -0
- package/dist/marginfi-sdk/instructions/lendingPoolUpdateEmissionsParameters.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/lendingPoolUpdateEmissionsParameters.js +85 -0
- package/dist/marginfi-sdk/instructions/marginfiAccountInitialize.d.ts +23 -0
- package/dist/marginfi-sdk/instructions/marginfiAccountInitialize.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/marginfiAccountInitialize.js +76 -0
- package/dist/marginfi-sdk/instructions/marginfiGroupConfigure.d.ts +24 -0
- package/dist/marginfi-sdk/instructions/marginfiGroupConfigure.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/marginfiGroupConfigure.js +52 -0
- package/dist/marginfi-sdk/instructions/marginfiGroupInitialize.d.ts +21 -0
- package/dist/marginfi-sdk/instructions/marginfiGroupInitialize.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/marginfiGroupInitialize.js +57 -0
- package/dist/marginfi-sdk/instructions/setAccountFlag.d.ts +26 -0
- package/dist/marginfi-sdk/instructions/setAccountFlag.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/setAccountFlag.js +60 -0
- package/dist/marginfi-sdk/instructions/setNewAccountAuthority.d.ts +23 -0
- package/dist/marginfi-sdk/instructions/setNewAccountAuthority.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/setNewAccountAuthority.js +69 -0
- package/dist/marginfi-sdk/instructions/unsetAccountFlag.d.ts +26 -0
- package/dist/marginfi-sdk/instructions/unsetAccountFlag.d.ts.map +1 -0
- package/dist/marginfi-sdk/instructions/unsetAccountFlag.js +57 -0
- package/dist/marginfi-sdk/programs/index.d.ts +9 -0
- package/dist/marginfi-sdk/programs/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/programs/index.js +24 -0
- package/dist/marginfi-sdk/programs/marginfi.d.ts +13 -0
- package/dist/marginfi-sdk/programs/marginfi.d.ts.map +1 -0
- package/dist/marginfi-sdk/programs/marginfi.js +36 -0
- package/dist/marginfi-sdk/shared/index.d.ts +54 -0
- package/dist/marginfi-sdk/shared/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/shared/index.js +70 -0
- package/dist/marginfi-sdk/types/accountEventHeader.d.ts +23 -0
- package/dist/marginfi-sdk/types/accountEventHeader.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/accountEventHeader.js +20 -0
- package/dist/marginfi-sdk/types/balance.d.ts +32 -0
- package/dist/marginfi-sdk/types/balance.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/balance.js +25 -0
- package/dist/marginfi-sdk/types/balanceDecreaseType.d.ts +17 -0
- package/dist/marginfi-sdk/types/balanceDecreaseType.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/balanceDecreaseType.js +24 -0
- package/dist/marginfi-sdk/types/balanceIncreaseType.d.ts +17 -0
- package/dist/marginfi-sdk/types/balanceIncreaseType.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/balanceIncreaseType.js +24 -0
- package/dist/marginfi-sdk/types/balanceSide.d.ts +15 -0
- package/dist/marginfi-sdk/types/balanceSide.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/balanceSide.js +22 -0
- package/dist/marginfi-sdk/types/bankConfig.d.ts +67 -0
- package/dist/marginfi-sdk/types/bankConfig.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/bankConfig.js +32 -0
- package/dist/marginfi-sdk/types/bankConfigCompact.d.ts +65 -0
- package/dist/marginfi-sdk/types/bankConfigCompact.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/bankConfigCompact.js +31 -0
- package/dist/marginfi-sdk/types/bankOperationalState.d.ts +16 -0
- package/dist/marginfi-sdk/types/bankOperationalState.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/bankOperationalState.js +23 -0
- package/dist/marginfi-sdk/types/bankVaultType.d.ts +16 -0
- package/dist/marginfi-sdk/types/bankVaultType.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/bankVaultType.js +23 -0
- package/dist/marginfi-sdk/types/groupEventHeader.d.ts +19 -0
- package/dist/marginfi-sdk/types/groupEventHeader.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/groupEventHeader.js +18 -0
- package/dist/marginfi-sdk/types/index.d.ts +31 -0
- package/dist/marginfi-sdk/types/index.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/index.js +46 -0
- package/dist/marginfi-sdk/types/interestRateConfig.d.ts +31 -0
- package/dist/marginfi-sdk/types/interestRateConfig.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/interestRateConfig.js +25 -0
- package/dist/marginfi-sdk/types/interestRateConfigCompact.d.ts +29 -0
- package/dist/marginfi-sdk/types/interestRateConfigCompact.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/interestRateConfigCompact.js +24 -0
- package/dist/marginfi-sdk/types/interestRateConfigOpt.d.ts +30 -0
- package/dist/marginfi-sdk/types/interestRateConfigOpt.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/interestRateConfigOpt.js +24 -0
- package/dist/marginfi-sdk/types/lendingAccount.d.ts +19 -0
- package/dist/marginfi-sdk/types/lendingAccount.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/lendingAccount.js +19 -0
- package/dist/marginfi-sdk/types/liquidationBalances.d.ts +17 -0
- package/dist/marginfi-sdk/types/liquidationBalances.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/liquidationBalances.js +20 -0
- package/dist/marginfi-sdk/types/oracleConfig.d.ts +20 -0
- package/dist/marginfi-sdk/types/oracleConfig.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/oracleConfig.js +19 -0
- package/dist/marginfi-sdk/types/oraclePriceType.d.ts +15 -0
- package/dist/marginfi-sdk/types/oraclePriceType.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/oraclePriceType.js +22 -0
- package/dist/marginfi-sdk/types/oracleSetup.d.ts +17 -0
- package/dist/marginfi-sdk/types/oracleSetup.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/oracleSetup.js +24 -0
- package/dist/marginfi-sdk/types/priceBias.d.ts +15 -0
- package/dist/marginfi-sdk/types/priceBias.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/priceBias.js +22 -0
- package/dist/marginfi-sdk/types/requirementType.d.ts +16 -0
- package/dist/marginfi-sdk/types/requirementType.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/requirementType.js +23 -0
- package/dist/marginfi-sdk/types/riskRequirementType.d.ts +16 -0
- package/dist/marginfi-sdk/types/riskRequirementType.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/riskRequirementType.js +23 -0
- package/dist/marginfi-sdk/types/riskTier.d.ts +15 -0
- package/dist/marginfi-sdk/types/riskTier.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/riskTier.js +22 -0
- package/dist/marginfi-sdk/types/wrappedI80F48.d.ts +16 -0
- package/dist/marginfi-sdk/types/wrappedI80F48.d.ts.map +1 -0
- package/dist/marginfi-sdk/types/wrappedI80F48.js +17 -0
- package/dist/transactions/index.d.ts +3 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +18 -0
- package/dist/transactions/transactionUtils.d.ts +12 -0
- package/dist/transactions/transactionUtils.d.ts.map +1 -0
- package/dist/transactions/transactionUtils.js +262 -0
- package/dist/transactions/transactionsManager.d.ts +42 -0
- package/dist/transactions/transactionsManager.d.ts.map +1 -0
- package/dist/transactions/transactionsManager.js +246 -0
- package/dist/types/accounts.d.ts +8 -0
- package/dist/types/accounts.d.ts.map +1 -0
- package/dist/types/accounts.js +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +17 -0
- package/dist/utils/accountUtils.d.ts +11 -0
- package/dist/utils/accountUtils.d.ts.map +1 -0
- package/dist/utils/accountUtils.js +60 -0
- package/dist/utils/deleteme.d.ts +2 -0
- package/dist/utils/deleteme.d.ts.map +1 -0
- package/dist/utils/deleteme.js +21 -0
- package/dist/utils/generalUtils.d.ts +11 -0
- package/dist/utils/generalUtils.d.ts.map +1 -0
- package/dist/utils/generalUtils.js +107 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +24 -0
- package/dist/utils/jitoUtils.d.ts +15 -0
- package/dist/utils/jitoUtils.d.ts.map +1 -0
- package/dist/utils/jitoUtils.js +108 -0
- package/dist/utils/jupiterUtils.d.ts +21 -0
- package/dist/utils/jupiterUtils.d.ts.map +1 -0
- package/dist/utils/jupiterUtils.js +61 -0
- package/dist/utils/local/shared.d.ts +3 -0
- package/dist/utils/local/shared.d.ts.map +1 -0
- package/dist/utils/local/shared.js +63 -0
- package/dist/utils/local/updateMarginfiLUT.d.ts +2 -0
- package/dist/utils/local/updateMarginfiLUT.d.ts.map +1 -0
- package/dist/utils/local/updateMarginfiLUT.js +22 -0
- package/dist/utils/local/updateSolautoLUT.d.ts +2 -0
- package/dist/utils/local/updateSolautoLUT.d.ts.map +1 -0
- package/dist/utils/local/updateSolautoLUT.js +13 -0
- package/dist/utils/marginfiUtils.d.ts +14 -0
- package/dist/utils/marginfiUtils.d.ts.map +1 -0
- package/dist/utils/marginfiUtils.js +201 -0
- package/dist/utils/numberUtils.d.ts +9 -0
- package/dist/utils/numberUtils.d.ts.map +1 -0
- package/dist/utils/numberUtils.js +62 -0
- package/dist/utils/solanaUtils.d.ts +18 -0
- package/dist/utils/solanaUtils.d.ts.map +1 -0
- package/dist/utils/solanaUtils.js +183 -0
- package/dist/utils/solauto/generalUtils.d.ts +51 -0
- package/dist/utils/solauto/generalUtils.d.ts.map +1 -0
- package/dist/utils/solauto/generalUtils.js +271 -0
- package/dist/utils/solauto/index.d.ts +3 -0
- package/dist/utils/solauto/index.d.ts.map +1 -0
- package/dist/utils/solauto/index.js +18 -0
- package/dist/utils/solauto/rebalanceUtils.d.ts +17 -0
- package/dist/utils/solauto/rebalanceUtils.d.ts.map +1 -0
- package/dist/utils/solauto/rebalanceUtils.js +199 -0
- package/package.json +37 -0
- package/src/clients/index.ts +1 -0
- package/src/clients/solautoClient.ts +684 -0
- package/src/clients/solautoMarginfiClient.ts +496 -0
- package/src/constants/README.md +9 -0
- package/src/constants/generalAccounts.ts +8 -0
- package/src/constants/index.ts +5 -0
- package/src/constants/marginfiAccounts.ts +24 -0
- package/src/constants/pythConstants.ts +10 -0
- package/src/constants/solautoConstants.ts +54 -0
- package/src/constants/tokenConstants.ts +9 -0
- package/src/generated/accounts/index.ts +10 -0
- package/src/generated/accounts/referralState.ts +159 -0
- package/src/generated/accounts/solautoPosition.ts +205 -0
- package/src/generated/errors/index.ts +9 -0
- package/src/generated/errors/solauto.ts +228 -0
- package/src/generated/index.ts +14 -0
- package/src/generated/instructions/cancelDCA.ts +161 -0
- package/src/generated/instructions/claimReferralFees.ts +159 -0
- package/src/generated/instructions/closePosition.ts +176 -0
- package/src/generated/instructions/convertReferralFees.ts +172 -0
- package/src/generated/instructions/index.ts +18 -0
- package/src/generated/instructions/marginfiOpenPosition.ts +275 -0
- package/src/generated/instructions/marginfiProtocolInteraction.ts +257 -0
- package/src/generated/instructions/marginfiRebalance.ts +274 -0
- package/src/generated/instructions/marginfiRefreshData.ts +147 -0
- package/src/generated/instructions/updatePosition.ts +173 -0
- package/src/generated/instructions/updateReferralStates.ts +166 -0
- package/src/generated/programs/index.ts +9 -0
- package/src/generated/programs/solauto.ts +52 -0
- package/src/generated/shared/index.ts +117 -0
- package/src/generated/types/automationSettings.ts +52 -0
- package/src/generated/types/automationSettingsInp.ts +43 -0
- package/src/generated/types/dCASettings.ts +45 -0
- package/src/generated/types/dCASettingsInp.ts +37 -0
- package/src/generated/types/feeType.ts +23 -0
- package/src/generated/types/index.ts +26 -0
- package/src/generated/types/lendingPlatform.ts +26 -0
- package/src/generated/types/podBool.ts +19 -0
- package/src/generated/types/positionData.ts +69 -0
- package/src/generated/types/positionState.ts +72 -0
- package/src/generated/types/positionTokenUsage.ts +67 -0
- package/src/generated/types/rebalanceData.ts +60 -0
- package/src/generated/types/solautoAction.ts +101 -0
- package/src/generated/types/solautoRebalanceType.ts +27 -0
- package/src/generated/types/solautoSettingsParameters.ts +62 -0
- package/src/generated/types/solautoSettingsParametersInp.ts +58 -0
- package/src/generated/types/tokenAmount.ts +29 -0
- package/src/generated/types/tokenBalanceAmount.ts +67 -0
- package/src/generated/types/updatePositionData.ts +49 -0
- package/src/index.ts +6 -0
- package/src/marginfi-sdk/accounts/bank.ts +311 -0
- package/src/marginfi-sdk/accounts/index.ts +11 -0
- package/src/marginfi-sdk/accounts/marginfiAccount.ts +195 -0
- package/src/marginfi-sdk/accounts/marginfiGroup.ts +164 -0
- package/src/marginfi-sdk/errors/index.ts +9 -0
- package/src/marginfi-sdk/errors/marginfi.ts +650 -0
- package/src/marginfi-sdk/index.ts +14 -0
- package/src/marginfi-sdk/instructions/index.ts +32 -0
- package/src/marginfi-sdk/instructions/lendingAccountBorrow.ts +167 -0
- package/src/marginfi-sdk/instructions/lendingAccountCloseBalance.ts +118 -0
- package/src/marginfi-sdk/instructions/lendingAccountDeposit.ts +164 -0
- package/src/marginfi-sdk/instructions/lendingAccountEndFlashloan.ts +113 -0
- package/src/marginfi-sdk/instructions/lendingAccountLiquidate.ts +186 -0
- package/src/marginfi-sdk/instructions/lendingAccountRepay.ts +171 -0
- package/src/marginfi-sdk/instructions/lendingAccountSettleEmissions.ts +108 -0
- package/src/marginfi-sdk/instructions/lendingAccountStartFlashloan.ts +138 -0
- package/src/marginfi-sdk/instructions/lendingAccountWithdraw.ts +177 -0
- package/src/marginfi-sdk/instructions/lendingAccountWithdrawEmissions.ts +160 -0
- package/src/marginfi-sdk/instructions/lendingPoolAccrueBankInterest.ts +108 -0
- package/src/marginfi-sdk/instructions/lendingPoolAddBank.ts +226 -0
- package/src/marginfi-sdk/instructions/lendingPoolAddBankWithSeed.ts +231 -0
- package/src/marginfi-sdk/instructions/lendingPoolCollectBankFees.ts +147 -0
- package/src/marginfi-sdk/instructions/lendingPoolConfigureBank.ts +181 -0
- package/src/marginfi-sdk/instructions/lendingPoolHandleBankruptcy.ts +154 -0
- package/src/marginfi-sdk/instructions/lendingPoolSetupEmissions.ts +190 -0
- package/src/marginfi-sdk/instructions/lendingPoolUpdateEmissionsParameters.ts +176 -0
- package/src/marginfi-sdk/instructions/marginfiAccountInitialize.ts +146 -0
- package/src/marginfi-sdk/instructions/marginfiGroupConfigure.ts +129 -0
- package/src/marginfi-sdk/instructions/marginfiGroupInitialize.ts +126 -0
- package/src/marginfi-sdk/instructions/setAccountFlag.ts +132 -0
- package/src/marginfi-sdk/instructions/setNewAccountAuthority.ts +137 -0
- package/src/marginfi-sdk/instructions/unsetAccountFlag.ts +130 -0
- package/src/marginfi-sdk/programs/index.ts +9 -0
- package/src/marginfi-sdk/programs/marginfi.ts +52 -0
- package/src/marginfi-sdk/shared/index.ts +117 -0
- package/src/marginfi-sdk/types/accountEventHeader.ts +44 -0
- package/src/marginfi-sdk/types/balance.ts +61 -0
- package/src/marginfi-sdk/types/balanceDecreaseType.ts +27 -0
- package/src/marginfi-sdk/types/balanceIncreaseType.ts +27 -0
- package/src/marginfi-sdk/types/balanceSide.ts +25 -0
- package/src/marginfi-sdk/types/bankConfig.ts +117 -0
- package/src/marginfi-sdk/types/bankConfigCompact.ts +114 -0
- package/src/marginfi-sdk/types/bankOperationalState.ts +26 -0
- package/src/marginfi-sdk/types/bankVaultType.ts +26 -0
- package/src/marginfi-sdk/types/groupEventHeader.ts +38 -0
- package/src/marginfi-sdk/types/index.ts +31 -0
- package/src/marginfi-sdk/types/interestRateConfig.ts +60 -0
- package/src/marginfi-sdk/types/interestRateConfigCompact.ts +52 -0
- package/src/marginfi-sdk/types/interestRateConfigOpt.ts +57 -0
- package/src/marginfi-sdk/types/lendingAccount.ts +38 -0
- package/src/marginfi-sdk/types/liquidationBalances.ts +33 -0
- package/src/marginfi-sdk/types/oracleConfig.ts +36 -0
- package/src/marginfi-sdk/types/oraclePriceType.ts +25 -0
- package/src/marginfi-sdk/types/oracleSetup.ts +27 -0
- package/src/marginfi-sdk/types/priceBias.ts +22 -0
- package/src/marginfi-sdk/types/requirementType.ts +26 -0
- package/src/marginfi-sdk/types/riskRequirementType.ts +26 -0
- package/src/marginfi-sdk/types/riskTier.ts +22 -0
- package/src/marginfi-sdk/types/wrappedI80F48.ts +22 -0
- package/src/transactions/index.ts +2 -0
- package/src/transactions/transactionUtils.ts +518 -0
- package/src/transactions/transactionsManager.ts +344 -0
- package/src/types/accounts.ts +7 -0
- package/src/types/index.ts +1 -0
- package/src/utils/accountUtils.ts +92 -0
- package/src/utils/deleteme.ts +40 -0
- package/src/utils/generalUtils.ts +123 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/jitoUtils.ts +192 -0
- package/src/utils/jupiterUtils.ts +114 -0
- package/src/utils/local/shared.ts +85 -0
- package/src/utils/local/updateMarginfiLUT.ts +33 -0
- package/src/utils/local/updateSolautoLUT.ts +15 -0
- package/src/utils/marginfiUtils.ts +383 -0
- package/src/utils/numberUtils.ts +77 -0
- package/src/utils/solanaUtils.ts +333 -0
- package/src/utils/solauto/generalUtils.ts +371 -0
- package/src/utils/solauto/index.ts +2 -0
- package/src/utils/solauto/rebalanceUtils.ts +359 -0
- package/tests/shared.ts +15 -0
- package/tests/transactions/solautoMarginfi.ts +144 -0
- package/tests/unit/lookupTables.ts +40 -0
- package/tests/unit/rebalanceCalculations.ts +432 -0
- package/tsconfig.json +22 -0
@@ -0,0 +1,126 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
import {
|
10
|
+
Context,
|
11
|
+
Pda,
|
12
|
+
PublicKey,
|
13
|
+
Signer,
|
14
|
+
TransactionBuilder,
|
15
|
+
transactionBuilder,
|
16
|
+
} from '@metaplex-foundation/umi';
|
17
|
+
import {
|
18
|
+
Serializer,
|
19
|
+
array,
|
20
|
+
mapSerializer,
|
21
|
+
struct,
|
22
|
+
u8,
|
23
|
+
} from '@metaplex-foundation/umi/serializers';
|
24
|
+
import {
|
25
|
+
ResolvedAccount,
|
26
|
+
ResolvedAccountsWithIndices,
|
27
|
+
getAccountMetasAndSigners,
|
28
|
+
} from '../shared';
|
29
|
+
|
30
|
+
// Accounts.
|
31
|
+
export type MarginfiGroupInitializeInstructionAccounts = {
|
32
|
+
marginfiGroup: Signer;
|
33
|
+
admin: Signer;
|
34
|
+
systemProgram?: PublicKey | Pda;
|
35
|
+
};
|
36
|
+
|
37
|
+
// Data.
|
38
|
+
export type MarginfiGroupInitializeInstructionData = {
|
39
|
+
discriminator: Array<number>;
|
40
|
+
};
|
41
|
+
|
42
|
+
export type MarginfiGroupInitializeInstructionDataArgs = {};
|
43
|
+
|
44
|
+
export function getMarginfiGroupInitializeInstructionDataSerializer(): Serializer<
|
45
|
+
MarginfiGroupInitializeInstructionDataArgs,
|
46
|
+
MarginfiGroupInitializeInstructionData
|
47
|
+
> {
|
48
|
+
return mapSerializer<
|
49
|
+
MarginfiGroupInitializeInstructionDataArgs,
|
50
|
+
any,
|
51
|
+
MarginfiGroupInitializeInstructionData
|
52
|
+
>(
|
53
|
+
struct<MarginfiGroupInitializeInstructionData>(
|
54
|
+
[['discriminator', array(u8(), { size: 8 })]],
|
55
|
+
{ description: 'MarginfiGroupInitializeInstructionData' }
|
56
|
+
),
|
57
|
+
(value) => ({ ...value, discriminator: [255, 67, 67, 26, 94, 31, 34, 20] })
|
58
|
+
) as Serializer<
|
59
|
+
MarginfiGroupInitializeInstructionDataArgs,
|
60
|
+
MarginfiGroupInitializeInstructionData
|
61
|
+
>;
|
62
|
+
}
|
63
|
+
|
64
|
+
// Instruction.
|
65
|
+
export function marginfiGroupInitialize(
|
66
|
+
context: Pick<Context, 'programs'>,
|
67
|
+
input: MarginfiGroupInitializeInstructionAccounts
|
68
|
+
): TransactionBuilder {
|
69
|
+
// Program ID.
|
70
|
+
const programId = context.programs.getPublicKey(
|
71
|
+
'marginfi',
|
72
|
+
'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA'
|
73
|
+
);
|
74
|
+
|
75
|
+
// Accounts.
|
76
|
+
const resolvedAccounts = {
|
77
|
+
marginfiGroup: {
|
78
|
+
index: 0,
|
79
|
+
isWritable: true as boolean,
|
80
|
+
value: input.marginfiGroup ?? null,
|
81
|
+
},
|
82
|
+
admin: {
|
83
|
+
index: 1,
|
84
|
+
isWritable: true as boolean,
|
85
|
+
value: input.admin ?? null,
|
86
|
+
},
|
87
|
+
systemProgram: {
|
88
|
+
index: 2,
|
89
|
+
isWritable: false as boolean,
|
90
|
+
value: input.systemProgram ?? null,
|
91
|
+
},
|
92
|
+
} satisfies ResolvedAccountsWithIndices;
|
93
|
+
|
94
|
+
// Default values.
|
95
|
+
if (!resolvedAccounts.systemProgram.value) {
|
96
|
+
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
|
97
|
+
'splSystem',
|
98
|
+
'11111111111111111111111111111111'
|
99
|
+
);
|
100
|
+
resolvedAccounts.systemProgram.isWritable = false;
|
101
|
+
}
|
102
|
+
|
103
|
+
// Accounts in order.
|
104
|
+
const orderedAccounts: ResolvedAccount[] = Object.values(
|
105
|
+
resolvedAccounts
|
106
|
+
).sort((a, b) => a.index - b.index);
|
107
|
+
|
108
|
+
// Keys and Signers.
|
109
|
+
const [keys, signers] = getAccountMetasAndSigners(
|
110
|
+
orderedAccounts,
|
111
|
+
'programId',
|
112
|
+
programId
|
113
|
+
);
|
114
|
+
|
115
|
+
// Data.
|
116
|
+
const data = getMarginfiGroupInitializeInstructionDataSerializer().serialize(
|
117
|
+
{}
|
118
|
+
);
|
119
|
+
|
120
|
+
// Bytes Created On Chain.
|
121
|
+
const bytesCreatedOnChain = 0;
|
122
|
+
|
123
|
+
return transactionBuilder([
|
124
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
|
125
|
+
]);
|
126
|
+
}
|
@@ -0,0 +1,132 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
import {
|
10
|
+
Context,
|
11
|
+
Pda,
|
12
|
+
PublicKey,
|
13
|
+
Signer,
|
14
|
+
TransactionBuilder,
|
15
|
+
transactionBuilder,
|
16
|
+
} from '@metaplex-foundation/umi';
|
17
|
+
import {
|
18
|
+
Serializer,
|
19
|
+
array,
|
20
|
+
mapSerializer,
|
21
|
+
struct,
|
22
|
+
u64,
|
23
|
+
u8,
|
24
|
+
} from '@metaplex-foundation/umi/serializers';
|
25
|
+
import {
|
26
|
+
ResolvedAccount,
|
27
|
+
ResolvedAccountsWithIndices,
|
28
|
+
getAccountMetasAndSigners,
|
29
|
+
} from '../shared';
|
30
|
+
|
31
|
+
// Accounts.
|
32
|
+
export type SetAccountFlagInstructionAccounts = {
|
33
|
+
marginfiGroup: PublicKey | Pda;
|
34
|
+
marginfiAccount: PublicKey | Pda;
|
35
|
+
/** Admin only */
|
36
|
+
admin: Signer;
|
37
|
+
};
|
38
|
+
|
39
|
+
// Data.
|
40
|
+
export type SetAccountFlagInstructionData = {
|
41
|
+
discriminator: Array<number>;
|
42
|
+
flag: bigint;
|
43
|
+
};
|
44
|
+
|
45
|
+
export type SetAccountFlagInstructionDataArgs = { flag: number | bigint };
|
46
|
+
|
47
|
+
export function getSetAccountFlagInstructionDataSerializer(): Serializer<
|
48
|
+
SetAccountFlagInstructionDataArgs,
|
49
|
+
SetAccountFlagInstructionData
|
50
|
+
> {
|
51
|
+
return mapSerializer<
|
52
|
+
SetAccountFlagInstructionDataArgs,
|
53
|
+
any,
|
54
|
+
SetAccountFlagInstructionData
|
55
|
+
>(
|
56
|
+
struct<SetAccountFlagInstructionData>(
|
57
|
+
[
|
58
|
+
['discriminator', array(u8(), { size: 8 })],
|
59
|
+
['flag', u64()],
|
60
|
+
],
|
61
|
+
{ description: 'SetAccountFlagInstructionData' }
|
62
|
+
),
|
63
|
+
(value) => ({
|
64
|
+
...value,
|
65
|
+
discriminator: [56, 238, 18, 207, 193, 82, 138, 174],
|
66
|
+
})
|
67
|
+
) as Serializer<
|
68
|
+
SetAccountFlagInstructionDataArgs,
|
69
|
+
SetAccountFlagInstructionData
|
70
|
+
>;
|
71
|
+
}
|
72
|
+
|
73
|
+
// Args.
|
74
|
+
export type SetAccountFlagInstructionArgs = SetAccountFlagInstructionDataArgs;
|
75
|
+
|
76
|
+
// Instruction.
|
77
|
+
export function setAccountFlag(
|
78
|
+
context: Pick<Context, 'programs'>,
|
79
|
+
input: SetAccountFlagInstructionAccounts & SetAccountFlagInstructionArgs
|
80
|
+
): TransactionBuilder {
|
81
|
+
// Program ID.
|
82
|
+
const programId = context.programs.getPublicKey(
|
83
|
+
'marginfi',
|
84
|
+
'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA'
|
85
|
+
);
|
86
|
+
|
87
|
+
// Accounts.
|
88
|
+
const resolvedAccounts = {
|
89
|
+
marginfiGroup: {
|
90
|
+
index: 0,
|
91
|
+
isWritable: false as boolean,
|
92
|
+
value: input.marginfiGroup ?? null,
|
93
|
+
},
|
94
|
+
marginfiAccount: {
|
95
|
+
index: 1,
|
96
|
+
isWritable: true as boolean,
|
97
|
+
value: input.marginfiAccount ?? null,
|
98
|
+
},
|
99
|
+
admin: {
|
100
|
+
index: 2,
|
101
|
+
isWritable: false as boolean,
|
102
|
+
value: input.admin ?? null,
|
103
|
+
},
|
104
|
+
} satisfies ResolvedAccountsWithIndices;
|
105
|
+
|
106
|
+
// Arguments.
|
107
|
+
const resolvedArgs: SetAccountFlagInstructionArgs = { ...input };
|
108
|
+
|
109
|
+
// Accounts in order.
|
110
|
+
const orderedAccounts: ResolvedAccount[] = Object.values(
|
111
|
+
resolvedAccounts
|
112
|
+
).sort((a, b) => a.index - b.index);
|
113
|
+
|
114
|
+
// Keys and Signers.
|
115
|
+
const [keys, signers] = getAccountMetasAndSigners(
|
116
|
+
orderedAccounts,
|
117
|
+
'programId',
|
118
|
+
programId
|
119
|
+
);
|
120
|
+
|
121
|
+
// Data.
|
122
|
+
const data = getSetAccountFlagInstructionDataSerializer().serialize(
|
123
|
+
resolvedArgs as SetAccountFlagInstructionDataArgs
|
124
|
+
);
|
125
|
+
|
126
|
+
// Bytes Created On Chain.
|
127
|
+
const bytesCreatedOnChain = 0;
|
128
|
+
|
129
|
+
return transactionBuilder([
|
130
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
|
131
|
+
]);
|
132
|
+
}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
import {
|
10
|
+
Context,
|
11
|
+
Pda,
|
12
|
+
PublicKey,
|
13
|
+
Signer,
|
14
|
+
TransactionBuilder,
|
15
|
+
transactionBuilder,
|
16
|
+
} from '@metaplex-foundation/umi';
|
17
|
+
import {
|
18
|
+
Serializer,
|
19
|
+
array,
|
20
|
+
mapSerializer,
|
21
|
+
struct,
|
22
|
+
u8,
|
23
|
+
} from '@metaplex-foundation/umi/serializers';
|
24
|
+
import {
|
25
|
+
ResolvedAccount,
|
26
|
+
ResolvedAccountsWithIndices,
|
27
|
+
getAccountMetasAndSigners,
|
28
|
+
} from '../shared';
|
29
|
+
|
30
|
+
// Accounts.
|
31
|
+
export type SetNewAccountAuthorityInstructionAccounts = {
|
32
|
+
marginfiAccount: PublicKey | Pda;
|
33
|
+
marginfiGroup: PublicKey | Pda;
|
34
|
+
signer: Signer;
|
35
|
+
newAuthority: PublicKey | Pda;
|
36
|
+
feePayer?: Signer;
|
37
|
+
};
|
38
|
+
|
39
|
+
// Data.
|
40
|
+
export type SetNewAccountAuthorityInstructionData = {
|
41
|
+
discriminator: Array<number>;
|
42
|
+
};
|
43
|
+
|
44
|
+
export type SetNewAccountAuthorityInstructionDataArgs = {};
|
45
|
+
|
46
|
+
export function getSetNewAccountAuthorityInstructionDataSerializer(): Serializer<
|
47
|
+
SetNewAccountAuthorityInstructionDataArgs,
|
48
|
+
SetNewAccountAuthorityInstructionData
|
49
|
+
> {
|
50
|
+
return mapSerializer<
|
51
|
+
SetNewAccountAuthorityInstructionDataArgs,
|
52
|
+
any,
|
53
|
+
SetNewAccountAuthorityInstructionData
|
54
|
+
>(
|
55
|
+
struct<SetNewAccountAuthorityInstructionData>(
|
56
|
+
[['discriminator', array(u8(), { size: 8 })]],
|
57
|
+
{ description: 'SetNewAccountAuthorityInstructionData' }
|
58
|
+
),
|
59
|
+
(value) => ({
|
60
|
+
...value,
|
61
|
+
discriminator: [153, 162, 50, 84, 182, 201, 74, 179],
|
62
|
+
})
|
63
|
+
) as Serializer<
|
64
|
+
SetNewAccountAuthorityInstructionDataArgs,
|
65
|
+
SetNewAccountAuthorityInstructionData
|
66
|
+
>;
|
67
|
+
}
|
68
|
+
|
69
|
+
// Instruction.
|
70
|
+
export function setNewAccountAuthority(
|
71
|
+
context: Pick<Context, 'payer' | 'programs'>,
|
72
|
+
input: SetNewAccountAuthorityInstructionAccounts
|
73
|
+
): TransactionBuilder {
|
74
|
+
// Program ID.
|
75
|
+
const programId = context.programs.getPublicKey(
|
76
|
+
'marginfi',
|
77
|
+
'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA'
|
78
|
+
);
|
79
|
+
|
80
|
+
// Accounts.
|
81
|
+
const resolvedAccounts = {
|
82
|
+
marginfiAccount: {
|
83
|
+
index: 0,
|
84
|
+
isWritable: true as boolean,
|
85
|
+
value: input.marginfiAccount ?? null,
|
86
|
+
},
|
87
|
+
marginfiGroup: {
|
88
|
+
index: 1,
|
89
|
+
isWritable: false as boolean,
|
90
|
+
value: input.marginfiGroup ?? null,
|
91
|
+
},
|
92
|
+
signer: {
|
93
|
+
index: 2,
|
94
|
+
isWritable: false as boolean,
|
95
|
+
value: input.signer ?? null,
|
96
|
+
},
|
97
|
+
newAuthority: {
|
98
|
+
index: 3,
|
99
|
+
isWritable: false as boolean,
|
100
|
+
value: input.newAuthority ?? null,
|
101
|
+
},
|
102
|
+
feePayer: {
|
103
|
+
index: 4,
|
104
|
+
isWritable: true as boolean,
|
105
|
+
value: input.feePayer ?? null,
|
106
|
+
},
|
107
|
+
} satisfies ResolvedAccountsWithIndices;
|
108
|
+
|
109
|
+
// Default values.
|
110
|
+
if (!resolvedAccounts.feePayer.value) {
|
111
|
+
resolvedAccounts.feePayer.value = context.payer;
|
112
|
+
}
|
113
|
+
|
114
|
+
// Accounts in order.
|
115
|
+
const orderedAccounts: ResolvedAccount[] = Object.values(
|
116
|
+
resolvedAccounts
|
117
|
+
).sort((a, b) => a.index - b.index);
|
118
|
+
|
119
|
+
// Keys and Signers.
|
120
|
+
const [keys, signers] = getAccountMetasAndSigners(
|
121
|
+
orderedAccounts,
|
122
|
+
'programId',
|
123
|
+
programId
|
124
|
+
);
|
125
|
+
|
126
|
+
// Data.
|
127
|
+
const data = getSetNewAccountAuthorityInstructionDataSerializer().serialize(
|
128
|
+
{}
|
129
|
+
);
|
130
|
+
|
131
|
+
// Bytes Created On Chain.
|
132
|
+
const bytesCreatedOnChain = 0;
|
133
|
+
|
134
|
+
return transactionBuilder([
|
135
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
|
136
|
+
]);
|
137
|
+
}
|
@@ -0,0 +1,130 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
import {
|
10
|
+
Context,
|
11
|
+
Pda,
|
12
|
+
PublicKey,
|
13
|
+
Signer,
|
14
|
+
TransactionBuilder,
|
15
|
+
transactionBuilder,
|
16
|
+
} from '@metaplex-foundation/umi';
|
17
|
+
import {
|
18
|
+
Serializer,
|
19
|
+
array,
|
20
|
+
mapSerializer,
|
21
|
+
struct,
|
22
|
+
u64,
|
23
|
+
u8,
|
24
|
+
} from '@metaplex-foundation/umi/serializers';
|
25
|
+
import {
|
26
|
+
ResolvedAccount,
|
27
|
+
ResolvedAccountsWithIndices,
|
28
|
+
getAccountMetasAndSigners,
|
29
|
+
} from '../shared';
|
30
|
+
|
31
|
+
// Accounts.
|
32
|
+
export type UnsetAccountFlagInstructionAccounts = {
|
33
|
+
marginfiGroup: PublicKey | Pda;
|
34
|
+
marginfiAccount: PublicKey | Pda;
|
35
|
+
/** Admin only */
|
36
|
+
admin: Signer;
|
37
|
+
};
|
38
|
+
|
39
|
+
// Data.
|
40
|
+
export type UnsetAccountFlagInstructionData = {
|
41
|
+
discriminator: Array<number>;
|
42
|
+
flag: bigint;
|
43
|
+
};
|
44
|
+
|
45
|
+
export type UnsetAccountFlagInstructionDataArgs = { flag: number | bigint };
|
46
|
+
|
47
|
+
export function getUnsetAccountFlagInstructionDataSerializer(): Serializer<
|
48
|
+
UnsetAccountFlagInstructionDataArgs,
|
49
|
+
UnsetAccountFlagInstructionData
|
50
|
+
> {
|
51
|
+
return mapSerializer<
|
52
|
+
UnsetAccountFlagInstructionDataArgs,
|
53
|
+
any,
|
54
|
+
UnsetAccountFlagInstructionData
|
55
|
+
>(
|
56
|
+
struct<UnsetAccountFlagInstructionData>(
|
57
|
+
[
|
58
|
+
['discriminator', array(u8(), { size: 8 })],
|
59
|
+
['flag', u64()],
|
60
|
+
],
|
61
|
+
{ description: 'UnsetAccountFlagInstructionData' }
|
62
|
+
),
|
63
|
+
(value) => ({ ...value, discriminator: [56, 81, 56, 85, 92, 49, 255, 70] })
|
64
|
+
) as Serializer<
|
65
|
+
UnsetAccountFlagInstructionDataArgs,
|
66
|
+
UnsetAccountFlagInstructionData
|
67
|
+
>;
|
68
|
+
}
|
69
|
+
|
70
|
+
// Args.
|
71
|
+
export type UnsetAccountFlagInstructionArgs =
|
72
|
+
UnsetAccountFlagInstructionDataArgs;
|
73
|
+
|
74
|
+
// Instruction.
|
75
|
+
export function unsetAccountFlag(
|
76
|
+
context: Pick<Context, 'programs'>,
|
77
|
+
input: UnsetAccountFlagInstructionAccounts & UnsetAccountFlagInstructionArgs
|
78
|
+
): TransactionBuilder {
|
79
|
+
// Program ID.
|
80
|
+
const programId = context.programs.getPublicKey(
|
81
|
+
'marginfi',
|
82
|
+
'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA'
|
83
|
+
);
|
84
|
+
|
85
|
+
// Accounts.
|
86
|
+
const resolvedAccounts = {
|
87
|
+
marginfiGroup: {
|
88
|
+
index: 0,
|
89
|
+
isWritable: false as boolean,
|
90
|
+
value: input.marginfiGroup ?? null,
|
91
|
+
},
|
92
|
+
marginfiAccount: {
|
93
|
+
index: 1,
|
94
|
+
isWritable: true as boolean,
|
95
|
+
value: input.marginfiAccount ?? null,
|
96
|
+
},
|
97
|
+
admin: {
|
98
|
+
index: 2,
|
99
|
+
isWritable: false as boolean,
|
100
|
+
value: input.admin ?? null,
|
101
|
+
},
|
102
|
+
} satisfies ResolvedAccountsWithIndices;
|
103
|
+
|
104
|
+
// Arguments.
|
105
|
+
const resolvedArgs: UnsetAccountFlagInstructionArgs = { ...input };
|
106
|
+
|
107
|
+
// Accounts in order.
|
108
|
+
const orderedAccounts: ResolvedAccount[] = Object.values(
|
109
|
+
resolvedAccounts
|
110
|
+
).sort((a, b) => a.index - b.index);
|
111
|
+
|
112
|
+
// Keys and Signers.
|
113
|
+
const [keys, signers] = getAccountMetasAndSigners(
|
114
|
+
orderedAccounts,
|
115
|
+
'programId',
|
116
|
+
programId
|
117
|
+
);
|
118
|
+
|
119
|
+
// Data.
|
120
|
+
const data = getUnsetAccountFlagInstructionDataSerializer().serialize(
|
121
|
+
resolvedArgs as UnsetAccountFlagInstructionDataArgs
|
122
|
+
);
|
123
|
+
|
124
|
+
// Bytes Created On Chain.
|
125
|
+
const bytesCreatedOnChain = 0;
|
126
|
+
|
127
|
+
return transactionBuilder([
|
128
|
+
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
|
129
|
+
]);
|
130
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
export * from './marginfi';
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
import {
|
10
|
+
ClusterFilter,
|
11
|
+
Context,
|
12
|
+
Program,
|
13
|
+
PublicKey,
|
14
|
+
} from '@metaplex-foundation/umi';
|
15
|
+
import { getMarginfiErrorFromCode, getMarginfiErrorFromName } from '../errors';
|
16
|
+
|
17
|
+
export const MARGINFI_PROGRAM_ID =
|
18
|
+
'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA' as PublicKey<'MFv2hWf31Z9kbCa1snEPYctwafyhdvnV7FZnsebVacA'>;
|
19
|
+
|
20
|
+
export function createMarginfiProgram(): Program {
|
21
|
+
return {
|
22
|
+
name: 'marginfi',
|
23
|
+
publicKey: MARGINFI_PROGRAM_ID,
|
24
|
+
getErrorFromCode(code: number, cause?: Error) {
|
25
|
+
return getMarginfiErrorFromCode(code, this, cause);
|
26
|
+
},
|
27
|
+
getErrorFromName(name: string, cause?: Error) {
|
28
|
+
return getMarginfiErrorFromName(name, this, cause);
|
29
|
+
},
|
30
|
+
isOnCluster() {
|
31
|
+
return true;
|
32
|
+
},
|
33
|
+
};
|
34
|
+
}
|
35
|
+
|
36
|
+
export function getMarginfiProgram<T extends Program = Program>(
|
37
|
+
context: Pick<Context, 'programs'>,
|
38
|
+
clusterFilter?: ClusterFilter
|
39
|
+
): T {
|
40
|
+
return context.programs.get<T>('marginfi', clusterFilter);
|
41
|
+
}
|
42
|
+
|
43
|
+
export function getMarginfiProgramId(
|
44
|
+
context: Pick<Context, 'programs'>,
|
45
|
+
clusterFilter?: ClusterFilter
|
46
|
+
): PublicKey {
|
47
|
+
return context.programs.getPublicKey(
|
48
|
+
'marginfi',
|
49
|
+
MARGINFI_PROGRAM_ID,
|
50
|
+
clusterFilter
|
51
|
+
);
|
52
|
+
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
/**
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
4
|
+
* to add features, then rerun kinobi to update it.
|
5
|
+
*
|
6
|
+
* @see https://github.com/metaplex-foundation/kinobi
|
7
|
+
*/
|
8
|
+
|
9
|
+
import {
|
10
|
+
AccountMeta,
|
11
|
+
isSigner,
|
12
|
+
Pda,
|
13
|
+
publicKey,
|
14
|
+
PublicKey,
|
15
|
+
Signer,
|
16
|
+
isPda,
|
17
|
+
} from '@metaplex-foundation/umi';
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Transforms the given object such that the given keys are optional.
|
21
|
+
* @internal
|
22
|
+
*/
|
23
|
+
export type PickPartial<T, K extends keyof T> = Omit<T, K> &
|
24
|
+
Partial<Pick<T, K>>;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Asserts that the given value is not null or undefined.
|
28
|
+
* @internal
|
29
|
+
*/
|
30
|
+
export function expectSome<T>(value: T | null | undefined): T {
|
31
|
+
if (value == null) {
|
32
|
+
throw new Error('Expected a value but received null or undefined.');
|
33
|
+
}
|
34
|
+
return value;
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Asserts that the given value is a PublicKey.
|
39
|
+
* @internal
|
40
|
+
*/
|
41
|
+
export function expectPublicKey(
|
42
|
+
value: PublicKey | Pda | Signer | null | undefined
|
43
|
+
): PublicKey {
|
44
|
+
if (!value) {
|
45
|
+
throw new Error('Expected a PublicKey.');
|
46
|
+
}
|
47
|
+
return publicKey(value, false);
|
48
|
+
}
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Asserts that the given value is a PDA.
|
52
|
+
* @internal
|
53
|
+
*/
|
54
|
+
export function expectPda(
|
55
|
+
value: PublicKey | Pda | Signer | null | undefined
|
56
|
+
): Pda {
|
57
|
+
if (!value || !Array.isArray(value) || !isPda(value)) {
|
58
|
+
throw new Error('Expected a PDA.');
|
59
|
+
}
|
60
|
+
return value;
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Defines an instruction account to resolve.
|
65
|
+
* @internal
|
66
|
+
*/
|
67
|
+
export type ResolvedAccount<T = PublicKey | Pda | Signer | null> = {
|
68
|
+
isWritable: boolean;
|
69
|
+
value: T;
|
70
|
+
};
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Defines a set of instruction account to resolve.
|
74
|
+
* @internal
|
75
|
+
*/
|
76
|
+
export type ResolvedAccounts = Record<string, ResolvedAccount>;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Defines a set of instruction account to resolve with their indices.
|
80
|
+
* @internal
|
81
|
+
*/
|
82
|
+
export type ResolvedAccountsWithIndices = Record<
|
83
|
+
string,
|
84
|
+
ResolvedAccount & { index: number }
|
85
|
+
>;
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Get account metas and signers from resolved accounts.
|
89
|
+
* @internal
|
90
|
+
*/
|
91
|
+
export function getAccountMetasAndSigners(
|
92
|
+
accounts: ResolvedAccount[],
|
93
|
+
optionalAccountStrategy: 'omitted' | 'programId',
|
94
|
+
programId: PublicKey
|
95
|
+
): [AccountMeta[], Signer[]] {
|
96
|
+
const keys: AccountMeta[] = [];
|
97
|
+
const signers: Signer[] = [];
|
98
|
+
|
99
|
+
accounts.forEach((account) => {
|
100
|
+
if (!account.value) {
|
101
|
+
if (optionalAccountStrategy === 'omitted') return;
|
102
|
+
keys.push({ pubkey: programId, isSigner: false, isWritable: false });
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
|
106
|
+
if (isSigner(account.value)) {
|
107
|
+
signers.push(account.value);
|
108
|
+
}
|
109
|
+
keys.push({
|
110
|
+
pubkey: publicKey(account.value, false),
|
111
|
+
isSigner: isSigner(account.value),
|
112
|
+
isWritable: account.isWritable,
|
113
|
+
});
|
114
|
+
});
|
115
|
+
|
116
|
+
return [keys, signers];
|
117
|
+
}
|