@wuwei-labs/srsly 2.0.0-beta.4 → 2.0.0-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +354 -186
- package/dist/cjs/codama/accounts/config.js +86 -0
- package/dist/cjs/codama/accounts/config.js.map +1 -0
- package/dist/cjs/codama/{devnet/accounts → accounts}/contractState.js +2 -7
- package/dist/cjs/codama/accounts/contractState.js.map +1 -0
- package/dist/cjs/codama/{devnet/accounts → accounts}/index.js +1 -1
- package/dist/cjs/codama/accounts/index.js.map +1 -0
- package/dist/cjs/codama/accounts/rentalState.js.map +1 -0
- package/dist/cjs/codama/accounts/thread.js.map +1 -0
- package/dist/cjs/codama/errors/index.js.map +1 -0
- package/dist/cjs/codama/errors/srsly.js +113 -0
- package/dist/cjs/codama/errors/srsly.js.map +1 -0
- package/dist/cjs/codama/index.js.map +1 -0
- package/dist/cjs/codama/{mainnet/instructions → instructions}/acceptRental.js +12 -48
- package/dist/cjs/codama/instructions/acceptRental.js.map +1 -0
- package/dist/cjs/codama/{mainnet/instructions → instructions}/cancelRental.js +55 -13
- package/dist/cjs/codama/instructions/cancelRental.js.map +1 -0
- package/dist/cjs/codama/{mainnet/instructions/resetRental.js → instructions/closeContract.js} +29 -38
- package/dist/cjs/codama/instructions/closeContract.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions/acceptRental.js → instructions/closeRental.js} +105 -139
- package/dist/cjs/codama/instructions/closeRental.js.map +1 -0
- package/dist/cjs/codama/{mainnet/instructions → instructions}/createContract.js +13 -16
- package/dist/cjs/codama/instructions/createContract.js.map +1 -0
- package/dist/cjs/codama/{mainnet/instructions → instructions}/index.js +3 -1
- package/dist/cjs/codama/instructions/index.js.map +1 -0
- package/dist/cjs/codama/instructions/initializeConfig.js +131 -0
- package/dist/cjs/codama/instructions/initializeConfig.js.map +1 -0
- package/dist/cjs/codama/{mainnet/instructions → instructions}/payRental.js +15 -23
- package/dist/cjs/codama/instructions/payRental.js.map +1 -0
- package/dist/cjs/codama/instructions/resetContractTemp.js +146 -0
- package/dist/cjs/codama/instructions/resetContractTemp.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/resetRental.js +11 -10
- package/dist/cjs/codama/instructions/resetRental.js.map +1 -0
- package/dist/cjs/codama/instructions/updateConfig.js +143 -0
- package/dist/cjs/codama/instructions/updateConfig.js.map +1 -0
- package/dist/cjs/codama/programs/index.js.map +1 -0
- package/dist/cjs/codama/{mainnet/programs → programs}/srsly.js +17 -9
- package/dist/cjs/codama/programs/srsly.js.map +1 -0
- package/dist/cjs/codama/shared/index.js.map +1 -0
- package/dist/cjs/codama/types/clockData.js.map +1 -0
- package/dist/cjs/codama/types/equality.js.map +1 -0
- package/dist/cjs/codama/types/execContext.js.map +1 -0
- package/dist/cjs/codama/types/index.js.map +1 -0
- package/dist/cjs/codama/{devnet/types → types}/paymentFrequency.js +31 -0
- package/dist/cjs/codama/types/paymentFrequency.js.map +1 -0
- package/dist/cjs/codama/types/serializableAccount.js.map +1 -0
- package/dist/cjs/codama/types/serializableInstruction.js.map +1 -0
- package/dist/cjs/codama/types/threadResponse.js.map +1 -0
- package/dist/cjs/codama/types/trigger.js.map +1 -0
- package/dist/cjs/codama/types/triggerContext.js.map +1 -0
- package/dist/cjs/contract/close.js +138 -34
- package/dist/cjs/contract/close.js.map +1 -1
- package/dist/cjs/contract/create.js +145 -36
- package/dist/cjs/contract/create.js.map +1 -1
- package/dist/cjs/contract/index.js +45 -0
- package/dist/cjs/contract/index.js.map +1 -1
- package/dist/cjs/index.js +134 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +53 -0
- package/dist/cjs/rental/accept.js +196 -43
- package/dist/cjs/rental/accept.js.map +1 -1
- package/dist/cjs/rental/cancel.js +107 -28
- package/dist/cjs/rental/cancel.js.map +1 -1
- package/dist/cjs/rental/close.js +169 -31
- package/dist/cjs/rental/close.js.map +1 -1
- package/dist/cjs/rental/index.js +85 -0
- package/dist/cjs/rental/index.js.map +1 -1
- package/dist/cjs/rental/reset-contract-temp.js +103 -0
- package/dist/cjs/rental/reset-contract-temp.js.map +1 -0
- package/dist/cjs/rental/reset.js +134 -45
- package/dist/cjs/rental/reset.js.map +1 -1
- package/dist/cjs/types/paymentFrequency.js +58 -0
- package/dist/cjs/types/paymentFrequency.js.map +1 -0
- package/dist/cjs/utils/config.js +244 -0
- package/dist/cjs/utils/config.js.map +1 -0
- package/dist/cjs/utils/constants.js +70 -27
- package/dist/cjs/utils/constants.js.map +1 -1
- package/dist/cjs/utils/duration.js +77 -0
- package/dist/cjs/utils/duration.js.map +1 -0
- package/dist/cjs/utils/fetch-accounts.js +115 -0
- package/dist/cjs/utils/fetch-accounts.js.map +1 -0
- package/dist/cjs/utils/index.js +6 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/instruction-converter.js +121 -0
- package/dist/cjs/utils/instruction-converter.js.map +1 -0
- package/dist/cjs/utils/paymentFrequency.js +65 -0
- package/dist/cjs/utils/paymentFrequency.js.map +1 -0
- package/dist/cjs/utils/pda.js +191 -0
- package/dist/cjs/utils/pda.js.map +1 -0
- package/dist/cjs/utils/profiles.js +38 -18
- package/dist/cjs/utils/profiles.js.map +1 -1
- package/dist/cjs/utils/types.js +6 -0
- package/dist/cjs/utils/types.js.map +1 -0
- package/dist/esm/codama/accounts/config.js +74 -0
- package/dist/esm/codama/accounts/config.js.map +1 -0
- package/dist/esm/codama/{devnet/accounts → accounts}/contractState.js +3 -7
- package/dist/esm/codama/accounts/contractState.js.map +1 -0
- package/dist/esm/codama/{devnet/accounts → accounts}/index.js +1 -1
- package/dist/esm/codama/accounts/index.js.map +1 -0
- package/dist/esm/codama/accounts/rentalState.js.map +1 -0
- package/dist/esm/codama/accounts/thread.js.map +1 -0
- package/dist/esm/codama/errors/index.js.map +1 -0
- package/dist/esm/codama/{devnet/errors → errors}/srsly.js +44 -2
- package/dist/esm/codama/errors/srsly.js.map +1 -0
- package/dist/esm/codama/index.js.map +1 -0
- package/dist/esm/codama/{mainnet/instructions → instructions}/acceptRental.js +12 -48
- package/dist/esm/codama/instructions/acceptRental.js.map +1 -0
- package/dist/esm/codama/{mainnet/instructions → instructions}/cancelRental.js +55 -13
- package/dist/esm/codama/instructions/cancelRental.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions/resetRental.js → instructions/closeContract.js} +21 -30
- package/dist/esm/codama/instructions/closeContract.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions/acceptRental.js → instructions/closeRental.js} +98 -132
- package/dist/esm/codama/instructions/closeRental.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions → instructions}/createContract.js +13 -16
- package/dist/esm/codama/instructions/createContract.js.map +1 -0
- package/dist/esm/codama/{mainnet/instructions → instructions}/index.js +3 -1
- package/dist/esm/codama/instructions/index.js.map +1 -0
- package/dist/esm/codama/instructions/initializeConfig.js +121 -0
- package/dist/esm/codama/instructions/initializeConfig.js.map +1 -0
- package/dist/esm/codama/{mainnet/instructions → instructions}/payRental.js +17 -25
- package/dist/esm/codama/instructions/payRental.js.map +1 -0
- package/dist/esm/codama/instructions/resetContractTemp.js +136 -0
- package/dist/esm/codama/instructions/resetContractTemp.js.map +1 -0
- package/dist/esm/codama/{mainnet/instructions → instructions}/resetRental.js +11 -10
- package/dist/esm/codama/instructions/resetRental.js.map +1 -0
- package/dist/esm/codama/instructions/updateConfig.js +133 -0
- package/dist/esm/codama/instructions/updateConfig.js.map +1 -0
- package/dist/esm/codama/programs/index.js.map +1 -0
- package/dist/esm/codama/{devnet/programs → programs}/srsly.js +17 -9
- package/dist/esm/codama/programs/srsly.js.map +1 -0
- package/dist/esm/codama/shared/index.js.map +1 -0
- package/dist/esm/codama/types/clockData.js.map +1 -0
- package/dist/esm/codama/types/equality.js.map +1 -0
- package/dist/esm/codama/types/execContext.js.map +1 -0
- package/dist/esm/codama/types/index.js.map +1 -0
- package/dist/esm/codama/types/paymentFrequency.js +59 -0
- package/dist/esm/codama/types/paymentFrequency.js.map +1 -0
- package/dist/esm/codama/types/serializableAccount.js.map +1 -0
- package/dist/esm/codama/types/serializableInstruction.js.map +1 -0
- package/dist/esm/codama/types/threadResponse.js.map +1 -0
- package/dist/esm/codama/types/trigger.js.map +1 -0
- package/dist/esm/codama/types/triggerContext.js.map +1 -0
- package/dist/esm/contract/close.js +139 -35
- package/dist/esm/contract/close.js.map +1 -1
- package/dist/esm/contract/create.js +145 -35
- package/dist/esm/contract/create.js.map +1 -1
- package/dist/esm/contract/index.js +45 -0
- package/dist/esm/contract/index.js.map +1 -1
- package/dist/esm/index.js +114 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +53 -0
- package/dist/esm/rental/accept.js +197 -44
- package/dist/esm/rental/accept.js.map +1 -1
- package/dist/esm/rental/cancel.js +107 -28
- package/dist/esm/rental/cancel.js.map +1 -1
- package/dist/esm/rental/close.js +169 -31
- package/dist/esm/rental/close.js.map +1 -1
- package/dist/esm/rental/index.js +85 -0
- package/dist/esm/rental/index.js.map +1 -1
- package/dist/esm/rental/reset-contract-temp.js +100 -0
- package/dist/esm/rental/reset-contract-temp.js.map +1 -0
- package/dist/esm/rental/reset.js +135 -46
- package/dist/esm/rental/reset.js.map +1 -1
- package/dist/esm/types/paymentFrequency.js +53 -0
- package/dist/esm/types/paymentFrequency.js.map +1 -0
- package/dist/esm/utils/config.js +201 -0
- package/dist/esm/utils/config.js.map +1 -0
- package/dist/esm/utils/constants.js +64 -24
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/esm/utils/duration.js +68 -0
- package/dist/esm/utils/duration.js.map +1 -0
- package/dist/esm/utils/fetch-accounts.js +109 -0
- package/dist/esm/utils/fetch-accounts.js.map +1 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/instruction-converter.js +116 -0
- package/dist/esm/utils/instruction-converter.js.map +1 -0
- package/dist/esm/utils/paymentFrequency.js +60 -0
- package/dist/esm/utils/paymentFrequency.js.map +1 -0
- package/dist/esm/utils/pda.js +185 -0
- package/dist/esm/utils/pda.js.map +1 -0
- package/dist/esm/utils/profiles.js +39 -19
- package/dist/esm/utils/profiles.js.map +1 -1
- package/dist/esm/utils/types.js +5 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/types/codama/accounts/config.d.ts +74 -0
- package/dist/types/codama/accounts/config.d.ts.map +1 -0
- package/dist/types/codama/{devnet/accounts → accounts}/contractState.d.ts +28 -4
- package/dist/types/codama/accounts/contractState.d.ts.map +1 -0
- package/dist/types/codama/{devnet/accounts → accounts}/index.d.ts +1 -1
- package/dist/types/codama/accounts/index.d.ts.map +1 -0
- package/dist/types/codama/{mainnet/accounts → accounts}/rentalState.d.ts +20 -0
- package/dist/types/codama/accounts/rentalState.d.ts.map +1 -0
- package/dist/types/codama/accounts/thread.d.ts.map +1 -0
- package/dist/types/codama/errors/index.d.ts.map +1 -0
- package/dist/types/codama/errors/srsly.d.ts +76 -0
- package/dist/types/codama/errors/srsly.d.ts.map +1 -0
- package/dist/types/codama/index.d.ts.map +1 -0
- package/dist/types/codama/instructions/acceptRental.d.ts +128 -0
- package/dist/types/codama/instructions/acceptRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/cancelRental.d.ts +87 -0
- package/dist/types/codama/instructions/cancelRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/closeContract.d.ts +71 -0
- package/dist/types/codama/instructions/closeContract.d.ts.map +1 -0
- package/dist/types/codama/instructions/closeRental.d.ts +127 -0
- package/dist/types/codama/instructions/closeRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/createContract.d.ts +112 -0
- package/dist/types/codama/instructions/createContract.d.ts.map +1 -0
- package/dist/types/codama/{devnet/instructions → instructions}/index.d.ts +3 -1
- package/dist/types/codama/instructions/index.d.ts.map +1 -0
- package/dist/types/codama/instructions/initializeConfig.d.ts +60 -0
- package/dist/types/codama/instructions/initializeConfig.d.ts.map +1 -0
- package/dist/types/codama/{devnet/instructions → instructions}/payRental.d.ts +21 -13
- package/dist/types/codama/instructions/payRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/resetContractTemp.d.ts +71 -0
- package/dist/types/codama/instructions/resetContractTemp.d.ts.map +1 -0
- package/dist/types/codama/instructions/resetRental.d.ts +79 -0
- package/dist/types/codama/instructions/resetRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/updateConfig.d.ts +109 -0
- package/dist/types/codama/instructions/updateConfig.d.ts.map +1 -0
- package/dist/types/codama/programs/index.d.ts.map +1 -0
- package/dist/types/codama/{mainnet/programs → programs}/srsly.d.ts +14 -8
- package/dist/types/codama/programs/srsly.d.ts.map +1 -0
- package/dist/types/codama/shared/index.d.ts.map +1 -0
- package/dist/types/codama/types/clockData.d.ts.map +1 -0
- package/dist/types/codama/types/equality.d.ts.map +1 -0
- package/dist/types/codama/types/execContext.d.ts.map +1 -0
- package/dist/types/codama/types/index.d.ts.map +1 -0
- package/dist/types/codama/types/paymentFrequency.d.ts +53 -0
- package/dist/types/codama/types/paymentFrequency.d.ts.map +1 -0
- package/dist/types/codama/types/serializableAccount.d.ts.map +1 -0
- package/dist/types/codama/types/serializableInstruction.d.ts.map +1 -0
- package/dist/types/codama/types/threadResponse.d.ts.map +1 -0
- package/dist/types/codama/types/trigger.d.ts.map +1 -0
- package/dist/types/codama/types/triggerContext.d.ts.map +1 -0
- package/dist/types/contract/close.d.ts +92 -20
- package/dist/types/contract/close.d.ts.map +1 -1
- package/dist/types/contract/create.d.ts +134 -39
- package/dist/types/contract/create.d.ts.map +1 -1
- package/dist/types/contract/index.d.ts +45 -0
- package/dist/types/contract/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +116 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rental/accept.d.ts +144 -28
- package/dist/types/rental/accept.d.ts.map +1 -1
- package/dist/types/rental/cancel.d.ts +100 -9
- package/dist/types/rental/cancel.d.ts.map +1 -1
- package/dist/types/rental/close.d.ts +101 -14
- package/dist/types/rental/close.d.ts.map +1 -1
- package/dist/types/rental/index.d.ts +85 -0
- package/dist/types/rental/index.d.ts.map +1 -1
- package/dist/types/rental/reset-contract-temp.d.ts +77 -0
- package/dist/types/rental/reset-contract-temp.d.ts.map +1 -0
- package/dist/types/rental/reset.d.ts +135 -20
- package/dist/types/rental/reset.d.ts.map +1 -1
- package/dist/types/types/paymentFrequency.d.ts +44 -0
- package/dist/types/types/paymentFrequency.d.ts.map +1 -0
- package/dist/types/utils/config.d.ts +122 -0
- package/dist/types/utils/config.d.ts.map +1 -0
- package/dist/types/utils/constants.d.ts +14 -12
- package/dist/types/utils/constants.d.ts.map +1 -1
- package/dist/types/utils/duration.d.ts +56 -0
- package/dist/types/utils/duration.d.ts.map +1 -0
- package/dist/types/utils/fetch-accounts.d.ts +88 -0
- package/dist/types/utils/fetch-accounts.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/instruction-converter.d.ts +167 -0
- package/dist/types/utils/instruction-converter.d.ts.map +1 -0
- package/dist/types/utils/paymentFrequency.d.ts +18 -0
- package/dist/types/utils/paymentFrequency.d.ts.map +1 -0
- package/dist/types/utils/pda.d.ts +120 -0
- package/dist/types/utils/pda.d.ts.map +1 -0
- package/dist/types/utils/profiles.d.ts +14 -8
- package/dist/types/utils/profiles.d.ts.map +1 -1
- package/dist/types/utils/types.d.ts +6 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/package.json +34 -27
- package/target/idl/{srsly-devnet.json → srsly.json} +1035 -736
- package/dist/cjs/codama/devnet/accounts/contractState.js.map +0 -1
- package/dist/cjs/codama/devnet/accounts/fleet.js +0 -77
- package/dist/cjs/codama/devnet/accounts/fleet.js.map +0 -1
- package/dist/cjs/codama/devnet/accounts/index.js.map +0 -1
- package/dist/cjs/codama/devnet/accounts/rentalState.js.map +0 -1
- package/dist/cjs/codama/devnet/accounts/thread.js.map +0 -1
- package/dist/cjs/codama/devnet/errors/index.js.map +0 -1
- package/dist/cjs/codama/devnet/errors/srsly.js +0 -71
- package/dist/cjs/codama/devnet/errors/srsly.js.map +0 -1
- package/dist/cjs/codama/devnet/index.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/acceptRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/cancelRental.js +0 -225
- package/dist/cjs/codama/devnet/instructions/cancelRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/closeContract.js +0 -219
- package/dist/cjs/codama/devnet/instructions/closeContract.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/closeRental.js +0 -233
- package/dist/cjs/codama/devnet/instructions/closeRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/createContract.js +0 -261
- package/dist/cjs/codama/devnet/instructions/createContract.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/index.js +0 -32
- package/dist/cjs/codama/devnet/instructions/index.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/normalizeAdmin.js +0 -152
- package/dist/cjs/codama/devnet/instructions/normalizeAdmin.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/payRental.js +0 -236
- package/dist/cjs/codama/devnet/instructions/payRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/resetRental.js.map +0 -1
- package/dist/cjs/codama/devnet/programs/index.js.map +0 -1
- package/dist/cjs/codama/devnet/programs/srsly.js +0 -77
- package/dist/cjs/codama/devnet/programs/srsly.js.map +0 -1
- package/dist/cjs/codama/devnet/shared/index.js.map +0 -1
- package/dist/cjs/codama/devnet/types/clockData.js.map +0 -1
- package/dist/cjs/codama/devnet/types/equality.js.map +0 -1
- package/dist/cjs/codama/devnet/types/execContext.js.map +0 -1
- package/dist/cjs/codama/devnet/types/index.js.map +0 -1
- package/dist/cjs/codama/devnet/types/paymentFrequency.js.map +0 -1
- package/dist/cjs/codama/devnet/types/serializableAccount.js.map +0 -1
- package/dist/cjs/codama/devnet/types/serializableInstruction.js.map +0 -1
- package/dist/cjs/codama/devnet/types/threadResponse.js.map +0 -1
- package/dist/cjs/codama/devnet/types/trigger.js.map +0 -1
- package/dist/cjs/codama/devnet/types/triggerContext.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/contractState.js +0 -92
- package/dist/cjs/codama/mainnet/accounts/contractState.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/fleet.js +0 -77
- package/dist/cjs/codama/mainnet/accounts/fleet.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/index.js +0 -28
- package/dist/cjs/codama/mainnet/accounts/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/rentalState.js +0 -85
- package/dist/cjs/codama/mainnet/accounts/rentalState.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/thread.js +0 -89
- package/dist/cjs/codama/mainnet/accounts/thread.js.map +0 -1
- package/dist/cjs/codama/mainnet/errors/index.js +0 -25
- package/dist/cjs/codama/mainnet/errors/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/errors/srsly.js +0 -71
- package/dist/cjs/codama/mainnet/errors/srsly.js.map +0 -1
- package/dist/cjs/codama/mainnet/index.js +0 -29
- package/dist/cjs/codama/mainnet/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/acceptRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/cancelRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/closeContract.js +0 -219
- package/dist/cjs/codama/mainnet/instructions/closeContract.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/closeRental.js +0 -233
- package/dist/cjs/codama/mainnet/instructions/closeRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/createContract.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/normalizeAdmin.js +0 -152
- package/dist/cjs/codama/mainnet/instructions/normalizeAdmin.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/payRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/resetRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/programs/index.js +0 -25
- package/dist/cjs/codama/mainnet/programs/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/programs/srsly.js.map +0 -1
- package/dist/cjs/codama/mainnet/shared/index.js +0 -95
- package/dist/cjs/codama/mainnet/shared/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/clockData.js +0 -31
- package/dist/cjs/codama/mainnet/types/clockData.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/equality.js +0 -30
- package/dist/cjs/codama/mainnet/types/equality.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/execContext.js +0 -38
- package/dist/cjs/codama/mainnet/types/execContext.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/index.js +0 -33
- package/dist/cjs/codama/mainnet/types/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/paymentFrequency.js +0 -32
- package/dist/cjs/codama/mainnet/types/paymentFrequency.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/serializableAccount.js +0 -31
- package/dist/cjs/codama/mainnet/types/serializableAccount.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/serializableInstruction.js +0 -32
- package/dist/cjs/codama/mainnet/types/serializableInstruction.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/threadResponse.js +0 -38
- package/dist/cjs/codama/mainnet/types/threadResponse.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/trigger.js +0 -90
- package/dist/cjs/codama/mainnet/types/trigger.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/triggerContext.js +0 -49
- package/dist/cjs/codama/mainnet/types/triggerContext.js.map +0 -1
- package/dist/cjs/network.js +0 -107
- package/dist/cjs/network.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/contractState.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/fleet.js +0 -64
- package/dist/esm/codama/devnet/accounts/fleet.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/index.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/rentalState.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/thread.js.map +0 -1
- package/dist/esm/codama/devnet/errors/index.js.map +0 -1
- package/dist/esm/codama/devnet/errors/srsly.js.map +0 -1
- package/dist/esm/codama/devnet/index.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/acceptRental.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/cancelRental.js +0 -215
- package/dist/esm/codama/devnet/instructions/cancelRental.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/closeContract.js +0 -209
- package/dist/esm/codama/devnet/instructions/closeContract.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/closeRental.js +0 -223
- package/dist/esm/codama/devnet/instructions/closeRental.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/createContract.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/index.js +0 -16
- package/dist/esm/codama/devnet/instructions/index.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/normalizeAdmin.js +0 -142
- package/dist/esm/codama/devnet/instructions/normalizeAdmin.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/payRental.js +0 -226
- package/dist/esm/codama/devnet/instructions/payRental.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/resetRental.js.map +0 -1
- package/dist/esm/codama/devnet/programs/index.js.map +0 -1
- package/dist/esm/codama/devnet/programs/srsly.js.map +0 -1
- package/dist/esm/codama/devnet/shared/index.js.map +0 -1
- package/dist/esm/codama/devnet/types/clockData.js.map +0 -1
- package/dist/esm/codama/devnet/types/equality.js.map +0 -1
- package/dist/esm/codama/devnet/types/execContext.js.map +0 -1
- package/dist/esm/codama/devnet/types/index.js.map +0 -1
- package/dist/esm/codama/devnet/types/paymentFrequency.js +0 -28
- package/dist/esm/codama/devnet/types/paymentFrequency.js.map +0 -1
- package/dist/esm/codama/devnet/types/serializableAccount.js.map +0 -1
- package/dist/esm/codama/devnet/types/serializableInstruction.js.map +0 -1
- package/dist/esm/codama/devnet/types/threadResponse.js.map +0 -1
- package/dist/esm/codama/devnet/types/trigger.js.map +0 -1
- package/dist/esm/codama/devnet/types/triggerContext.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/contractState.js +0 -79
- package/dist/esm/codama/mainnet/accounts/contractState.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/fleet.js +0 -64
- package/dist/esm/codama/mainnet/accounts/fleet.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/index.js +0 -12
- package/dist/esm/codama/mainnet/accounts/index.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/rentalState.js +0 -72
- package/dist/esm/codama/mainnet/accounts/rentalState.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/thread.js +0 -77
- package/dist/esm/codama/mainnet/accounts/thread.js.map +0 -1
- package/dist/esm/codama/mainnet/errors/index.js +0 -9
- package/dist/esm/codama/mainnet/errors/index.js.map +0 -1
- package/dist/esm/codama/mainnet/errors/srsly.js +0 -66
- package/dist/esm/codama/mainnet/errors/srsly.js.map +0 -1
- package/dist/esm/codama/mainnet/index.js +0 -13
- package/dist/esm/codama/mainnet/index.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/acceptRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/cancelRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/closeContract.js +0 -209
- package/dist/esm/codama/mainnet/instructions/closeContract.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/closeRental.js +0 -223
- package/dist/esm/codama/mainnet/instructions/closeRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/createContract.js +0 -251
- package/dist/esm/codama/mainnet/instructions/createContract.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/index.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/normalizeAdmin.js +0 -142
- package/dist/esm/codama/mainnet/instructions/normalizeAdmin.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/payRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/resetRental.js.map +0 -1
- package/dist/esm/codama/mainnet/programs/index.js +0 -9
- package/dist/esm/codama/mainnet/programs/index.js.map +0 -1
- package/dist/esm/codama/mainnet/programs/srsly.js +0 -72
- package/dist/esm/codama/mainnet/programs/srsly.js.map +0 -1
- package/dist/esm/codama/mainnet/shared/index.js +0 -87
- package/dist/esm/codama/mainnet/shared/index.js.map +0 -1
- package/dist/esm/codama/mainnet/types/clockData.js +0 -26
- package/dist/esm/codama/mainnet/types/clockData.js.map +0 -1
- package/dist/esm/codama/mainnet/types/equality.js +0 -24
- package/dist/esm/codama/mainnet/types/equality.js.map +0 -1
- package/dist/esm/codama/mainnet/types/execContext.js +0 -33
- package/dist/esm/codama/mainnet/types/execContext.js.map +0 -1
- package/dist/esm/codama/mainnet/types/index.js +0 -17
- package/dist/esm/codama/mainnet/types/index.js.map +0 -1
- package/dist/esm/codama/mainnet/types/paymentFrequency.js +0 -26
- package/dist/esm/codama/mainnet/types/paymentFrequency.js.map +0 -1
- package/dist/esm/codama/mainnet/types/serializableAccount.js +0 -26
- package/dist/esm/codama/mainnet/types/serializableAccount.js.map +0 -1
- package/dist/esm/codama/mainnet/types/serializableInstruction.js +0 -27
- package/dist/esm/codama/mainnet/types/serializableInstruction.js.map +0 -1
- package/dist/esm/codama/mainnet/types/threadResponse.js +0 -33
- package/dist/esm/codama/mainnet/types/threadResponse.js.map +0 -1
- package/dist/esm/codama/mainnet/types/trigger.js +0 -83
- package/dist/esm/codama/mainnet/types/trigger.js.map +0 -1
- package/dist/esm/codama/mainnet/types/triggerContext.js +0 -42
- package/dist/esm/codama/mainnet/types/triggerContext.js.map +0 -1
- package/dist/esm/network.js +0 -67
- package/dist/esm/network.js.map +0 -1
- package/dist/types/codama/devnet/accounts/contractState.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/fleet.d.ts +0 -38
- package/dist/types/codama/devnet/accounts/fleet.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/rentalState.d.ts +0 -46
- package/dist/types/codama/devnet/accounts/rentalState.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/thread.d.ts.map +0 -1
- package/dist/types/codama/devnet/errors/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/errors/srsly.d.ts +0 -48
- package/dist/types/codama/devnet/errors/srsly.d.ts.map +0 -1
- package/dist/types/codama/devnet/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/acceptRental.d.ts +0 -128
- package/dist/types/codama/devnet/instructions/acceptRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/cancelRental.d.ts +0 -71
- package/dist/types/codama/devnet/instructions/cancelRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/closeContract.d.ts +0 -96
- package/dist/types/codama/devnet/instructions/closeContract.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/closeRental.d.ts +0 -79
- package/dist/types/codama/devnet/instructions/closeRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/createContract.d.ts +0 -108
- package/dist/types/codama/devnet/instructions/createContract.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/normalizeAdmin.d.ts +0 -67
- package/dist/types/codama/devnet/instructions/normalizeAdmin.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/payRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/resetRental.d.ts +0 -71
- package/dist/types/codama/devnet/instructions/resetRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/programs/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/programs/srsly.d.ts +0 -50
- package/dist/types/codama/devnet/programs/srsly.d.ts.map +0 -1
- package/dist/types/codama/devnet/shared/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/clockData.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/equality.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/execContext.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/paymentFrequency.d.ts +0 -22
- package/dist/types/codama/devnet/types/paymentFrequency.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/serializableAccount.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/serializableInstruction.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/threadResponse.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/trigger.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/triggerContext.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/contractState.d.ts +0 -53
- package/dist/types/codama/mainnet/accounts/contractState.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/fleet.d.ts +0 -38
- package/dist/types/codama/mainnet/accounts/fleet.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/index.d.ts +0 -12
- package/dist/types/codama/mainnet/accounts/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/rentalState.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/thread.d.ts +0 -74
- package/dist/types/codama/mainnet/accounts/thread.d.ts.map +0 -1
- package/dist/types/codama/mainnet/errors/index.d.ts +0 -9
- package/dist/types/codama/mainnet/errors/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/errors/srsly.d.ts +0 -48
- package/dist/types/codama/mainnet/errors/srsly.d.ts.map +0 -1
- package/dist/types/codama/mainnet/index.d.ts +0 -13
- package/dist/types/codama/mainnet/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/acceptRental.d.ts +0 -128
- package/dist/types/codama/mainnet/instructions/acceptRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/cancelRental.d.ts +0 -71
- package/dist/types/codama/mainnet/instructions/cancelRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/closeContract.d.ts +0 -96
- package/dist/types/codama/mainnet/instructions/closeContract.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/closeRental.d.ts +0 -79
- package/dist/types/codama/mainnet/instructions/closeRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/createContract.d.ts +0 -108
- package/dist/types/codama/mainnet/instructions/createContract.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/index.d.ts +0 -16
- package/dist/types/codama/mainnet/instructions/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/normalizeAdmin.d.ts +0 -67
- package/dist/types/codama/mainnet/instructions/normalizeAdmin.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/payRental.d.ts +0 -99
- package/dist/types/codama/mainnet/instructions/payRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/resetRental.d.ts +0 -71
- package/dist/types/codama/mainnet/instructions/resetRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/programs/index.d.ts +0 -9
- package/dist/types/codama/mainnet/programs/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/programs/srsly.d.ts.map +0 -1
- package/dist/types/codama/mainnet/shared/index.d.ts +0 -50
- package/dist/types/codama/mainnet/shared/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/clockData.d.ts +0 -29
- package/dist/types/codama/mainnet/types/clockData.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/equality.d.ts +0 -18
- package/dist/types/codama/mainnet/types/equality.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/execContext.d.ts +0 -48
- package/dist/types/codama/mainnet/types/execContext.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/index.d.ts +0 -17
- package/dist/types/codama/mainnet/types/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/paymentFrequency.d.ts +0 -20
- package/dist/types/codama/mainnet/types/paymentFrequency.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/serializableAccount.d.ts +0 -22
- package/dist/types/codama/mainnet/types/serializableAccount.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/serializableInstruction.d.ts +0 -30
- package/dist/types/codama/mainnet/types/serializableInstruction.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/threadResponse.d.ts +0 -42
- package/dist/types/codama/mainnet/types/threadResponse.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/trigger.d.ts +0 -98
- package/dist/types/codama/mainnet/types/trigger.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/triggerContext.d.ts +0 -75
- package/dist/types/codama/mainnet/types/triggerContext.d.ts.map +0 -1
- package/dist/types/network.d.ts +0 -58
- package/dist/types/network.d.ts.map +0 -1
- package/target/idl/srsly-mainnet.json +0 -3011
- package/target/types/srsly-mainnet.ts +0 -1
- /package/dist/cjs/codama/{devnet/accounts → accounts}/rentalState.js +0 -0
- /package/dist/cjs/codama/{devnet/accounts → accounts}/thread.js +0 -0
- /package/dist/cjs/codama/{devnet/errors → errors}/index.js +0 -0
- /package/dist/cjs/codama/{devnet/index.js → index.js} +0 -0
- /package/dist/cjs/codama/{devnet/programs → programs}/index.js +0 -0
- /package/dist/cjs/codama/{devnet/shared → shared}/index.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/clockData.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/equality.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/execContext.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/index.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/serializableAccount.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/serializableInstruction.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/threadResponse.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/trigger.js +0 -0
- /package/dist/cjs/codama/{devnet/types → types}/triggerContext.js +0 -0
- /package/dist/esm/codama/{devnet/accounts → accounts}/rentalState.js +0 -0
- /package/dist/esm/codama/{devnet/accounts → accounts}/thread.js +0 -0
- /package/dist/esm/codama/{devnet/errors → errors}/index.js +0 -0
- /package/dist/esm/codama/{devnet/index.js → index.js} +0 -0
- /package/dist/esm/codama/{devnet/programs → programs}/index.js +0 -0
- /package/dist/esm/codama/{devnet/shared → shared}/index.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/clockData.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/equality.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/execContext.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/index.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/serializableAccount.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/serializableInstruction.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/threadResponse.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/trigger.js +0 -0
- /package/dist/esm/codama/{devnet/types → types}/triggerContext.js +0 -0
- /package/dist/types/codama/{devnet/accounts → accounts}/thread.d.ts +0 -0
- /package/dist/types/codama/{devnet/errors → errors}/index.d.ts +0 -0
- /package/dist/types/codama/{devnet/index.d.ts → index.d.ts} +0 -0
- /package/dist/types/codama/{devnet/programs → programs}/index.d.ts +0 -0
- /package/dist/types/codama/{devnet/shared → shared}/index.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/clockData.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/equality.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/execContext.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/index.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/serializableAccount.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/serializableInstruction.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/threadResponse.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/trigger.d.ts +0 -0
- /package/dist/types/codama/{devnet/types → types}/triggerContext.d.ts +0 -0
- /package/target/types/{srsly-devnet.ts → srsly.ts} +0 -0
|
@@ -1,20 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { type ConfigSelector } from '../utils/config';
|
|
2
|
+
type UniversalAddress = string;
|
|
3
|
+
type UniversalSigner = any;
|
|
3
4
|
type CancelRentalInstruction = any;
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Parameters for canceling an active rental.
|
|
7
|
+
*
|
|
8
|
+
* This interface defines the required parameters for a borrower to cancel their
|
|
9
|
+
* active rental. Canceling a rental stops automated payments but typically
|
|
10
|
+
* incurs a penalty fee as defined in the contract terms.
|
|
11
|
+
*
|
|
12
|
+
* @interface CancelRentalParams
|
|
6
13
|
*/
|
|
7
14
|
export interface CancelRentalParams {
|
|
8
15
|
/**
|
|
9
|
-
* The borrower
|
|
16
|
+
* The borrower who wants to cancel the rental (must be a signer object).
|
|
17
|
+
* Must be the original borrower who accepted the rental contract.
|
|
18
|
+
* This account will pay any cancellation penalties.
|
|
10
19
|
*/
|
|
11
|
-
borrower:
|
|
20
|
+
borrower: UniversalSigner;
|
|
12
21
|
/**
|
|
13
|
-
*
|
|
22
|
+
* String address of the rental contract associated with the active rental.
|
|
23
|
+
* The rental state for this contract will be canceled and automated payments stopped.
|
|
14
24
|
*/
|
|
15
|
-
contract:
|
|
25
|
+
contract: UniversalAddress;
|
|
16
26
|
}
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instruction to cancel a rental with fluent configuration.
|
|
29
|
+
*
|
|
30
|
+
* This function allows a borrower to cancel their active rental before the
|
|
31
|
+
* rental period expires. Canceling a rental stops automated payments but
|
|
32
|
+
* may incur penalty fees as defined in the contract terms. The fleet ownership
|
|
33
|
+
* is immediately returned to the original owner.
|
|
34
|
+
*
|
|
35
|
+
* ## Features
|
|
36
|
+
*
|
|
37
|
+
* - **Immediate Cancellation**: Stops the rental and automated payments immediately
|
|
38
|
+
* - **Fleet Transfer**: Returns fleet control to the original owner
|
|
39
|
+
* - **Thread Cleanup**: Cancels the automated payment thread
|
|
40
|
+
* - **Penalty Processing**: Handles any cancellation fees as defined in the contract
|
|
41
|
+
* - **Universal Library Support**: Works with both @solana/kit and @solana/web3.js
|
|
42
|
+
*
|
|
43
|
+
* ## Process
|
|
44
|
+
*
|
|
45
|
+
* 1. **Validate Authority**: Ensures only the borrower can cancel their rental
|
|
46
|
+
* 2. **Calculate Penalties**: Computes any cancellation fees owed
|
|
47
|
+
* 3. **Transfer Fleet**: Returns fleet ownership to the original owner
|
|
48
|
+
* 4. **Cancel Thread**: Stops automated payment processing
|
|
49
|
+
* 5. **Update State**: Marks rental as canceled in the rental state account
|
|
50
|
+
*
|
|
51
|
+
* ## Requirements
|
|
52
|
+
*
|
|
53
|
+
* - Rental must be active (not already canceled or completed)
|
|
54
|
+
* - Caller must be the original borrower
|
|
55
|
+
* - Borrower must have sufficient funds for any cancellation penalties
|
|
56
|
+
*
|
|
57
|
+
* ## Cancellation Effects
|
|
58
|
+
*
|
|
59
|
+
* - **Fleet Control**: Immediately returned to owner
|
|
60
|
+
* - **Automated Payments**: Stopped permanently
|
|
61
|
+
* - **Rental State**: Marked as canceled
|
|
62
|
+
* - **Thread Account**: Cleaned up and closed
|
|
63
|
+
* - **Penalties**: Charged according to contract terms
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { cancelRental } from '@srsly/sdk';
|
|
68
|
+
*
|
|
69
|
+
* // Basic rental cancellation
|
|
70
|
+
* const instruction = await cancelRental({
|
|
71
|
+
* borrower: wallet, // Borrower's wallet (must be original borrower)
|
|
72
|
+
* contract: "ContractAddr..." // Contract address for the active rental
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // Configure for mainnet
|
|
76
|
+
* const mainnetInstruction = await cancelRental({
|
|
77
|
+
* borrower: wallet,
|
|
78
|
+
* contract: "ContractAddr..."
|
|
79
|
+
* }).set({ programs: 'mainnet' });
|
|
80
|
+
*
|
|
81
|
+
* // Convert to @solana/web3.js format
|
|
82
|
+
* const web3jsInstruction = await cancelRental({
|
|
83
|
+
* borrower: wallet,
|
|
84
|
+
* contract: "ContractAddr..."
|
|
85
|
+
* }).web3js();
|
|
86
|
+
*
|
|
87
|
+
* // Use with your preferred Solana library
|
|
88
|
+
* const transaction = new Transaction().add(web3jsInstruction);
|
|
89
|
+
* await sendAndConfirmTransaction(connection, transaction, [wallet]);
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param params - The rental cancellation parameters including borrower and contract
|
|
93
|
+
* @returns A ConfigSelector that can be configured with .set() or awaited directly
|
|
94
|
+
* @throws Error when rental is not active, caller is not the borrower, or instruction generation fails
|
|
95
|
+
*/
|
|
96
|
+
export declare function cancelRental(params: CancelRentalParams): ConfigSelector<CancelRentalInstruction>;
|
|
97
|
+
/**
|
|
98
|
+
* Low-level function to create a rental cancellation instruction with raw input parameters.
|
|
99
|
+
*
|
|
100
|
+
* This function provides direct access to the underlying codama-generated instruction
|
|
101
|
+
* builder. It's primarily used internally by the SDK but can be used for advanced
|
|
102
|
+
* use cases where full control over instruction parameters is needed.
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
* @param input - Raw instruction input parameters as expected by codama
|
|
106
|
+
* @param options - Optional instruction options including program address
|
|
107
|
+
* @returns A ConfigSelector for the raw instruction
|
|
108
|
+
*/
|
|
109
|
+
export declare function getCancelRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
19
110
|
export {};
|
|
20
111
|
//# sourceMappingURL=cancel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAIpI,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,eAAe,GAAG,GAAG,CAAC;AAC3B,KAAK,uBAAuB,GAAG,GAAG,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AA8CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,GACzB,cAAc,CAAC,uBAAuB,CAAC,CAEzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK9F"}
|
|
@@ -1,24 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
type
|
|
1
|
+
import { type ConfigSelector } from '../utils/config';
|
|
2
|
+
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
3
|
+
type UniversalAddress = string;
|
|
4
|
+
type UniversalSigner = any;
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Parameters for closing a completed rental.
|
|
7
|
+
*
|
|
8
|
+
* This interface defines the required parameters for closing a rental that has
|
|
9
|
+
* reached its expiration or been fully paid. Closing a rental finalizes the
|
|
10
|
+
* rental period, transfers any remaining funds, and cleans up the rental state.
|
|
11
|
+
*
|
|
12
|
+
* @interface CloseRentalParams
|
|
6
13
|
*/
|
|
7
14
|
export interface CloseRentalParams {
|
|
8
15
|
/**
|
|
9
|
-
* The
|
|
16
|
+
* The payer for transaction fees (must be a signer object).
|
|
17
|
+
* This account will pay for the transaction and receive any lamports
|
|
18
|
+
* from closed accounts.
|
|
10
19
|
*/
|
|
11
|
-
|
|
20
|
+
payer: UniversalSigner;
|
|
12
21
|
/**
|
|
13
|
-
*
|
|
22
|
+
* String address of the rental state to close.
|
|
23
|
+
* This is the unique rental state account that tracks the rental.
|
|
14
24
|
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The rental contract account address
|
|
18
|
-
*/
|
|
19
|
-
contract: Address<string>;
|
|
25
|
+
rentalStateAddress: UniversalAddress;
|
|
20
26
|
}
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Creates an instruction to close a completed rental with fluent configuration.
|
|
29
|
+
*
|
|
30
|
+
* This function finalizes a rental that has reached its expiration or been fully paid.
|
|
31
|
+
* It transfers any remaining funds to the owner, returns fleet control, and cleans up
|
|
32
|
+
* the rental state account. This instruction can be called by anyone once the rental
|
|
33
|
+
* period has ended.
|
|
34
|
+
*
|
|
35
|
+
* ## Features
|
|
36
|
+
*
|
|
37
|
+
* - **Rental Finalization**: Properly closes completed or expired rentals
|
|
38
|
+
* - **Fund Transfer**: Moves any remaining payments or deposits to the owner
|
|
39
|
+
* - **Fleet Return**: Ensures fleet ownership is returned to the original owner
|
|
40
|
+
* - **State Cleanup**: Closes rental state account and returns lamports
|
|
41
|
+
* - **Thread Cleanup**: Cleans up automated payment threads
|
|
42
|
+
* - **Universal Library Support**: Works with both @solana/kit and @solana/web3.js
|
|
43
|
+
*
|
|
44
|
+
* ## Process
|
|
45
|
+
*
|
|
46
|
+
* 1. **Validate Completion**: Ensures rental period has ended or been fully paid
|
|
47
|
+
* 2. **Transfer Funds**: Moves any remaining ATLAS tokens to owner's account
|
|
48
|
+
* 3. **Return Fleet**: Transfers fleet ownership back to original owner
|
|
49
|
+
* 4. **Clean State**: Closes rental state account and returns SOL to payer
|
|
50
|
+
* 5. **Cancel Thread**: Cleans up any remaining automated payment threads
|
|
51
|
+
*
|
|
52
|
+
* ## Requirements
|
|
53
|
+
*
|
|
54
|
+
* - Rental must be completed or expired
|
|
55
|
+
* - Owner token account must be valid ATLAS token account
|
|
56
|
+
* - Rental state account must exist and be properly initialized
|
|
57
|
+
*
|
|
58
|
+
* ## When to Use
|
|
59
|
+
*
|
|
60
|
+
* - **Natural Expiration**: When rental period has ended
|
|
61
|
+
* - **Full Payment**: When all required payments have been made
|
|
62
|
+
* - **Account Cleanup**: To close expired rental accounts and recover SOL
|
|
63
|
+
* - **Fleet Recovery**: When fleet needs to be returned to owner
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { closeRental } from '@srsly/sdk';
|
|
68
|
+
*
|
|
69
|
+
* // Close a completed rental
|
|
70
|
+
* const instruction = await closeRental({
|
|
71
|
+
* payer: wallet, // Transaction payer
|
|
72
|
+
* rentalStateAddress: "RentalState..." // Rental state address
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // Configure for mainnet
|
|
76
|
+
* const mainnetInstruction = await closeRental({
|
|
77
|
+
* payer: wallet,
|
|
78
|
+
* rentalStateAddress: "RentalState..."
|
|
79
|
+
* }).set({ programs: 'mainnet' });
|
|
80
|
+
*
|
|
81
|
+
* // Convert to @solana/web3.js format
|
|
82
|
+
* const web3jsInstruction = await closeRental({
|
|
83
|
+
* payer: wallet,
|
|
84
|
+
* rentalStateAddress: "RentalState..."
|
|
85
|
+
* }).web3js();
|
|
86
|
+
*
|
|
87
|
+
* // Use with your preferred Solana library
|
|
88
|
+
* const transaction = new Transaction().add(web3jsInstruction);
|
|
89
|
+
* await sendAndConfirmTransaction(connection, transaction, [wallet]);
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @param params - The rental closure parameters including payer and rental state address
|
|
93
|
+
* @returns A FluentConfigSelector that can be configured with .set() or awaited directly
|
|
94
|
+
* @throws Error when rental is not ready for closure or instruction generation fails
|
|
95
|
+
*/
|
|
96
|
+
export declare function closeRental(params: CloseRentalParams): SmartFluentConfigSelector<FluentInstruction>;
|
|
97
|
+
/**
|
|
98
|
+
* Low-level function to create a rental closure instruction with raw input parameters.
|
|
99
|
+
*
|
|
100
|
+
* This function provides direct access to the underlying codama-generated instruction
|
|
101
|
+
* builder. It's primarily used internally by the SDK but can be used for advanced
|
|
102
|
+
* use cases where full control over instruction parameters is needed.
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
* @param input - Raw instruction input parameters as expected by codama
|
|
106
|
+
* @param options - Optional instruction options including program address
|
|
107
|
+
* @returns A ConfigSelector for the raw instruction
|
|
108
|
+
*/
|
|
109
|
+
export declare function getCloseRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
23
110
|
export {};
|
|
24
111
|
//# sourceMappingURL=close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/rental/close.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/rental/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAGpI,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAMlK,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,eAAe,GAAG,GAAG,CAAC;AAE3B;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IAEvB;;;OAGG;IACH,kBAAkB,EAAE,gBAAgB,CAAC;CACtC;AAqHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,GACxB,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK7F"}
|
|
@@ -1,5 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # Rental Operations Module
|
|
3
|
+
*
|
|
4
|
+
* This module provides comprehensive functionality for managing rental operations
|
|
5
|
+
* on the SRSLY program. It includes functions for accepting, canceling, closing,
|
|
6
|
+
* and resetting rentals, with full support for both @solana/kit and @solana/web3.js libraries.
|
|
7
|
+
*
|
|
8
|
+
* ## Available Functions
|
|
9
|
+
*
|
|
10
|
+
* - **acceptRental**: Accept an existing rental contract as a borrower
|
|
11
|
+
* - **cancelRental**: Cancel an active rental before completion
|
|
12
|
+
* - **closeRental**: Close a completed or expired rental
|
|
13
|
+
* - **resetRental**: Reset a canceled rental to make the contract available again
|
|
14
|
+
*
|
|
15
|
+
* ## Rental Lifecycle
|
|
16
|
+
*
|
|
17
|
+
* ```text
|
|
18
|
+
* Contract Created → Accept → [Active Rental] → Close (Complete)
|
|
19
|
+
* ↓ ↓
|
|
20
|
+
* [Payment] Cancel → Reset → [Available Again]
|
|
21
|
+
* ↑ ↓
|
|
22
|
+
* [Automated] [Cleanup]
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* ## Features
|
|
26
|
+
*
|
|
27
|
+
* - **Universal Library Support**: Works with both major Solana libraries
|
|
28
|
+
* - **String-Based Addresses**: Eliminates library-specific type conflicts
|
|
29
|
+
* - **Fluent API**: Chainable configuration and format conversion
|
|
30
|
+
* - **Network Agnostic**: Supports different Solana networks
|
|
31
|
+
* - **Automated Payments**: Integration with Clockwork for scheduled payments
|
|
32
|
+
* - **SAGE Integration**: Fleet ownership management in Star Atlas ecosystem
|
|
33
|
+
*
|
|
34
|
+
* ## Common Patterns
|
|
35
|
+
*
|
|
36
|
+
* ### Accept a Rental
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { acceptRental, days } from '@srsly/sdk';
|
|
39
|
+
*
|
|
40
|
+
* const instruction = await acceptRental({
|
|
41
|
+
* borrower: wallet,
|
|
42
|
+
* borrowerProfile: "ProfileAddr...",
|
|
43
|
+
* borrowerFaction: 'mud',
|
|
44
|
+
* contract: "ContractAddr...",
|
|
45
|
+
* duration: days(7)
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* ### Cancel Active Rental
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { cancelRental } from '@srsly/sdk';
|
|
52
|
+
*
|
|
53
|
+
* const instruction = await cancelRental({
|
|
54
|
+
* borrower: wallet,
|
|
55
|
+
* contract: "ContractAddr..."
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* ### Close Completed Rental
|
|
60
|
+
* ```typescript
|
|
61
|
+
* import { closeRental } from '@srsly/sdk';
|
|
62
|
+
*
|
|
63
|
+
* const instruction = await closeRental({
|
|
64
|
+
* borrower: "BorrowerAddr...",
|
|
65
|
+
* ownerTokenAccount: "TokenAcct...",
|
|
66
|
+
* contract: "ContractAddr..."
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* ### Reset Canceled Rental
|
|
71
|
+
* ```typescript
|
|
72
|
+
* import { resetRental } from '@srsly/sdk';
|
|
73
|
+
*
|
|
74
|
+
* const instruction = await resetRental({
|
|
75
|
+
* fleet: "FleetAddr...",
|
|
76
|
+
* contract: "ContractAddr...",
|
|
77
|
+
* rentalState: "RentalStateAddr...",
|
|
78
|
+
* faction: 'mud',
|
|
79
|
+
* ownerProfile: "OwnerProfileAddr..."
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @module Rental
|
|
84
|
+
*/
|
|
1
85
|
export * from "./accept";
|
|
2
86
|
export * from "./cancel";
|
|
3
87
|
export * from "./close";
|
|
4
88
|
export * from "./reset";
|
|
89
|
+
export * from "./reset-contract-temp";
|
|
5
90
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rental/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rental/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
2
|
+
type UniversalAddress = string;
|
|
3
|
+
type UniversalSigner = any;
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for resetting a contract temporarily (devnet testing).
|
|
6
|
+
*
|
|
7
|
+
* This interface defines the required parameters for resetting a contract's
|
|
8
|
+
* rental state and properly resetting the fleet in SAGE.
|
|
9
|
+
*
|
|
10
|
+
* @interface ResetContractTempParams
|
|
11
|
+
*/
|
|
12
|
+
export interface ResetContractTempParams {
|
|
13
|
+
/**
|
|
14
|
+
* The signer who will execute the reset (must be a signer object).
|
|
15
|
+
*/
|
|
16
|
+
signer: UniversalSigner;
|
|
17
|
+
/**
|
|
18
|
+
* String address of the contract to reset.
|
|
19
|
+
*/
|
|
20
|
+
contract: UniversalAddress;
|
|
21
|
+
/**
|
|
22
|
+
* Faction identifier for fleet operations.
|
|
23
|
+
* Can be provided as a number (1 = MUD, 2 = ONI, 3 = Ustur) or string ('mud', 'oni', 'ustur').
|
|
24
|
+
* Used for deriving SAGE accounts.
|
|
25
|
+
* @example 'mud' // or 1
|
|
26
|
+
*/
|
|
27
|
+
faction: number | string;
|
|
28
|
+
/**
|
|
29
|
+
* String address of the owner's profile in Star Atlas.
|
|
30
|
+
* Used for SAGE fleet operations.
|
|
31
|
+
*/
|
|
32
|
+
ownerProfile: UniversalAddress;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a temporary instruction to reset a contract's fleet in SAGE (devnet testing).
|
|
36
|
+
*
|
|
37
|
+
* This function properly resets a contract by:
|
|
38
|
+
* 1. Resetting the fleet in SAGE via CPI call to invalidate_rental(context, false)
|
|
39
|
+
* 2. Setting the contract's current_rental_state to system_program::ID
|
|
40
|
+
* 3. Making the contract available for new rentals
|
|
41
|
+
*
|
|
42
|
+
* ## Features
|
|
43
|
+
*
|
|
44
|
+
* - **Fleet Reset**: Properly resets fleet in SAGE ecosystem
|
|
45
|
+
* - **Contract Reset**: Updates contract state to be available for new rentals
|
|
46
|
+
* - **Account Derivation**: Automatically derives all required SAGE accounts
|
|
47
|
+
* - **Network Support**: Works across mainnet, atlasnet, and holosim
|
|
48
|
+
* - **Universal Library Support**: Works with both @solana/kit and @solana/web3.js
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { resetContractTemp } from '@wuwei-labs/srsly';
|
|
53
|
+
*
|
|
54
|
+
* // Reset a contract for testing
|
|
55
|
+
* const instruction = await resetContractTemp({
|
|
56
|
+
* signer: wallet,
|
|
57
|
+
* contract: "5YqtCEiGPLH3FqoTCkWXFCLtNFC7StnUydgaYfLSPHWv",
|
|
58
|
+
* faction: 'mud',
|
|
59
|
+
* ownerProfile: "OwnerProfileAddr..."
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Configure for specific network
|
|
63
|
+
* const instruction = await resetContractTemp({
|
|
64
|
+
* signer: wallet,
|
|
65
|
+
* contract: "ContractAddr...",
|
|
66
|
+
* faction: 2,
|
|
67
|
+
* ownerProfile: "OwnerProfileAddr..."
|
|
68
|
+
* }).set({ programs: 'holosim' });
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @param params - The contract reset parameters
|
|
72
|
+
* @returns A FluentConfigSelector that can be configured with .set() or awaited directly
|
|
73
|
+
* @throws Error when contract is not found or account derivation fails
|
|
74
|
+
*/
|
|
75
|
+
export declare function resetContractTemp(params: ResetContractTempParams): SmartFluentConfigSelector<FluentInstruction>;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=reset-contract-temp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-contract-temp.d.ts","sourceRoot":"","sources":["../../../src/rental/reset-contract-temp.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAKlK,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,eAAe,GAAG,GAAG,CAAC;AAE3B;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IAExB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,YAAY,EAAE,gBAAgB,CAAC;CAChC;AA8ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,uBAAuB,GAC9B,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C"}
|
|
@@ -1,40 +1,155 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { type ConfigSelector } from '../utils/config';
|
|
2
|
+
type UniversalAddress = string;
|
|
3
|
+
type UniversalSigner = any;
|
|
3
4
|
type ResetRentalInstruction = any;
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Parameters for resetting a rental after cancellation.
|
|
7
|
+
*
|
|
8
|
+
* This interface defines the required parameters for resetting a rental contract
|
|
9
|
+
* after it has been canceled. Resetting clears the rental state and makes the
|
|
10
|
+
* contract available for new rentals again.
|
|
11
|
+
*
|
|
12
|
+
* @interface ResetRentalParams
|
|
6
13
|
*/
|
|
7
14
|
export interface ResetRentalParams {
|
|
8
15
|
/**
|
|
9
|
-
* The
|
|
16
|
+
* The payer for transaction fees (must be a signer object).
|
|
17
|
+
* This account will pay for the transaction and receive any lamports
|
|
18
|
+
* from closed accounts.
|
|
10
19
|
*/
|
|
11
|
-
|
|
20
|
+
payer: UniversalSigner;
|
|
12
21
|
/**
|
|
13
|
-
*
|
|
22
|
+
* String address of the fleet associated with the rental contract.
|
|
23
|
+
* The fleet's rental state will be reset to allow for new rentals.
|
|
14
24
|
*/
|
|
15
|
-
|
|
25
|
+
fleet: UniversalAddress;
|
|
16
26
|
/**
|
|
17
|
-
*
|
|
27
|
+
* String address of the rental contract to reset.
|
|
28
|
+
* This contract will be made available for new rentals after reset.
|
|
18
29
|
*/
|
|
19
|
-
|
|
30
|
+
contract: UniversalAddress;
|
|
20
31
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
32
|
+
* String address of the rental state account to be reset.
|
|
33
|
+
* This account contains the canceled rental data that needs to be cleared.
|
|
23
34
|
*/
|
|
24
|
-
|
|
35
|
+
rentalState: UniversalAddress;
|
|
25
36
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
37
|
+
* Faction identifier for Star Atlas integration.
|
|
38
|
+
* Can be provided as a number (1 = MUD, 2 = ONI, 3 = Ustur) or string ('mud', 'oni', 'ustur').
|
|
39
|
+
* Used for deriving faction-specific game accounts required by SAGE.
|
|
40
|
+
* @example 'mud' // or 1
|
|
29
41
|
*/
|
|
30
42
|
faction: number | string;
|
|
31
43
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
44
|
+
* String address of the owner's profile in the Star Atlas game.
|
|
45
|
+
* Required for deriving game accounts (starbase, starbasePlayer) needed by SAGE.
|
|
46
|
+
* Must be the profile of the original fleet owner.
|
|
34
47
|
*/
|
|
35
|
-
ownerProfile:
|
|
48
|
+
ownerProfile: UniversalAddress;
|
|
36
49
|
}
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Creates an instruction to reset a rental contract after cancellation with fluent configuration.
|
|
52
|
+
*
|
|
53
|
+
* This function clears the rental state from a canceled rental, making the contract
|
|
54
|
+
* available for new rentals. It's typically called after a rental has been canceled
|
|
55
|
+
* to clean up the state and allow the fleet to be rented out again.
|
|
56
|
+
*
|
|
57
|
+
* ## Features
|
|
58
|
+
*
|
|
59
|
+
* - **State Cleanup**: Clears canceled rental state from accounts
|
|
60
|
+
* - **Contract Reactivation**: Makes the contract available for new rentals
|
|
61
|
+
* - **Fleet Preparation**: Ensures fleet is ready for future rental operations
|
|
62
|
+
* - **SAGE Integration**: Updates fleet status in the Star Atlas ecosystem
|
|
63
|
+
* - **Account Derivation**: Automatically derives required game accounts
|
|
64
|
+
* - **Universal Library Support**: Works with both @solana/kit and @solana/web3.js
|
|
65
|
+
*
|
|
66
|
+
* ## Process
|
|
67
|
+
*
|
|
68
|
+
* 1. **Validate State**: Ensures rental was properly canceled before reset
|
|
69
|
+
* 2. **Derive Accounts**: Generates required game accounts (starbase, etc.)
|
|
70
|
+
* 3. **Clear State**: Removes canceled rental data from accounts
|
|
71
|
+
* 4. **Update SAGE**: Resets fleet status in the Star Atlas ecosystem
|
|
72
|
+
* 5. **Reactivate Contract**: Makes contract available for new rentals
|
|
73
|
+
*
|
|
74
|
+
* ## Requirements
|
|
75
|
+
*
|
|
76
|
+
* - Rental must be in canceled state (not active or completed)
|
|
77
|
+
* - Caller must have authority to reset the rental
|
|
78
|
+
* - All accounts must be properly initialized
|
|
79
|
+
* - Fleet must be under owner control
|
|
80
|
+
*
|
|
81
|
+
* ## When to Use
|
|
82
|
+
*
|
|
83
|
+
* - **After Cancellation**: When a rental has been canceled and needs cleanup
|
|
84
|
+
* - **Contract Reuse**: To make a contract available for new rentals
|
|
85
|
+
* - **State Recovery**: When rental state needs to be cleared
|
|
86
|
+
* - **Fleet Management**: To prepare fleet for future rental operations
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* import { resetRental } from '@srsly/sdk';
|
|
91
|
+
*
|
|
92
|
+
* // Reset a canceled rental
|
|
93
|
+
* const instruction = await resetRental({
|
|
94
|
+
* fleet: "FleetAddress123...", // Fleet to reset
|
|
95
|
+
* contract: "ContractAddr...", // Contract to reactivate
|
|
96
|
+
* rentalState: "RentalStateAddr...", // Canceled rental state
|
|
97
|
+
* faction: 'mud', // Owner's faction
|
|
98
|
+
* ownerProfile: "OwnerProfileAddr..." // Owner's Star Atlas profile
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* // Configure for mainnet
|
|
102
|
+
* const mainnetInstruction = await resetRental({
|
|
103
|
+
* fleet: "FleetAddress123...",
|
|
104
|
+
* contract: "ContractAddr...",
|
|
105
|
+
* rentalState: "RentalStateAddr...",
|
|
106
|
+
* faction: 1, // Can use numbers: 1=mud, 2=oni, 3=ustur
|
|
107
|
+
* ownerProfile: "OwnerProfileAddr..."
|
|
108
|
+
* }).set({ programs: 'mainnet' });
|
|
109
|
+
*
|
|
110
|
+
* // Override specific game configuration
|
|
111
|
+
* const customInstruction = await resetRental({
|
|
112
|
+
* fleet: "FleetAddress123...",
|
|
113
|
+
* contract: "ContractAddr...",
|
|
114
|
+
* rentalState: "RentalStateAddr...",
|
|
115
|
+
* faction: 'mud',
|
|
116
|
+
* ownerProfile: "OwnerProfileAddr..."
|
|
117
|
+
* }).set({
|
|
118
|
+
* programs: 'mainnet',
|
|
119
|
+
* gameId: 'custom-game-id...'
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* // Convert to @solana/web3.js format
|
|
123
|
+
* const web3jsInstruction = await resetRental({
|
|
124
|
+
* fleet: "FleetAddress123...",
|
|
125
|
+
* contract: "ContractAddr...",
|
|
126
|
+
* rentalState: "RentalStateAddr...",
|
|
127
|
+
* faction: 'mud',
|
|
128
|
+
* ownerProfile: "OwnerProfileAddr..."
|
|
129
|
+
* }).web3js();
|
|
130
|
+
*
|
|
131
|
+
* // Use with your preferred Solana library
|
|
132
|
+
* const transaction = new Transaction().add(web3jsInstruction);
|
|
133
|
+
* await sendAndConfirmTransaction(connection, transaction, [wallet]);
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @param params - The rental reset parameters including fleet, contract, rental state, and owner details
|
|
137
|
+
* @returns A ConfigSelector that can be configured with .set() or awaited directly
|
|
138
|
+
* @throws Error when rental is not in canceled state or instruction generation fails
|
|
139
|
+
*/
|
|
140
|
+
export declare function resetRental(params: ResetRentalParams): ConfigSelector<ResetRentalInstruction>;
|
|
141
|
+
/**
|
|
142
|
+
* Low-level function to create a rental reset instruction with raw input parameters.
|
|
143
|
+
*
|
|
144
|
+
* This function provides direct access to the underlying codama-generated instruction
|
|
145
|
+
* builder. It's primarily used internally by the SDK but can be used for advanced
|
|
146
|
+
* use cases where full control over instruction parameters is needed.
|
|
147
|
+
*
|
|
148
|
+
* @internal
|
|
149
|
+
* @param input - Raw instruction input parameters as expected by codama
|
|
150
|
+
* @param options - Optional instruction options including program address
|
|
151
|
+
* @returns A ConfigSelector for the raw instruction
|
|
152
|
+
*/
|
|
153
|
+
export declare function getResetRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
39
154
|
export {};
|
|
40
155
|
//# sourceMappingURL=reset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/rental/reset.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/rental/reset.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAKpI,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,eAAe,GAAG,GAAG,CAAC;AAC3B,KAAK,sBAAsB,GAAG,GAAG,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,gBAAgB,CAAC;IAExB;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;OAGG;IACF,WAAW,EAAE,gBAAgB,CAAC;IAE/B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;;;OAIG;IACH,YAAY,EAAE,gBAAgB,CAAC;CAChC;AAkED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,GACxB,cAAc,CAAC,sBAAsB,CAAC,CAExC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK7F"}
|