@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
package/README.md
CHANGED
|
@@ -4,307 +4,432 @@
|
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
5
|
[](https://solana.com/)
|
|
6
6
|
|
|
7
|
-
A TypeScript SDK for
|
|
7
|
+
A TypeScript SDK for building Solana instructions to interact with the SRSLY (Space Rental from SLY) program - a decentralized rental system for Star Atlas fleets.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## What This SDK Does
|
|
10
|
+
|
|
11
|
+
The SRSLY SDK is a focused instruction builder that helps you create Solana instructions for fleet rentals. It provides:
|
|
12
|
+
|
|
13
|
+
- ✅ **Instruction Building** - Creates properly formatted Solana instructions using @solana/kit
|
|
14
|
+
- ✅ **Account derivation and validation** - Automatically derives required accounts
|
|
15
|
+
- ✅ **Instruction data encoding** - Handles all the complex encoding for you
|
|
16
|
+
- ✅ **Type-safe parameter handling** - Full TypeScript support with validation
|
|
17
|
+
- ✅ **Duration helper functions** - `days()`, `weeks()`, `months()` for time calculations
|
|
18
|
+
- ✅ **Default Star Atlas Programs** - Support for mainnet, atlasnet, and holosim
|
|
19
|
+
|
|
20
|
+
**Current Status**: Instruction-only SDK using @solana/kit. Users handle transaction assembly and sending.
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
## Installation
|
|
12
23
|
|
|
13
24
|
```bash
|
|
25
|
+
# Install the SDK (includes @solana/kit as a dependency)
|
|
14
26
|
npm install @wuwei-labs/srsly
|
|
15
27
|
```
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
The SDK uses @solana/kit internally and provides seamless conversion to @solana/web3.js format for browser wallet compatibility.
|
|
18
30
|
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### Using with @solana/kit (Default)
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { createContract, setConfig, days } from '@wuwei-labs/srsly';
|
|
37
|
+
|
|
38
|
+
// 1. Configure SDK for your network
|
|
39
|
+
setConfig({
|
|
40
|
+
programs: 'atlasnet' // or 'mainnet', 'holosim'
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// 2. Create an instruction (returns @solana/kit format by default)
|
|
44
|
+
const instruction = await createContract({
|
|
45
|
+
owner: signer, // Can be a signer object or string address
|
|
46
|
+
fleet: "FleetAddress123...", // String address
|
|
47
|
+
ownerProfile: "ProfileAddr...", // String address
|
|
48
|
+
rate: 1000000, // ATLAS tokens per payment period
|
|
49
|
+
durationMax: days(7), // 7 days using helper function
|
|
50
|
+
paymentsFreq: 'daily' // Payment frequency
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// 3. Add instruction to your transaction and send
|
|
54
|
+
// (Use your preferred transaction building and sending method)
|
|
21
55
|
```
|
|
22
56
|
|
|
23
|
-
###
|
|
57
|
+
### Using with @solana/web3.js (wallet-adapter)
|
|
24
58
|
|
|
25
|
-
```
|
|
26
|
-
|
|
59
|
+
```typescript
|
|
60
|
+
import { createContract, setConfig, days } from '@wuwei-labs/srsly';
|
|
61
|
+
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
62
|
+
|
|
63
|
+
// 1. Configure SDK for your network
|
|
64
|
+
setConfig({ programs: 'atlasnet' });
|
|
65
|
+
|
|
66
|
+
// 2. Create and convert to web3.js format
|
|
67
|
+
const web3jsInstruction = await createContract({
|
|
68
|
+
owner: wallet.publicKey.toString(), // String address
|
|
69
|
+
fleet: "FleetAddress123...", // String address
|
|
70
|
+
ownerProfile: "ProfileAddr...", // String address
|
|
71
|
+
rate: 1000000,
|
|
72
|
+
durationMax: days(7),
|
|
73
|
+
paymentsFreq: 'daily'
|
|
74
|
+
}).web3js(PublicKey); // Convert to web3.js format with PublicKey instances
|
|
75
|
+
|
|
76
|
+
// 3. Add to transaction and send
|
|
77
|
+
const transaction = new Transaction().add(web3jsInstruction);
|
|
78
|
+
const signature = await wallet.sendTransaction(transaction, connection);
|
|
27
79
|
```
|
|
28
80
|
|
|
29
|
-
##
|
|
81
|
+
## Core Features
|
|
82
|
+
|
|
83
|
+
### Instruction Building & Format Conversion
|
|
84
|
+
|
|
85
|
+
The SDK creates @solana/kit compatible instructions with seamless web3.js conversion:
|
|
86
|
+
|
|
87
|
+
- **📦 Instruction-Only**: Focus on instruction building, users handle transaction assembly/sending
|
|
88
|
+
- **🔄 Format Conversion**: Built-in `.web3js(PublicKey)` method for wallet compatibility
|
|
89
|
+
- **🎯 String Addresses**: Simple string-based addressing for all inputs
|
|
90
|
+
- **⚡ Lightweight**: Uses @solana/kit internally with optional web3.js conversion
|
|
91
|
+
|
|
92
|
+
### Web3.js Format Conversion
|
|
93
|
+
|
|
94
|
+
The SDK accepts string addresses as input and provides seamless conversion to @solana/web3.js format for browser wallet compatibility:
|
|
30
95
|
|
|
31
96
|
```typescript
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
97
|
+
import { createContract } from '@wuwei-labs/srsly';
|
|
98
|
+
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
99
|
+
|
|
100
|
+
// Web3.js format with PublicKey instances
|
|
101
|
+
const web3jsInstruction = await createContract({
|
|
102
|
+
owner: "OwnerAddress123...", // String address input
|
|
103
|
+
fleet: "FleetAddress123...", // String address input
|
|
104
|
+
ownerProfile: "ProfileAddr...", // String address input
|
|
105
|
+
rate: 1000000,
|
|
106
|
+
durationMax: days(7),
|
|
107
|
+
paymentsFreq: 'daily'
|
|
108
|
+
}).web3js(PublicKey);
|
|
109
|
+
|
|
110
|
+
// Chain configuration with conversion
|
|
111
|
+
const configuredInstruction = await createContract({
|
|
112
|
+
owner: "OwnerAddress123...",
|
|
113
|
+
fleet: "FleetAddress123...",
|
|
114
|
+
ownerProfile: "ProfileAddr...",
|
|
115
|
+
rate: 1000000,
|
|
116
|
+
durationMax: days(7),
|
|
117
|
+
paymentsFreq: 'daily'
|
|
118
|
+
}).set({ programs: 'mainnet' })
|
|
119
|
+
.web3js(PublicKey);
|
|
120
|
+
|
|
121
|
+
// Use in transactions
|
|
122
|
+
const transaction = new Transaction().add(web3jsInstruction);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Key points:**
|
|
40
126
|
|
|
41
|
-
|
|
42
|
-
|
|
127
|
+
- SDK inputs are always **string addresses**
|
|
128
|
+
- `.web3js(PublicKey)` converts output to web3.js format with PublicKey instances
|
|
129
|
+
- Use when working with browser wallets (Phantom, Solflare, etc.)
|
|
43
130
|
|
|
44
|
-
|
|
45
|
-
|
|
131
|
+
### Duration Helper Functions
|
|
132
|
+
|
|
133
|
+
The SDK provides convenient helper functions for converting time units to seconds:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { days, weeks, months, hours, minutes, duration } from '@wuwei-labs/srsly';
|
|
137
|
+
|
|
138
|
+
// Individual helper functions
|
|
139
|
+
const sevenDays = days(7); // 604800 seconds
|
|
140
|
+
const twoWeeks = weeks(2); // 1209600 seconds
|
|
141
|
+
const oneMonth = months(1); // 2678400 seconds (31 days)
|
|
142
|
+
const sixHours = hours(6); // 21600 seconds
|
|
143
|
+
const thirtyMinutes = minutes(30); // 1800 seconds
|
|
144
|
+
|
|
145
|
+
// Using in contract creation
|
|
146
|
+
const contract = await createContract({
|
|
46
147
|
owner: wallet,
|
|
47
148
|
fleet: fleetAddress,
|
|
48
149
|
ownerProfile: profileAddress,
|
|
49
|
-
rate: 1000000,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
paymentsFreq: 'daily',
|
|
53
|
-
ownerKeyIndex: 0
|
|
150
|
+
rate: 1000000,
|
|
151
|
+
durationMax: weeks(2), // 2 weeks maximum
|
|
152
|
+
paymentsFreq: 'daily'
|
|
54
153
|
});
|
|
55
154
|
|
|
56
|
-
//
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
155
|
+
// Alternative: use the duration object
|
|
156
|
+
const anotherContract = await createContract({
|
|
157
|
+
owner: wallet,
|
|
158
|
+
fleet: fleetAddress,
|
|
159
|
+
ownerProfile: profileAddress,
|
|
160
|
+
rate: 500000,
|
|
161
|
+
durationMax: duration.months(3), // 3 months maximum
|
|
162
|
+
paymentsFreq: 'weekly'
|
|
163
|
+
});
|
|
60
164
|
|
|
61
|
-
|
|
165
|
+
// You can still use raw seconds if preferred
|
|
166
|
+
const rawContract = await createContract({
|
|
167
|
+
owner: wallet,
|
|
168
|
+
fleet: fleetAddress,
|
|
169
|
+
ownerProfile: profileAddress,
|
|
170
|
+
rate: 750000,
|
|
171
|
+
durationMax: 86400, // Raw 86400 seconds (1 day)
|
|
172
|
+
paymentsFreq: 'daily'
|
|
173
|
+
});
|
|
174
|
+
```
|
|
62
175
|
|
|
63
176
|
### Contract Management
|
|
64
177
|
|
|
65
|
-
Create and manage rental contracts for Star Atlas:
|
|
66
|
-
|
|
67
178
|
```typescript
|
|
68
|
-
import { createContract, closeContract } from '@wuwei-labs/srsly';
|
|
179
|
+
import { createContract, closeContract, days, months } from '@wuwei-labs/srsly';
|
|
69
180
|
|
|
70
|
-
// Create
|
|
181
|
+
// Create rental contract instruction
|
|
71
182
|
const createIx = await createContract({
|
|
72
183
|
owner: wallet,
|
|
73
184
|
fleet: fleetAddress,
|
|
74
185
|
ownerProfile: profileAddress,
|
|
75
|
-
rate: 5000000,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// Close an existing contract using global network setting (direct await)
|
|
186
|
+
rate: 5000000,
|
|
187
|
+
durationMax: months(1), // 30 days using helper function
|
|
188
|
+
paymentsFreq: 'daily'
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Close contract instruction
|
|
83
192
|
const closeIx = await closeContract({
|
|
84
193
|
owner: wallet,
|
|
85
194
|
fleet: fleetAddress,
|
|
86
|
-
contract: contractAddress
|
|
87
|
-
faction: 'mud',
|
|
88
|
-
ownerProfile: profileAddress
|
|
195
|
+
contract: contractAddress
|
|
89
196
|
});
|
|
90
197
|
```
|
|
91
198
|
|
|
92
199
|
### Rental Operations
|
|
93
200
|
|
|
94
|
-
Handle rental lifecycle operations:
|
|
95
|
-
|
|
96
201
|
```typescript
|
|
97
|
-
import {
|
|
98
|
-
|
|
99
|
-
cancelRental,
|
|
100
|
-
closeRental,
|
|
101
|
-
resetRental
|
|
102
|
-
} from '@wuwei-labs/srsly';
|
|
202
|
+
import { acceptRental, cancelRental, closeRental, resetRental } from '@wuwei-labs/srsly';
|
|
203
|
+
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
103
204
|
|
|
104
|
-
// Accept
|
|
205
|
+
// Accept rental offer instruction (all addresses are strings)
|
|
105
206
|
const acceptIx = await acceptRental({
|
|
106
|
-
borrower: borrowerWallet,
|
|
107
|
-
borrowerProfile: borrowerProfileAddress,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
207
|
+
borrower: borrowerWallet, // signer object or string address
|
|
208
|
+
borrowerProfile: borrowerProfileAddress, // string address
|
|
209
|
+
borrowerFaction: 'mud', // or 1, 2, 3
|
|
210
|
+
fleet: fleetAddress, // string address
|
|
211
|
+
contract: contractAddress, // string address
|
|
212
|
+
rate: 100, // ATLAS per payment period (based on contract's payment frequency)
|
|
213
|
+
duration: 86400 // Duration in seconds (must be between contract's min/max)
|
|
214
|
+
});
|
|
113
215
|
|
|
114
|
-
// Cancel
|
|
216
|
+
// Cancel active rental instruction
|
|
115
217
|
const cancelIx = await cancelRental({
|
|
116
218
|
borrower: borrowerWallet,
|
|
117
|
-
|
|
219
|
+
contract: contractAddress,
|
|
220
|
+
rentalState: rentalStateAddress
|
|
118
221
|
});
|
|
119
222
|
|
|
120
|
-
// Close
|
|
223
|
+
// Close completed rental instruction
|
|
121
224
|
const closeIx = await closeRental({
|
|
122
225
|
borrower: borrowerWallet,
|
|
123
|
-
|
|
124
|
-
|
|
226
|
+
contract: contractAddress,
|
|
227
|
+
rentalState: rentalStateAddress,
|
|
228
|
+
ownerTokenAccount: ownerTokenAccountAddress
|
|
229
|
+
});
|
|
125
230
|
|
|
126
|
-
// Reset rental
|
|
231
|
+
// Reset rental instruction
|
|
127
232
|
const resetIx = await resetRental({
|
|
128
|
-
|
|
233
|
+
borrower: borrowerWallet,
|
|
129
234
|
contract: contractAddress,
|
|
130
|
-
rentalState: rentalStateAddress
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
235
|
+
rentalState: rentalStateAddress
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// Convert any instruction to web3.js format for wallet compatibility
|
|
239
|
+
const web3jsAcceptIx = await acceptRental(params).web3js(PublicKey);
|
|
240
|
+
const web3jsCancelIx = await cancelRental(params).web3js(PublicKey);
|
|
241
|
+
|
|
242
|
+
// Use in web3.js transactions
|
|
243
|
+
const transaction = new Transaction()
|
|
244
|
+
.add(web3jsAcceptIx)
|
|
245
|
+
.add(web3jsCancelIx);
|
|
134
246
|
```
|
|
135
247
|
|
|
136
|
-
|
|
248
|
+
## Configuration
|
|
137
249
|
|
|
138
|
-
|
|
250
|
+
The SDK provides simple configuration for different networks:
|
|
139
251
|
|
|
140
252
|
```typescript
|
|
141
|
-
import {
|
|
142
|
-
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
|
|
253
|
+
import { setConfig, getConfig, clearConfig } from '@wuwei-labs/srsly';
|
|
254
|
+
|
|
255
|
+
// Set network configuration
|
|
256
|
+
setConfig({
|
|
257
|
+
programs: 'atlasnet', // 'mainnet' | 'atlasnet' | 'holosim'
|
|
258
|
+
srslyProgramAddress: 'custom-program-address...', // Optional override
|
|
259
|
+
profileFactionProgramAddress: 'custom-profile-program...', // Optional override
|
|
260
|
+
gameId: 'custom-game-id...', // Optional override
|
|
261
|
+
atlasMint: 'custom-atlas-mint...' // Optional override
|
|
262
|
+
});
|
|
146
263
|
|
|
147
|
-
|
|
148
|
-
|
|
264
|
+
// Simple network configurations
|
|
265
|
+
setConfig({ programs: 'mainnet' });
|
|
266
|
+
setConfig({ programs: 'atlasnet' });
|
|
267
|
+
setConfig({ programs: 'holosim' });
|
|
149
268
|
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
const rentalState = RentalState.fromAccountInfo(rentalAccount)[0];
|
|
269
|
+
// Check current configuration
|
|
270
|
+
console.log(getConfig());
|
|
153
271
|
|
|
154
|
-
|
|
155
|
-
|
|
272
|
+
// Reset to defaults
|
|
273
|
+
clearConfig();
|
|
156
274
|
```
|
|
157
275
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
- **Program ID**: `SRSLY1fq9TJqCk1gNSE7VZL2bztvTn9wm4VR8u8jMKT`
|
|
161
|
-
- **Network**: Solana Mainnet or Atlasnet
|
|
162
|
-
- **Built with**: Anchor Framework
|
|
163
|
-
|
|
164
|
-
## Payment Frequencies
|
|
165
|
-
|
|
166
|
-
The SDK supports multiple payment frequencies:
|
|
167
|
-
|
|
168
|
-
- `daily` - Daily payments
|
|
169
|
-
- `weekly` - Weekly payments
|
|
170
|
-
- `monthly` - Monthly payments
|
|
276
|
+
### Configuration Options
|
|
171
277
|
|
|
172
|
-
|
|
278
|
+
| Option | Type | Description | Default |
|
|
279
|
+
|--------|------|-------------|---------|
|
|
280
|
+
| `programs` | `'mainnet' \| 'atlasnet' \| 'holosim'` | Predefined program address set | `'atlasnet'` |
|
|
281
|
+
| `srslyProgramAddress` | `string` | SRSLY program address override | From program set |
|
|
282
|
+
| `profileFactionProgramAddress` | `string` | Profile Faction program override | From program set |
|
|
283
|
+
| `gameId` | `string` | SAGE game ID override | From program set |
|
|
284
|
+
| `atlasMint` | `string` | ATLAS token mint override | From program set |
|
|
173
285
|
|
|
174
|
-
|
|
286
|
+
## Duration and Payment Frequency
|
|
175
287
|
|
|
176
|
-
|
|
177
|
-
import { SrslyError } from '@wuwei-labs/srsly';
|
|
288
|
+
**Important**: All durations must be aligned with the payment frequency to ensure proper payment calculations.
|
|
178
289
|
|
|
179
|
-
|
|
180
|
-
const instruction = await createContract({...});
|
|
181
|
-
} catch (error) {
|
|
182
|
-
if (error instanceof SrslyError) {
|
|
183
|
-
console.error('SRSLY Error:', error.message);
|
|
184
|
-
console.error('Error code:', error.code);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
```
|
|
290
|
+
### Duration Rules
|
|
188
291
|
|
|
189
|
-
|
|
292
|
+
1. **Duration Units**: All durations are specified in seconds
|
|
293
|
+
2. **Alignment Requirement**: Durations must be multiples of the payment frequency interval
|
|
294
|
+
3. **Validation**: The SDK automatically validates duration alignment and throws an error if invalid
|
|
190
295
|
|
|
191
|
-
|
|
296
|
+
### Payment Frequency Intervals
|
|
192
297
|
|
|
193
|
-
|
|
298
|
+
| Frequency | Interval | Example Valid Durations |
|
|
299
|
+
|-----------|----------|------------------------|
|
|
300
|
+
| `hourly` | 3,600 seconds (1 hour) | 3,600 (1h), 7,200 (2h), 86,400 (24h) |
|
|
301
|
+
| `daily` | 86,400 seconds (1 day) | 86,400 (1d), 172,800 (2d), 604,800 (7d) |
|
|
302
|
+
| `weekly` | 604,800 seconds (1 week) | 604,800 (1w), 1,209,600 (2w), 2,419,200 (4w) |
|
|
303
|
+
| `monthly` | 2,678,400 seconds (31 days) | 2,678,400 (1m), 5,356,800 (2m) |
|
|
194
304
|
|
|
195
|
-
|
|
305
|
+
### Examples
|
|
196
306
|
|
|
197
307
|
```typescript
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
//
|
|
201
|
-
|
|
308
|
+
// ✅ Valid: 7 day max duration with daily payments
|
|
309
|
+
await createContract({
|
|
310
|
+
durationMax: 604800, // 7 days (604800 % 86400 = 0) ✓
|
|
311
|
+
paymentsFreq: 'daily' // Min duration automatically set to 1 day
|
|
312
|
+
});
|
|
202
313
|
|
|
203
|
-
//
|
|
204
|
-
|
|
314
|
+
// ❌ Invalid: 3.5 day max duration with daily payments
|
|
315
|
+
await createContract({
|
|
316
|
+
durationMax: 302400, // 3.5 days (302400 % 86400 = 43200) ✗
|
|
317
|
+
paymentsFreq: 'daily'
|
|
318
|
+
});
|
|
319
|
+
// Error: Duration (302400 seconds) must be a multiple of daily frequency (86400 seconds)
|
|
205
320
|
|
|
206
|
-
//
|
|
207
|
-
|
|
321
|
+
// ✅ Valid: Hourly payments with hour-aligned max duration
|
|
322
|
+
await createContract({
|
|
323
|
+
durationMax: 172800, // 48 hours (172800 % 3600 = 0) ✓
|
|
324
|
+
paymentsFreq: 'hourly' // Min duration automatically set to 1 hour
|
|
325
|
+
});
|
|
208
326
|
```
|
|
209
327
|
|
|
210
|
-
###
|
|
211
|
-
|
|
212
|
-
Override the network for specific instructions using the fluent interface:
|
|
328
|
+
### Rate Calculation
|
|
213
329
|
|
|
214
|
-
|
|
215
|
-
|
|
330
|
+
The `rate` parameter in contracts represents ATLAS tokens per payment period:
|
|
331
|
+
- For `daily` frequency: rate is ATLAS per day
|
|
332
|
+
- For `weekly` frequency: rate is ATLAS per week
|
|
333
|
+
- For `hourly` frequency: rate is ATLAS per hour
|
|
216
334
|
|
|
217
|
-
|
|
218
|
-
const mainnetIx = await createContract(params).mainnet();
|
|
335
|
+
## Payment System
|
|
219
336
|
|
|
220
|
-
|
|
221
|
-
const devnetIx = await createContract(params).devnet();
|
|
337
|
+
SRSLY implements an escrow-based payment system:
|
|
222
338
|
|
|
223
|
-
|
|
224
|
-
|
|
339
|
+
1. **Escrow**: Borrower deposits full rental amount upfront
|
|
340
|
+
2. **Periodic Payments**: Automated payments based on frequency (daily/weekly/monthly)
|
|
341
|
+
3. **Fees**: 10% platform fee, optional 10% referral sharing
|
|
342
|
+
4. **Refunds**: Pro-rata refunds for early cancellation (24-hour minimum)
|
|
225
343
|
|
|
226
|
-
|
|
227
|
-
|
|
344
|
+
```typescript
|
|
345
|
+
// Payment calculation example
|
|
346
|
+
const rate = 1000; // ATLAS per payment period
|
|
347
|
+
const paymentFrequency = 'daily'; // Payment every 86400 seconds
|
|
348
|
+
const duration = days(7); // 7 days using helper function
|
|
349
|
+
const paymentPeriods = duration / days(1); // 7 periods
|
|
350
|
+
const totalAmount = rate * paymentPeriods * ATLAS_TO_STARDUST; // Total in stardust
|
|
228
351
|
```
|
|
229
352
|
|
|
230
|
-
|
|
353
|
+
## Program Sets Reference
|
|
231
354
|
|
|
232
|
-
|
|
355
|
+
The SDK includes predefined program address sets for different networks:
|
|
233
356
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
357
|
+
| Network | SAGE Program | Game ID | ATLAS Mint |
|
|
358
|
+
|---------|--------------|---------|------------|
|
|
359
|
+
| `mainnet` | `SAGE2HAwep459SNq61LHvjxPk4pLPEJLoMETef7f7EE` | `GAMEzqJehF8yAnKiTARUuhZMvLvkZVAsCVri5vSfemLr` | `ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx` |
|
|
360
|
+
| `atlasnet` | `SAgeTraQfBMdvGVDJYoEvjnbq5szW7RJPi6obDTDQUF` | `GAMEC7U7cqmFFaRow33j1LwuV8u4YhAS1mJ5Dqjnar2k` | `ATLA5nAaVRfH6BNwD4SAyWp96EdQaAh6bBmGeTx956sx` |
|
|
361
|
+
| `holosim` | `SAgeTraQfBMdvGVDJYoEvjnbq5szW7RJPi6obDTDQUF` | `GAMEC7U7cqmFFaRow33j1LwuV8u4YhAS1mJ5Dqjnar2k` | `ATLA5nAaVRfH6BNwD4SAyWp96EdQaAh6bBmGeTx956sx` |
|
|
239
362
|
|
|
240
|
-
|
|
241
|
-
- `.mainnet()` - Build with mainnet configuration
|
|
242
|
-
- `.devnet()` - Build with devnet configuration
|
|
243
|
-
- `.network(network)` - Build with specified network
|
|
244
|
-
- `.build()` - Build with current global network setting (explicit)
|
|
363
|
+
## Types and Constants
|
|
245
364
|
|
|
246
365
|
```typescript
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
366
|
+
import type {
|
|
367
|
+
ContractState,
|
|
368
|
+
RentalState,
|
|
369
|
+
ConfigOptions,
|
|
370
|
+
PaymentFrequency
|
|
371
|
+
} from '@wuwei-labs/srsly';
|
|
253
372
|
|
|
254
|
-
|
|
373
|
+
import {
|
|
374
|
+
ATLAS_TO_STARDUST,
|
|
375
|
+
FACTION_MAPPING,
|
|
376
|
+
days,
|
|
377
|
+
weeks,
|
|
378
|
+
months,
|
|
379
|
+
duration
|
|
380
|
+
} from '@wuwei-labs/srsly';
|
|
255
381
|
|
|
256
|
-
|
|
382
|
+
// Conversion rate: 1 ATLAS = 100,000,000 stardust
|
|
383
|
+
console.log(ATLAS_TO_STARDUST); // 100_000_000
|
|
257
384
|
|
|
258
|
-
|
|
385
|
+
// Faction mappings
|
|
386
|
+
console.log(FACTION_MAPPING[1]); // 'mud'
|
|
387
|
+
console.log(FACTION_MAPPING[2]); // 'oni'
|
|
388
|
+
console.log(FACTION_MAPPING[3]); // 'ustur'
|
|
259
389
|
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
|
|
390
|
+
// Duration helper functions
|
|
391
|
+
console.log(days(7)); // 604800 (7 days in seconds)
|
|
392
|
+
console.log(weeks(2)); // 1209600 (2 weeks in seconds)
|
|
393
|
+
console.log(months(1)); // 2678400 (1 month in seconds)
|
|
394
|
+
console.log(duration.hours(12)); // 43200 (12 hours in seconds)
|
|
395
|
+
```
|
|
263
396
|
|
|
264
|
-
|
|
265
|
-
import devnetIdl from '@wuwei-labs/srsly/idl/devnet';
|
|
397
|
+
## IDL and Program Information
|
|
266
398
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
399
|
+
```typescript
|
|
400
|
+
// Access program IDL
|
|
401
|
+
import idl from '@wuwei-labs/srsly/idl';
|
|
270
402
|
```
|
|
271
403
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
Import TypeScript types that match your target network:
|
|
404
|
+
## Error Handling
|
|
275
405
|
|
|
276
406
|
```typescript
|
|
277
|
-
import
|
|
278
|
-
ContractState,
|
|
279
|
-
RentalState,
|
|
280
|
-
PaymentFrequency,
|
|
281
|
-
ClockData,
|
|
282
|
-
ThreadResponse
|
|
283
|
-
} from '@wuwei-labs/srsly';
|
|
407
|
+
import { SrslyError } from '@wuwei-labs/srsly';
|
|
284
408
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
409
|
+
try {
|
|
410
|
+
const instruction = await createContract(params);
|
|
411
|
+
// Add to transaction and send...
|
|
412
|
+
} catch (error) {
|
|
413
|
+
if (error instanceof SrslyError) {
|
|
414
|
+
console.error('SRSLY SDK Error:', error.message, error.code);
|
|
415
|
+
} else {
|
|
416
|
+
console.error('Other Error:', error);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
288
419
|
```
|
|
289
420
|
|
|
290
|
-
|
|
421
|
+
## Package Structure
|
|
291
422
|
|
|
292
|
-
|
|
423
|
+
The SDK provides optimized builds for different environments:
|
|
293
424
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
425
|
+
- **CommonJS**: `./dist/cjs/` (Node.js, webpack)
|
|
426
|
+
- **ESM**: `./dist/esm/` (Modern ES modules)
|
|
427
|
+
- **Types**: `./dist/types/` (TypeScript definitions)
|
|
428
|
+
- **Codama**: `./dist/*/codama/` (Generated Solana program interfaces)
|
|
429
|
+
- **IDL**: `./target/idl/srsly.json` (Anchor IDL)
|
|
430
|
+
- **Types**: `./target/types/srsly.ts` (Generated types)
|
|
297
431
|
|
|
298
|
-
|
|
299
|
-
pnpm run generate:devnet
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
## Documentation
|
|
432
|
+
## Links
|
|
303
433
|
|
|
434
|
+
- **NPM Package**: [@wuwei-labs/srsly](https://www.npmjs.com/package/@wuwei-labs/srsly)
|
|
304
435
|
- **TypeDoc Documentation**: [API Reference](https://wuwei-labs.github.io/srsly/)
|
|
305
|
-
|
|
306
|
-
## Related Projects
|
|
307
|
-
|
|
308
|
-
- **Star Atlas**: The metaverse gaming ecosystem
|
|
309
|
-
- **Solana**: The blockchain platform powering SRSLY
|
|
310
|
-
- **Anchor**: The framework used to build the SRSLY program
|