@wuwei-labs/srsly 2.0.0-beta.3 → 2.0.0-beta.31
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 +322 -197
- package/dist/cjs/codama/accounts/config.js +88 -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/{devnet/accounts → accounts}/rentalState.js +3 -1
- 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/{devnet/errors → errors}/srsly.js +30 -3
- package/dist/cjs/codama/errors/srsly.js.map +1 -0
- package/dist/cjs/codama/index.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/acceptRental.js +30 -39
- package/dist/cjs/codama/instructions/acceptRental.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/cancelRental.js +10 -33
- package/dist/cjs/codama/instructions/cancelRental.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/closeContract.js +15 -23
- package/dist/cjs/codama/instructions/closeContract.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/closeRental.js +19 -19
- package/dist/cjs/codama/instructions/closeRental.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/createContract.js +13 -16
- package/dist/cjs/codama/instructions/createContract.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/index.js +2 -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/{devnet/instructions → instructions}/payRental.js +32 -23
- package/dist/cjs/codama/instructions/payRental.js.map +1 -0
- package/dist/cjs/codama/{devnet/instructions → instructions}/resetRental.js +0 -9
- package/dist/cjs/codama/instructions/resetRental.js.map +1 -0
- package/dist/cjs/codama/instructions/updateConfig.js +145 -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/{devnet/programs → programs}/srsly.js +12 -8
- 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/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 +74 -31
- package/dist/cjs/contract/close.js.map +1 -1
- package/dist/cjs/contract/create.js +79 -35
- package/dist/cjs/contract/create.js.map +1 -1
- package/dist/cjs/index.js +25 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +53 -0
- package/dist/cjs/rental/accept.js +76 -42
- package/dist/cjs/rental/accept.js.map +1 -1
- package/dist/cjs/rental/cancel.js +40 -28
- package/dist/cjs/rental/cancel.js.map +1 -1
- package/dist/cjs/rental/close.js +42 -30
- package/dist/cjs/rental/close.js.map +1 -1
- package/dist/cjs/rental/reset.js +50 -43
- 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 +216 -0
- package/dist/cjs/utils/config.js.map +1 -0
- package/dist/cjs/utils/constants.js +55 -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/index.js +4 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/instruction-converter.js +66 -0
- package/dist/cjs/utils/instruction-converter.js.map +1 -0
- package/dist/cjs/utils/paymentFrequency.js +60 -0
- package/dist/cjs/utils/paymentFrequency.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 +76 -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/{devnet/accounts → accounts}/rentalState.js +3 -1
- 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 +29 -2
- package/dist/esm/codama/errors/srsly.js.map +1 -0
- package/dist/esm/codama/index.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions → instructions}/acceptRental.js +30 -39
- package/dist/esm/codama/instructions/acceptRental.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions → instructions}/cancelRental.js +10 -33
- package/dist/esm/codama/instructions/cancelRental.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions → instructions}/closeContract.js +17 -25
- package/dist/esm/codama/instructions/closeContract.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions → instructions}/closeRental.js +19 -19
- 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/{devnet/instructions → instructions}/index.js +2 -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/{devnet/instructions → instructions}/payRental.js +34 -25
- package/dist/esm/codama/instructions/payRental.js.map +1 -0
- package/dist/esm/codama/{devnet/instructions → instructions}/resetRental.js +0 -9
- package/dist/esm/codama/instructions/resetRental.js.map +1 -0
- package/dist/esm/codama/instructions/updateConfig.js +135 -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 +12 -8
- 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.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 +75 -32
- package/dist/esm/contract/close.js.map +1 -1
- package/dist/esm/contract/create.js +79 -34
- package/dist/esm/contract/create.js.map +1 -1
- package/dist/esm/index.js +8 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +53 -0
- package/dist/esm/rental/accept.js +77 -43
- package/dist/esm/rental/accept.js.map +1 -1
- package/dist/esm/rental/cancel.js +40 -28
- package/dist/esm/rental/cancel.js.map +1 -1
- package/dist/esm/rental/close.js +42 -30
- package/dist/esm/rental/close.js.map +1 -1
- package/dist/esm/rental/reset.js +51 -44
- 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 +173 -0
- package/dist/esm/utils/config.js.map +1 -0
- package/dist/esm/utils/constants.js +49 -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/index.js +4 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/instruction-converter.js +62 -0
- package/dist/esm/utils/instruction-converter.js.map +1 -0
- package/dist/esm/utils/paymentFrequency.js +55 -0
- package/dist/esm/utils/paymentFrequency.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 +52 -0
- package/dist/types/codama/accounts/config.d.ts.map +1 -0
- package/dist/types/codama/{devnet/accounts → accounts}/contractState.d.ts +2 -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/{devnet/accounts → accounts}/rentalState.d.ts +2 -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/{devnet/errors → errors}/srsly.d.ts +20 -2
- 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 +135 -0
- package/dist/types/codama/instructions/acceptRental.d.ts.map +1 -0
- package/dist/types/codama/{devnet/instructions → instructions}/cancelRental.d.ts +14 -10
- package/dist/types/codama/instructions/cancelRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/closeContract.d.ts +104 -0
- package/dist/types/codama/instructions/closeContract.d.ts.map +1 -0
- package/dist/types/codama/{devnet/instructions → instructions}/closeRental.d.ts +20 -12
- 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 +2 -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 +28 -13
- package/dist/types/codama/instructions/payRental.d.ts.map +1 -0
- package/dist/types/codama/{devnet/instructions → instructions}/resetRental.d.ts +3 -3
- package/dist/types/codama/instructions/resetRental.d.ts.map +1 -0
- package/dist/types/codama/instructions/updateConfig.d.ts +93 -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/{devnet/programs → programs}/srsly.d.ts +11 -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.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 +29 -13
- package/dist/types/contract/close.d.ts.map +1 -1
- package/dist/types/contract/create.d.ts +55 -54
- package/dist/types/contract/create.d.ts.map +1 -1
- package/dist/types/index.d.ts +5 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rental/accept.d.ts +65 -15
- package/dist/types/rental/accept.d.ts.map +1 -1
- package/dist/types/rental/cancel.d.ts +36 -8
- package/dist/types/rental/cancel.d.ts.map +1 -1
- package/dist/types/rental/close.d.ts +36 -8
- package/dist/types/rental/close.d.ts.map +1 -1
- package/dist/types/rental/reset.d.ts +42 -11
- 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 +110 -0
- package/dist/types/utils/config.d.ts.map +1 -0
- package/dist/types/utils/constants.d.ts +14 -11
- 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/index.d.ts +4 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/instruction-converter.d.ts +117 -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/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 +33 -25
- package/target/idl/{srsly-devnet.json → srsly.json} +795 -523
- 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.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.map +0 -1
- package/dist/cjs/codama/devnet/instructions/closeContract.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/closeRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/createContract.js.map +0 -1
- 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.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.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/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.map +0 -1
- package/dist/esm/codama/devnet/instructions/closeContract.js.map +0 -1
- 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.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.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.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/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.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.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.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.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.map +0 -1
- package/dist/types/codama/devnet/programs/index.d.ts.map +0 -1
- 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.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/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}/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}/paymentFrequency.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}/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}/paymentFrequency.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}/paymentFrequency.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,60 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getModule, createConfigSelector } from '../utils/config';
|
|
2
|
+
import { getSageGameId, ATLAS_TO_STARDUST, toAddress } from '../utils/constants';
|
|
3
|
+
import { deriveGameAccounts } from '../utils';
|
|
4
|
+
import { createFluentInstruction, createFluentConfigSelector } from '../utils/instruction-converter';
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
+
* Internal function to accept a rental instruction with configuration options
|
|
7
|
+
*/
|
|
8
|
+
async function _acceptRental(params, config) {
|
|
9
|
+
const { borrower, borrowerProfile, borrowerFaction, fleet, contract, gameId, rate, duration, referralTokenAccount, } = params;
|
|
10
|
+
// Get the actual game ID to use (param override, config override, or network default)
|
|
11
|
+
const actualGameId = gameId ? toAddress(gameId) : await getSageGameId(config);
|
|
12
|
+
// Calculate the total amount from rate and duration
|
|
13
|
+
// Convert ATLAS to stardust (smallest unit): 1 ATLAS = 100,000,000 stardust
|
|
14
|
+
const amount = BigInt(rate) * BigInt(duration) * BigInt(ATLAS_TO_STARDUST);
|
|
15
|
+
// Derive the three accounts we need
|
|
16
|
+
const { profileFaction, starbase, starbasePlayer } = await deriveGameAccounts(toAddress(borrowerProfile), borrowerFaction, actualGameId, 0, // starbaseSeqId
|
|
17
|
+
config);
|
|
18
|
+
// Let codama derive the rest (rentalThread, rentalState, rentalAuthority, etc.)
|
|
19
|
+
const input = {
|
|
20
|
+
borrower, // Pass as-is (string or signer)
|
|
21
|
+
borrowerProfile: toAddress(borrowerProfile), // Ensure string
|
|
22
|
+
borrowerProfileFaction: profileFaction, // Already string from deriveGameAccounts
|
|
23
|
+
fleet: toAddress(fleet), // Ensure string
|
|
24
|
+
contract: toAddress(contract), // Ensure string
|
|
25
|
+
gameId: actualGameId, // Already string
|
|
26
|
+
starbase, // Already string from deriveGameAccounts
|
|
27
|
+
starbasePlayer, // Already string from deriveGameAccounts
|
|
28
|
+
amount, // BigInt value
|
|
29
|
+
duration, // BigInt value
|
|
30
|
+
referralTokenAccount: referralTokenAccount ? toAddress(referralTokenAccount) : undefined,
|
|
31
|
+
};
|
|
32
|
+
// Get network-specific codama functions from centralized config
|
|
33
|
+
const instructionsModule = getModule('instructions');
|
|
34
|
+
const programsModule = getModule('programs');
|
|
35
|
+
const { getAcceptRentalInstructionAsync } = instructionsModule;
|
|
36
|
+
const { SRSLY_PROGRAM_ADDRESS } = programsModule;
|
|
37
|
+
const rawInstruction = await getAcceptRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
38
|
+
return createFluentInstruction(rawInstruction);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instruction to accept a rental with fluent configuration.
|
|
6
42
|
*
|
|
7
43
|
* @example
|
|
8
44
|
* ```typescript
|
|
9
|
-
* //
|
|
10
|
-
* const
|
|
45
|
+
* // Works with any library - just use strings for addresses!
|
|
46
|
+
* const instruction = await acceptRental({
|
|
47
|
+
* borrower: wallet, // Can be signer object or string
|
|
48
|
+
* borrowerProfile: "ProfileAddr...", // String address
|
|
49
|
+
* borrowerFaction: 1, // 1 = mud, 2 = oni, 3 = ustur
|
|
50
|
+
* fleet: "FleetAddress123...", // String address
|
|
51
|
+
* contract: "ContractAddr...", // String address
|
|
52
|
+
* rate: 1000, // ATLAS tokens
|
|
53
|
+
* duration: 86400 // 1 day in seconds (total: 1000 * 86400 * 100M stardust)
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // With referral (referrer gets 5% of platform fees)
|
|
57
|
+
* const instruction = await acceptRental({
|
|
11
58
|
* borrower: wallet,
|
|
12
|
-
* borrowerProfile:
|
|
13
|
-
* borrowerFaction: 1,
|
|
14
|
-
* fleet:
|
|
15
|
-
* contract:
|
|
16
|
-
*
|
|
17
|
-
* duration: 86400
|
|
18
|
-
*
|
|
59
|
+
* borrowerProfile: "ProfileAddr...",
|
|
60
|
+
* borrowerFaction: 1,
|
|
61
|
+
* fleet: "FleetAddress123...",
|
|
62
|
+
* contract: "ContractAddr...",
|
|
63
|
+
* rate: 1000,
|
|
64
|
+
* duration: 86400,
|
|
65
|
+
* referralTokenAccount: "ReferralAddr..."
|
|
19
66
|
* });
|
|
20
67
|
*
|
|
21
|
-
* //
|
|
22
|
-
* const
|
|
23
|
-
*
|
|
68
|
+
* // Use mainnet configuration
|
|
69
|
+
* const instruction = await acceptRental(params).set({ programs: 'mainnet' });
|
|
70
|
+
*
|
|
71
|
+
* // Override specific constants
|
|
72
|
+
* const instruction = await acceptRental(params).set({
|
|
73
|
+
* programs: 'mainnet',
|
|
74
|
+
* gameId: 'custom-game-id...'
|
|
75
|
+
* });
|
|
76
|
+
*
|
|
77
|
+
* // Use the instruction with your preferred Solana library
|
|
78
|
+
* // instruction is compatible with both @solana/kit and @solana/web3.js
|
|
24
79
|
* ```
|
|
25
80
|
*
|
|
26
81
|
* @param params The simplified parameters for accepting a rental
|
|
27
|
-
* @returns A
|
|
82
|
+
* @returns A ConfigSelector that can be configured with .set() or awaited directly
|
|
28
83
|
*/
|
|
29
|
-
async function _acceptRental(params, network) {
|
|
30
|
-
const { borrower, borrowerProfile, borrowerFaction, fleet, contract, gameId = DEFAULT_GAME_ID, amount, duration, } = params;
|
|
31
|
-
// Derive the three accounts we need
|
|
32
|
-
const { profileFaction, starbase, starbasePlayer } = await deriveGameAccounts(borrowerProfile, borrowerFaction, gameId);
|
|
33
|
-
// Let codama derive the rest (rentalThread, rentalState, rentalAuthority, etc.)
|
|
34
|
-
const input = {
|
|
35
|
-
borrower,
|
|
36
|
-
borrowerProfile,
|
|
37
|
-
borrowerProfileFaction: profileFaction,
|
|
38
|
-
fleet,
|
|
39
|
-
contract,
|
|
40
|
-
gameId,
|
|
41
|
-
starbase,
|
|
42
|
-
starbasePlayer,
|
|
43
|
-
amount,
|
|
44
|
-
duration,
|
|
45
|
-
};
|
|
46
|
-
// Dynamically import network-specific codama functions
|
|
47
|
-
const codamaModule = await getCachedNetworkModule('instructions');
|
|
48
|
-
const { getAcceptRentalInstructionAsync, SRSLY_PROGRAM_ADDRESS } = codamaModule;
|
|
49
|
-
return getAcceptRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
50
|
-
}
|
|
51
84
|
export function acceptRental(params) {
|
|
52
|
-
|
|
85
|
+
const baseSelector = createConfigSelector((config) => _acceptRental(params, config));
|
|
86
|
+
return createFluentConfigSelector(baseSelector);
|
|
53
87
|
}
|
|
54
88
|
export function getAcceptRentalInstructionAsync(input, options) {
|
|
55
|
-
return
|
|
56
|
-
const
|
|
57
|
-
return
|
|
89
|
+
return createConfigSelector(async (config) => {
|
|
90
|
+
const instructionsModule = getModule('instructions');
|
|
91
|
+
return instructionsModule.getAcceptRentalInstructionAsync(input, options);
|
|
58
92
|
});
|
|
59
93
|
}
|
|
60
94
|
//# sourceMappingURL=accept.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../../src/rental/accept.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../../src/rental/accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAqD,MAAM,gCAAgC,CAAC;AA4DxJ;;GAEG;AACH,KAAK,UAAU,aAAa,CAC1B,MAA0B,EAC1B,MAAsB;IAEtB,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,eAAe,EACf,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,oBAAoB,GACrB,GAAG,MAAM,CAAC;IAEX,sFAAsF;IACtF,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAE9E,oDAAoD;IACpD,4EAA4E;IAC5E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAE3E,oCAAoC;IACpC,MAAM,EACJ,cAAc,EACd,QAAQ,EACR,cAAc,EACf,GAAG,MAAM,kBAAkB,CAC1B,SAAS,CAAC,eAAe,CAAC,EAC1B,eAAe,EACf,YAAY,EACZ,CAAC,EAAE,gBAAgB;IACnB,MAAM,CACP,CAAC;IAEF,gFAAgF;IAChF,MAAM,KAAK,GAAoC;QAC7C,QAAQ,EAAwC,gCAAgC;QAChF,eAAe,EAAE,SAAS,CAAC,eAAe,CAAC,EAAK,gBAAgB;QAChE,sBAAsB,EAAE,cAAc,EAAU,yCAAyC;QACzF,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAyB,gBAAgB;QAChE,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAmB,gBAAgB;QAChE,MAAM,EAAE,YAAY,EAA2B,iBAAiB;QAChE,QAAQ,EAAuC,yCAAyC;QACxF,cAAc,EAAiC,yCAAyC;QACxF,MAAM,EAAyC,eAAe;QAC9D,QAAQ,EAAuC,eAAe;QAC9D,oBAAoB,EAAE,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,SAAS;KACzF,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,+BAA+B,EAAE,GAAG,kBAAkB,CAAC;IAC/D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,MAAM,cAAc,GAAG,MAAM,+BAA+B,CAC1D,KAAY,EACZ,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;IACF,OAAO,uBAAuB,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrF,OAAO,0BAA0B,CAAC,YAAY,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAAU,EAAE,OAAa;IACvE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,+BAA+B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,44 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getModule, createConfigSelector } from '../utils/config';
|
|
2
|
+
import { toAddress } from '../utils/constants';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Internal function to cancel a rental instruction with configuration options
|
|
5
|
+
*/
|
|
6
|
+
async function _cancelRental(params, config) {
|
|
7
|
+
const { borrower, contract, } = params;
|
|
8
|
+
// Let codama derive all the optional accounts
|
|
9
|
+
const input = {
|
|
10
|
+
borrower, // Pass as-is (string or signer)
|
|
11
|
+
contract: toAddress(contract), // Ensure string
|
|
12
|
+
};
|
|
13
|
+
// Get network-specific codama functions from centralized config
|
|
14
|
+
const instructionsModule = getModule('instructions');
|
|
15
|
+
const programsModule = getModule('programs');
|
|
16
|
+
const { getCancelRentalInstructionAsync } = instructionsModule;
|
|
17
|
+
const { SRSLY_PROGRAM_ADDRESS } = programsModule;
|
|
18
|
+
return getCancelRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instruction to cancel a rental with fluent configuration.
|
|
6
22
|
*
|
|
7
23
|
* @example
|
|
8
24
|
* ```typescript
|
|
9
|
-
* //
|
|
10
|
-
* const
|
|
11
|
-
* borrower: wallet,
|
|
12
|
-
* contract:
|
|
25
|
+
* // Works with any library - just use strings for addresses!
|
|
26
|
+
* const instruction = await cancelRental({
|
|
27
|
+
* borrower: wallet, // Can be signer object or string
|
|
28
|
+
* contract: "ContractAddr..." // String address
|
|
13
29
|
* });
|
|
14
30
|
*
|
|
15
|
-
* //
|
|
16
|
-
* const
|
|
17
|
-
*
|
|
31
|
+
* // Use mainnet configuration
|
|
32
|
+
* const instruction = await cancelRental(params).set({ programs: 'mainnet' });
|
|
33
|
+
*
|
|
34
|
+
* // Override specific constants
|
|
35
|
+
* const instruction = await cancelRental(params).set({
|
|
36
|
+
* programs: 'mainnet',
|
|
37
|
+
* sageProgramAddress: 'custom...'
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Use the instruction with your preferred Solana library
|
|
41
|
+
* // instruction is compatible with both @solana/kit and @solana/web3.js
|
|
18
42
|
* ```
|
|
19
43
|
*
|
|
20
44
|
* @param params The simplified parameters for canceling a rental
|
|
21
|
-
* @returns A
|
|
45
|
+
* @returns A ConfigSelector that can be configured with .set() or awaited directly
|
|
22
46
|
*/
|
|
23
|
-
async function _cancelRental(params, network) {
|
|
24
|
-
const { borrower, contract, } = params;
|
|
25
|
-
// Let codama derive all the optional accounts
|
|
26
|
-
const input = {
|
|
27
|
-
borrower,
|
|
28
|
-
contract,
|
|
29
|
-
};
|
|
30
|
-
// Dynamically import network-specific codama functions
|
|
31
|
-
const codamaModule = await getCachedNetworkModule('instructions');
|
|
32
|
-
const { getCancelRentalInstructionAsync, SRSLY_PROGRAM_ADDRESS } = codamaModule;
|
|
33
|
-
return getCancelRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
34
|
-
}
|
|
35
47
|
export function cancelRental(params) {
|
|
36
|
-
return
|
|
48
|
+
return createConfigSelector((config) => _cancelRental(params, config));
|
|
37
49
|
}
|
|
38
50
|
export function getCancelRentalInstructionAsync(input, options) {
|
|
39
|
-
return
|
|
40
|
-
const
|
|
41
|
-
return
|
|
51
|
+
return createConfigSelector(async (config) => {
|
|
52
|
+
const instructionsModule = getModule('instructions');
|
|
53
|
+
return instructionsModule.getCancelRentalInstructionAsync(input, options);
|
|
42
54
|
});
|
|
43
55
|
}
|
|
44
56
|
//# sourceMappingURL=cancel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAsB/C;;GAEG;AACH,KAAK,UAAU,aAAa,CAC1B,MAA0B,EAC1B,MAAsB;IAEtB,MAAM,EACJ,QAAQ,EACR,QAAQ,GACT,GAAG,MAAM,CAAC;IAEX,8CAA8C;IAC9C,MAAM,KAAK,GAAG;QACZ,QAAQ,EAAqB,gCAAgC;QAC7D,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB;KAChD,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,+BAA+B,EAAE,GAAG,kBAAkB,CAAC;IAC/D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,OAAO,+BAA+B,CACpC,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,OAAO,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAAU,EAAE,OAAa;IACvE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,+BAA+B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/rental/close.js
CHANGED
|
@@ -1,46 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getModule, createConfigSelector } from '../utils/config';
|
|
2
|
+
import { toAddress } from '../utils/constants';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Internal function to close a rental instruction with configuration options
|
|
5
|
+
*/
|
|
6
|
+
async function _closeRental(params, config) {
|
|
7
|
+
const { borrower, ownerTokenAccount, contract, } = params;
|
|
8
|
+
// Let codama derive the optional accounts
|
|
9
|
+
const input = {
|
|
10
|
+
borrower: toAddress(borrower), // Ensure string
|
|
11
|
+
ownerTokenAccount: toAddress(ownerTokenAccount), // Ensure string
|
|
12
|
+
contract: toAddress(contract), // Ensure string
|
|
13
|
+
};
|
|
14
|
+
// Get network-specific codama functions from centralized config
|
|
15
|
+
const instructionsModule = getModule('instructions');
|
|
16
|
+
const programsModule = getModule('programs');
|
|
17
|
+
const { getCloseRentalInstructionAsync } = instructionsModule;
|
|
18
|
+
const { SRSLY_PROGRAM_ADDRESS } = programsModule;
|
|
19
|
+
return getCloseRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instruction to close a rental with fluent configuration.
|
|
6
23
|
*
|
|
7
24
|
* @example
|
|
8
25
|
* ```typescript
|
|
9
|
-
* //
|
|
10
|
-
* const
|
|
11
|
-
* borrower:
|
|
12
|
-
* ownerTokenAccount:
|
|
13
|
-
* contract:
|
|
26
|
+
* // Works with any library - just use strings for addresses!
|
|
27
|
+
* const instruction = await closeRental({
|
|
28
|
+
* borrower: "BorrowerAddr...", // String address
|
|
29
|
+
* ownerTokenAccount: "TokenAcct...", // String address
|
|
30
|
+
* contract: "ContractAddr..." // String address
|
|
14
31
|
* });
|
|
15
32
|
*
|
|
16
|
-
* //
|
|
17
|
-
* const
|
|
18
|
-
*
|
|
33
|
+
* // Use mainnet configuration
|
|
34
|
+
* const instruction = await closeRental(params).set({ programs: 'mainnet' });
|
|
35
|
+
*
|
|
36
|
+
* // Override specific constants
|
|
37
|
+
* const instruction = await closeRental(params).set({
|
|
38
|
+
* programs: 'mainnet',
|
|
39
|
+
* sageProgramAddress: 'custom...'
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Use the instruction with your preferred Solana library
|
|
43
|
+
* // instruction is compatible with both @solana/kit and @solana/web3.js
|
|
19
44
|
* ```
|
|
20
45
|
*
|
|
21
46
|
* @param params The simplified parameters for closing a rental
|
|
22
|
-
* @returns A
|
|
47
|
+
* @returns A ConfigSelector that can be configured with .set() or awaited directly
|
|
23
48
|
*/
|
|
24
|
-
async function _closeRental(params, network) {
|
|
25
|
-
const { borrower, ownerTokenAccount, contract, } = params;
|
|
26
|
-
// Let codama derive the optional accounts
|
|
27
|
-
const input = {
|
|
28
|
-
borrower,
|
|
29
|
-
ownerTokenAccount,
|
|
30
|
-
contract,
|
|
31
|
-
};
|
|
32
|
-
// Dynamically import network-specific codama functions
|
|
33
|
-
const codamaModule = await getCachedNetworkModule('instructions');
|
|
34
|
-
const { getCloseRentalInstructionAsync, SRSLY_PROGRAM_ADDRESS } = codamaModule;
|
|
35
|
-
return getCloseRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
36
|
-
}
|
|
37
49
|
export function closeRental(params) {
|
|
38
|
-
return
|
|
50
|
+
return createConfigSelector((config) => _closeRental(params, config));
|
|
39
51
|
}
|
|
40
52
|
export function getCloseRentalInstructionAsync(input, options) {
|
|
41
|
-
return
|
|
42
|
-
const
|
|
43
|
-
return
|
|
53
|
+
return createConfigSelector(async (config) => {
|
|
54
|
+
const instructionsModule = getModule('instructions');
|
|
55
|
+
return instructionsModule.getCloseRentalInstructionAsync(input, options);
|
|
44
56
|
});
|
|
45
57
|
}
|
|
46
58
|
//# sourceMappingURL=close.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.js","sourceRoot":"","sources":["../../../src/rental/close.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"close.js","sourceRoot":"","sources":["../../../src/rental/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0B/C;;GAEG;AACH,KAAK,UAAU,YAAY,CACzB,MAAyB,EACzB,MAAsB;IAEtB,MAAM,EACJ,QAAQ,EACR,iBAAiB,EACjB,QAAQ,GACT,GAAG,MAAM,CAAC;IAEX,0CAA0C;IAC1C,MAAM,KAAK,GAAG;QACZ,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAgB,gBAAgB;QAC7D,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,CAAC,EAAE,gBAAgB;QACjE,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAe,gBAAgB;KAC7D,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,8BAA8B,EAAE,GAAG,kBAAkB,CAAC;IAC9D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,OAAO,8BAA8B,CACnC,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,WAAW,CACzB,MAAyB;IAEzB,OAAO,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,KAAU,EAAE,OAAa;IACtE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,8BAA8B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/rental/reset.js
CHANGED
|
@@ -1,63 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getModule, createConfigSelector } from '../utils/config';
|
|
2
|
+
import { getSageGameId, toAddress } from '../utils/constants';
|
|
3
|
+
import { deriveGameAccounts } from '../utils';
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* Internal function to reset a rental instruction with configuration options
|
|
6
|
+
*/
|
|
7
|
+
async function _resetRental(params, config) {
|
|
8
|
+
const { fleet, contract, rentalState, gameId, faction, ownerProfile, } = params;
|
|
9
|
+
// Get the actual game ID to use (param override, config override, or network default)
|
|
10
|
+
const actualGameId = gameId ? toAddress(gameId) : await getSageGameId(config);
|
|
11
|
+
// Derive the three accounts we need
|
|
12
|
+
const { starbase, starbasePlayer } = await deriveGameAccounts(toAddress(ownerProfile), faction, actualGameId, 0, // starbaseSeqId
|
|
13
|
+
config);
|
|
14
|
+
// Get network-specific codama functions from centralized config
|
|
15
|
+
const instructionsModule = getModule('instructions');
|
|
16
|
+
const programsModule = getModule('programs');
|
|
17
|
+
const { getResetRentalInstructionAsync } = instructionsModule;
|
|
18
|
+
const { SRSLY_PROGRAM_ADDRESS } = programsModule;
|
|
19
|
+
// Let codama derive the rest (rentalAuthority)
|
|
20
|
+
const input = {
|
|
21
|
+
fleet: toAddress(fleet), // Ensure string
|
|
22
|
+
contract: toAddress(contract), // Ensure string
|
|
23
|
+
rentalState: toAddress(rentalState), // Ensure string
|
|
24
|
+
gameId: actualGameId, // Already string
|
|
25
|
+
starbase, // Already string from deriveGameAccounts
|
|
26
|
+
starbasePlayer, // Already string from deriveGameAccounts
|
|
27
|
+
};
|
|
28
|
+
return getResetRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instruction to reset a rental with fluent configuration.
|
|
7
32
|
*
|
|
8
33
|
* @example
|
|
9
34
|
* ```typescript
|
|
10
|
-
* //
|
|
11
|
-
* const
|
|
12
|
-
* fleet:
|
|
13
|
-
* contract:
|
|
14
|
-
* rentalState:
|
|
35
|
+
* // Works with any library - just use strings for addresses!
|
|
36
|
+
* const instruction = await resetRental({
|
|
37
|
+
* fleet: "FleetAddress123...", // String address
|
|
38
|
+
* contract: "ContractAddr...", // String address
|
|
39
|
+
* rentalState: "RentalStateAddr...", // String address
|
|
15
40
|
* faction: 'mud',
|
|
16
|
-
* ownerProfile:
|
|
41
|
+
* ownerProfile: "OwnerProfileAddr..." // String address
|
|
17
42
|
* });
|
|
18
43
|
*
|
|
19
|
-
* //
|
|
20
|
-
* const
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
44
|
+
* // Use mainnet configuration
|
|
45
|
+
* const instruction = await resetRental(params).set({ programs: 'mainnet' });
|
|
46
|
+
*
|
|
47
|
+
* // Override specific constants
|
|
48
|
+
* const instruction = await resetRental(params).set({
|
|
49
|
+
* programs: 'mainnet',
|
|
50
|
+
* gameId: 'custom-game-id...',
|
|
51
|
+
* sageProgramAddress: 'custom...'
|
|
26
52
|
* });
|
|
27
53
|
*
|
|
28
|
-
* //
|
|
29
|
-
*
|
|
30
|
-
* await sendAndConfirmTransaction(connection, tx, [owner]);
|
|
54
|
+
* // Use the instruction with your preferred Solana library
|
|
55
|
+
* // instruction is compatible with both @solana/kit and @solana/web3.js
|
|
31
56
|
* ```
|
|
32
57
|
*
|
|
33
58
|
* @param params The simplified parameters for resetting a rental
|
|
34
|
-
* @returns A
|
|
59
|
+
* @returns A ConfigSelector that can be configured with .set() or awaited directly
|
|
35
60
|
*/
|
|
36
|
-
async function _resetRental(params, network) {
|
|
37
|
-
const { fleet, contract, rentalState, gameId = DEFAULT_GAME_ID, faction, ownerProfile, } = params;
|
|
38
|
-
// Derive the three accounts we need
|
|
39
|
-
const { starbase, starbasePlayer } = await deriveGameAccounts(ownerProfile, faction, gameId);
|
|
40
|
-
// Dynamically import network-specific codama functions
|
|
41
|
-
const codamaModule = await getCachedNetworkModule('instructions');
|
|
42
|
-
const { getResetRentalInstructionAsync, SRSLY_PROGRAM_ADDRESS } = codamaModule;
|
|
43
|
-
// Let codama derive the rest (rentalAuthority)
|
|
44
|
-
const input = {
|
|
45
|
-
fleet,
|
|
46
|
-
contract,
|
|
47
|
-
rentalState,
|
|
48
|
-
gameId,
|
|
49
|
-
starbase,
|
|
50
|
-
starbasePlayer,
|
|
51
|
-
};
|
|
52
|
-
return getResetRentalInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
|
|
53
|
-
}
|
|
54
61
|
export function resetRental(params) {
|
|
55
|
-
return
|
|
62
|
+
return createConfigSelector((config) => _resetRental(params, config));
|
|
56
63
|
}
|
|
57
64
|
export function getResetRentalInstructionAsync(input, options) {
|
|
58
|
-
return
|
|
59
|
-
const
|
|
60
|
-
return
|
|
65
|
+
return createConfigSelector(async (config) => {
|
|
66
|
+
const instructionsModule = getModule('instructions');
|
|
67
|
+
return instructionsModule.getResetRentalInstructionAsync(input, options);
|
|
61
68
|
});
|
|
62
69
|
}
|
|
63
70
|
//# sourceMappingURL=reset.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/rental/reset.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/rental/reset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA6C9C;;GAEG;AACH,KAAK,UAAU,YAAY,CACzB,MAAyB,EACzB,MAAsB;IAEtB,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAO,EACP,YAAY,GACb,GAAG,MAAM,CAAC;IAEX,sFAAsF;IACtF,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAE9E,oCAAoC;IACpC,MAAM,EACJ,QAAQ,EACR,cAAc,EACf,GAAG,MAAM,kBAAkB,CAC1B,SAAS,CAAC,YAAY,CAAC,EACvB,OAAO,EACP,YAAY,EACZ,CAAC,EAAE,gBAAgB;IACnB,MAAM,CACP,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,8BAA8B,EAAE,GAAG,kBAAkB,CAAC;IAC9D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,+CAA+C;IAC/C,MAAM,KAAK,GAAG;QACZ,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAW,gBAAgB;QAClD,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAK,gBAAgB;QAClD,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC,EAAE,gBAAgB;QACrD,MAAM,EAAE,YAAY,EAAa,iBAAiB;QAClD,QAAQ,EAAyB,yCAAyC;QAC1E,cAAc,EAAmB,yCAAyC;KAC3E,CAAC;IAEF,OAAO,8BAA8B,CACnC,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,WAAW,CACzB,MAAyB;IAEzB,OAAO,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,KAAU,EAAE,OAAa;IACtE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,8BAA8B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTO-GENERATED from the Rust PaymentFrequency implementation.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE manually - it will be overwritten.
|
|
4
|
+
*
|
|
5
|
+
* Source: programs/srsly/src/utils.rs
|
|
6
|
+
* Generated by: generate.mjs
|
|
7
|
+
*/
|
|
8
|
+
import { PaymentFrequency } from '../codama/types/paymentFrequency';
|
|
9
|
+
/**
|
|
10
|
+
* Array of all valid payment frequency strings
|
|
11
|
+
* Auto-generated from Rust PaymentFrequency enum
|
|
12
|
+
*/
|
|
13
|
+
export const VALID_PAYMENT_FREQUENCIES = [
|
|
14
|
+
'hourly',
|
|
15
|
+
'daily',
|
|
16
|
+
'weekly',
|
|
17
|
+
'monthly'
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Mapping from user-friendly strings to PaymentFrequency enum values
|
|
21
|
+
* Auto-generated from Rust PaymentFrequency enum
|
|
22
|
+
*/
|
|
23
|
+
export const PAYMENT_FREQUENCY_MAP = {
|
|
24
|
+
'hourly': PaymentFrequency.Hourly,
|
|
25
|
+
'daily': PaymentFrequency.Daily,
|
|
26
|
+
'weekly': PaymentFrequency.Weekly,
|
|
27
|
+
'monthly': PaymentFrequency.Monthly
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Constants extracted from Rust constants.rs
|
|
31
|
+
* Auto-synced with Rust implementation
|
|
32
|
+
*/
|
|
33
|
+
export const PAYMENT_FREQUENCY_CONSTANTS = {
|
|
34
|
+
SECONDS_PER_DECASECOND: 10,
|
|
35
|
+
SECONDS_PER_MINUTE: 60,
|
|
36
|
+
SECONDS_PER_HOUR: 3600,
|
|
37
|
+
SECONDS_PER_DAY: 86400,
|
|
38
|
+
SECONDS_PER_WEEK: 604800,
|
|
39
|
+
SECONDS_PER_MONTH: 2678400
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Get PaymentFrequency enum value from user-friendly string
|
|
43
|
+
*/
|
|
44
|
+
export function getPaymentFrequencyFromString(frequencyString) {
|
|
45
|
+
return PAYMENT_FREQUENCY_MAP[frequencyString];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if a string is a valid payment frequency
|
|
49
|
+
*/
|
|
50
|
+
export function isValidPaymentFrequency(value) {
|
|
51
|
+
return VALID_PAYMENT_FREQUENCIES.includes(value);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=paymentFrequency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paymentFrequency.js","sourceRoot":"","sources":["../../../src/types/paymentFrequency.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAQpE;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsC;IAC1E,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;CACD,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqD;IACrF,QAAQ,EAAE,gBAAgB,CAAC,MAAM;IACjC,OAAO,EAAE,gBAAgB,CAAC,KAAK;IAC/B,QAAQ,EAAE,gBAAgB,CAAC,MAAM;IACjC,SAAS,EAAE,gBAAgB,CAAC,OAAO;CAC3B,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,sBAAsB,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IACtB,gBAAgB,EAAE,IAAI;IACtB,eAAe,EAAE,KAAK;IACtB,gBAAgB,EAAE,MAAM;IACxB,iBAAiB,EAAE,OAAO;CAClB,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,eAAuC;IACnF,OAAO,qBAAqB,CAAC,eAAe,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,OAAO,yBAAyB,CAAC,QAAQ,CAAC,KAA+B,CAAC,CAAC;AAC7E,CAAC"}
|