@wuwei-labs/srsly 2.0.0-beta.7 → 2.3.3-canary.36.16828734028.0
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 +370 -505
- package/dist/cjs/config/index.js +12 -0
- package/dist/cjs/config/index.js.map +1 -0
- package/dist/cjs/config/initialize.js +95 -0
- package/dist/cjs/config/initialize.js.map +1 -0
- package/dist/cjs/config/update.js +163 -0
- package/dist/cjs/config/update.js.map +1 -0
- package/dist/cjs/contract/close.js +128 -67
- package/dist/cjs/contract/close.js.map +1 -1
- package/dist/cjs/contract/create.js +232 -43
- package/dist/cjs/contract/create.js.map +1 -1
- package/dist/cjs/contract/index.js +49 -0
- package/dist/cjs/contract/index.js.map +1 -1
- package/dist/cjs/demos.js +69 -0
- package/dist/cjs/demos.js.map +1 -0
- package/dist/cjs/generated/codama/accounts/configState.js +123 -0
- package/dist/cjs/generated/codama/accounts/configState.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/accounts/contractState.js +47 -9
- package/dist/cjs/generated/codama/accounts/contractState.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/accounts/index.js +1 -1
- package/dist/cjs/generated/codama/accounts/index.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/accounts/rentalState.js +49 -11
- package/dist/cjs/generated/codama/accounts/rentalState.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/accounts/thread.js +42 -5
- package/dist/cjs/generated/codama/accounts/thread.js.map +1 -0
- package/dist/cjs/generated/codama/errors/index.js.map +1 -0
- package/dist/cjs/generated/codama/errors/srsly.js +101 -0
- package/dist/cjs/generated/codama/errors/srsly.js.map +1 -0
- package/dist/cjs/generated/codama/index.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/instructions/acceptRental.js +18 -43
- package/dist/cjs/generated/codama/instructions/acceptRental.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/instructions/cancelRental.js +66 -34
- package/dist/cjs/generated/codama/instructions/cancelRental.js.map +1 -0
- package/dist/cjs/{codama/devnet/instructions/resetRental.js → generated/codama/instructions/closeContract.js} +29 -38
- package/dist/cjs/generated/codama/instructions/closeContract.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/instructions/closeRental.js +89 -44
- package/dist/cjs/generated/codama/instructions/closeRental.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/instructions/createContract.js +13 -16
- package/dist/cjs/generated/codama/instructions/createContract.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/instructions/index.js +2 -0
- package/dist/cjs/generated/codama/instructions/index.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/initializeConfig.js +139 -0
- package/dist/cjs/generated/codama/instructions/initializeConfig.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/instructions/payRental.js +14 -71
- package/dist/cjs/generated/codama/instructions/payRental.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/instructions/resetRental.js +11 -10
- package/dist/cjs/generated/codama/instructions/resetRental.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/updateConfig.js +143 -0
- package/dist/cjs/generated/codama/instructions/updateConfig.js.map +1 -0
- package/dist/cjs/generated/codama/programs/index.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/programs/srsly.js +15 -7
- package/dist/cjs/generated/codama/programs/srsly.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/shared/index.js +1 -1
- package/dist/cjs/generated/codama/shared/index.js.map +1 -0
- package/dist/cjs/generated/codama/types/clockData.js +58 -0
- package/dist/cjs/generated/codama/types/clockData.js.map +1 -0
- package/dist/cjs/generated/codama/types/equality.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/types/execContext.js +31 -1
- package/dist/cjs/generated/codama/types/execContext.js.map +1 -0
- package/dist/cjs/{codama/devnet → generated/codama}/types/index.js +1 -0
- package/dist/cjs/generated/codama/types/index.js.map +1 -0
- package/dist/cjs/generated/codama/types/paymentFrequency.js +36 -0
- package/dist/cjs/generated/codama/types/paymentFrequency.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/types/serializableAccount.js +28 -1
- package/dist/cjs/generated/codama/types/serializableAccount.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/types/serializableInstruction.js +28 -1
- package/dist/cjs/generated/codama/types/serializableInstruction.js.map +1 -0
- package/dist/cjs/{codama/mainnet → generated/codama}/types/threadResponse.js +31 -1
- package/dist/cjs/generated/codama/types/threadResponse.js.map +1 -0
- package/dist/cjs/generated/codama/types/trigger.js.map +1 -0
- package/dist/cjs/generated/codama/types/triggerContext.js.map +1 -0
- package/dist/cjs/idl/index.js +27 -0
- package/dist/cjs/idl/index.js.map +1 -0
- package/dist/cjs/idl/srsly-data.js +3140 -0
- package/dist/cjs/idl/srsly-data.js.map +1 -0
- package/dist/cjs/idl/srsly.json +3104 -0
- package/dist/cjs/index.js +244 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +63 -0
- package/dist/cjs/rental/accept.js +228 -55
- package/dist/cjs/rental/accept.js.map +1 -1
- package/dist/cjs/rental/cancel.js +155 -25
- package/dist/cjs/rental/cancel.js.map +1 -1
- package/dist/cjs/rental/close.js +157 -29
- package/dist/cjs/rental/close.js.map +1 -1
- package/dist/cjs/rental/index.js +84 -0
- package/dist/cjs/rental/index.js.map +1 -1
- package/dist/cjs/rental/reset.js +159 -36
- package/dist/cjs/rental/reset.js.map +1 -1
- package/dist/cjs/types/payment-frequency.js +87 -0
- package/dist/cjs/types/payment-frequency.js.map +1 -0
- package/dist/cjs/types/srsly.js +3 -0
- package/dist/cjs/types/srsly.js.map +1 -0
- package/dist/cjs/utils/config.js +142 -100
- package/dist/cjs/utils/config.js.map +1 -1
- package/dist/cjs/utils/constants.js +45 -81
- package/dist/cjs/utils/constants.js.map +1 -1
- package/dist/cjs/utils/cron.js +204 -0
- package/dist/cjs/utils/cron.js.map +1 -0
- package/dist/cjs/utils/derive-pda.js +415 -0
- package/dist/cjs/utils/derive-pda.js.map +1 -0
- package/dist/cjs/utils/fetch-accounts.js +241 -0
- package/dist/cjs/utils/fetch-accounts.js.map +1 -0
- package/dist/cjs/utils/index.js +14 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/instruction-converter.js +125 -0
- package/dist/cjs/utils/instruction-converter.js.map +1 -0
- package/dist/cjs/utils/param-converters.js +190 -0
- package/dist/cjs/utils/param-converters.js.map +1 -0
- package/dist/cjs/utils/payment-frequency.js +111 -0
- package/dist/cjs/utils/payment-frequency.js.map +1 -0
- package/dist/cjs/utils/schedule-builder.js +158 -0
- package/dist/cjs/utils/schedule-builder.js.map +1 -0
- package/dist/cjs/utils/schedule-validation.js +136 -0
- package/dist/cjs/utils/schedule-validation.js.map +1 -0
- package/dist/cjs/utils/signer.js +127 -0
- package/dist/cjs/utils/signer.js.map +1 -0
- package/dist/cjs/utils/smart-params.js +52 -0
- package/dist/cjs/utils/smart-params.js.map +1 -0
- package/dist/esm/config/index.js +7 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/initialize.js +92 -0
- package/dist/esm/config/initialize.js.map +1 -0
- package/dist/esm/config/update.js +159 -0
- package/dist/esm/config/update.js.map +1 -0
- package/dist/esm/contract/close.js +130 -70
- package/dist/esm/contract/close.js.map +1 -1
- package/dist/esm/contract/create.js +233 -44
- package/dist/esm/contract/create.js.map +1 -1
- package/dist/esm/contract/index.js +51 -2
- package/dist/esm/contract/index.js.map +1 -1
- package/dist/esm/demos.js +26 -0
- package/dist/esm/demos.js.map +1 -0
- package/dist/esm/generated/codama/accounts/configState.js +111 -0
- package/dist/esm/generated/codama/accounts/configState.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/accounts/contractState.js +48 -10
- package/dist/esm/generated/codama/accounts/contractState.js.map +1 -0
- package/dist/esm/{codama/devnet → generated/codama}/accounts/index.js +1 -1
- package/dist/esm/generated/codama/accounts/index.js.map +1 -0
- package/dist/esm/generated/codama/accounts/rentalState.js +113 -0
- package/dist/esm/generated/codama/accounts/rentalState.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/accounts/thread.js +43 -6
- package/dist/esm/generated/codama/accounts/thread.js.map +1 -0
- package/dist/esm/generated/codama/errors/index.js.map +1 -0
- package/dist/esm/generated/codama/errors/srsly.js +96 -0
- package/dist/esm/generated/codama/errors/srsly.js.map +1 -0
- package/dist/esm/generated/codama/index.js.map +1 -0
- package/dist/esm/{codama/devnet → generated/codama}/instructions/acceptRental.js +18 -43
- package/dist/esm/generated/codama/instructions/acceptRental.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/instructions/cancelRental.js +66 -34
- package/dist/esm/generated/codama/instructions/cancelRental.js.map +1 -0
- package/dist/esm/{codama/devnet/instructions/resetRental.js → generated/codama/instructions/closeContract.js} +21 -30
- package/dist/esm/generated/codama/instructions/closeContract.js.map +1 -0
- package/dist/esm/{codama/devnet → generated/codama}/instructions/closeRental.js +89 -44
- package/dist/esm/generated/codama/instructions/closeRental.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/instructions/createContract.js +13 -16
- package/dist/esm/generated/codama/instructions/createContract.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/instructions/index.js +2 -0
- package/dist/esm/generated/codama/instructions/index.js.map +1 -0
- package/dist/esm/generated/codama/instructions/initializeConfig.js +129 -0
- package/dist/esm/generated/codama/instructions/initializeConfig.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/instructions/payRental.js +16 -73
- package/dist/esm/generated/codama/instructions/payRental.js.map +1 -0
- package/dist/esm/{codama/mainnet → generated/codama}/instructions/resetRental.js +11 -10
- package/dist/esm/generated/codama/instructions/resetRental.js.map +1 -0
- package/dist/esm/generated/codama/instructions/updateConfig.js +133 -0
- package/dist/esm/generated/codama/instructions/updateConfig.js.map +1 -0
- package/dist/esm/generated/codama/programs/index.js.map +1 -0
- package/dist/esm/{codama/devnet → generated/codama}/programs/srsly.js +15 -7
- package/dist/esm/generated/codama/programs/srsly.js.map +1 -0
- package/dist/esm/{codama/devnet → generated/codama}/shared/index.js +1 -1
- package/dist/esm/generated/codama/shared/index.js.map +1 -0
- package/dist/esm/generated/codama/types/clockData.js +53 -0
- package/dist/esm/generated/codama/types/clockData.js.map +1 -0
- package/dist/esm/generated/codama/types/equality.js.map +1 -0
- package/dist/esm/generated/codama/types/execContext.js +63 -0
- package/dist/esm/generated/codama/types/execContext.js.map +1 -0
- package/dist/esm/{codama/devnet → generated/codama}/types/index.js +1 -0
- package/dist/esm/generated/codama/types/index.js.map +1 -0
- package/dist/esm/generated/codama/types/paymentFrequency.js +30 -0
- package/dist/esm/generated/codama/types/paymentFrequency.js.map +1 -0
- package/dist/esm/generated/codama/types/serializableAccount.js +53 -0
- package/dist/esm/generated/codama/types/serializableAccount.js.map +1 -0
- package/dist/esm/generated/codama/types/serializableInstruction.js +54 -0
- package/dist/esm/generated/codama/types/serializableInstruction.js.map +1 -0
- package/dist/esm/generated/codama/types/threadResponse.js +63 -0
- package/dist/esm/generated/codama/types/threadResponse.js.map +1 -0
- package/dist/esm/generated/codama/types/trigger.js.map +1 -0
- package/dist/esm/generated/codama/types/triggerContext.js.map +1 -0
- package/dist/esm/idl/index.js +21 -0
- package/dist/esm/idl/index.js.map +1 -0
- package/dist/esm/idl/srsly-data.js +3137 -0
- package/dist/esm/idl/srsly-data.js.map +1 -0
- package/dist/esm/idl/srsly.json +3104 -0
- package/dist/esm/index.js +213 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +63 -0
- package/dist/esm/rental/accept.js +230 -58
- package/dist/esm/rental/accept.js.map +1 -1
- package/dist/esm/rental/cancel.js +155 -26
- package/dist/esm/rental/cancel.js.map +1 -1
- package/dist/esm/rental/close.js +157 -30
- package/dist/esm/rental/close.js.map +1 -1
- package/dist/esm/rental/index.js +88 -4
- package/dist/esm/rental/index.js.map +1 -1
- package/dist/esm/rental/reset.js +161 -39
- package/dist/esm/rental/reset.js.map +1 -1
- package/dist/esm/types/payment-frequency.js +83 -0
- package/dist/esm/types/payment-frequency.js.map +1 -0
- package/dist/esm/types/srsly.js +2 -0
- package/dist/esm/types/srsly.js.map +1 -0
- package/dist/esm/utils/config.js +134 -92
- package/dist/esm/utils/config.js.map +1 -1
- package/dist/esm/utils/constants.js +43 -77
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/esm/utils/cron.js +195 -0
- package/dist/esm/utils/cron.js.map +1 -0
- package/dist/esm/utils/derive-pda.js +402 -0
- package/dist/esm/utils/derive-pda.js.map +1 -0
- package/dist/esm/utils/fetch-accounts.js +233 -0
- package/dist/esm/utils/fetch-accounts.js.map +1 -0
- package/dist/esm/utils/index.js +16 -3
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/instruction-converter.js +120 -0
- package/dist/esm/utils/instruction-converter.js.map +1 -0
- package/dist/esm/utils/param-converters.js +182 -0
- package/dist/esm/utils/param-converters.js.map +1 -0
- package/dist/esm/utils/payment-frequency.js +104 -0
- package/dist/esm/utils/payment-frequency.js.map +1 -0
- package/dist/esm/utils/schedule-builder.js +153 -0
- package/dist/esm/utils/schedule-builder.js.map +1 -0
- package/dist/esm/utils/schedule-validation.js +132 -0
- package/dist/esm/utils/schedule-validation.js.map +1 -0
- package/dist/esm/utils/signer.js +119 -0
- package/dist/esm/utils/signer.js.map +1 -0
- package/dist/esm/utils/smart-params.js +49 -0
- package/dist/esm/utils/smart-params.js.map +1 -0
- package/dist/types/config/index.d.ts +7 -0
- package/dist/types/config/index.d.ts.map +1 -0
- package/dist/types/config/initialize.d.ts +66 -0
- package/dist/types/config/initialize.d.ts.map +1 -0
- package/dist/types/config/update.d.ts +143 -0
- package/dist/types/config/update.d.ts.map +1 -0
- package/dist/types/contract/close.d.ts +100 -28
- package/dist/types/contract/close.d.ts.map +1 -1
- package/dist/types/contract/create.d.ts +115 -45
- package/dist/types/contract/create.d.ts.map +1 -1
- package/dist/types/contract/index.d.ts +51 -2
- package/dist/types/contract/index.d.ts.map +1 -1
- package/dist/types/demos.d.ts +66 -0
- package/dist/types/demos.d.ts.map +1 -0
- package/dist/types/generated/codama/accounts/configState.d.ts +75 -0
- package/dist/types/generated/codama/accounts/configState.d.ts.map +1 -0
- package/dist/types/generated/codama/accounts/contractState.d.ts +78 -0
- package/dist/types/generated/codama/accounts/contractState.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/accounts/index.d.ts +1 -1
- package/dist/types/generated/codama/accounts/index.d.ts.map +1 -0
- package/dist/types/generated/codama/accounts/rentalState.d.ts +78 -0
- package/dist/types/generated/codama/accounts/rentalState.d.ts.map +1 -0
- package/dist/types/{codama/mainnet → generated/codama}/accounts/thread.d.ts +8 -7
- package/dist/types/generated/codama/accounts/thread.d.ts.map +1 -0
- package/dist/types/generated/codama/errors/index.d.ts.map +1 -0
- package/dist/types/generated/codama/errors/srsly.d.ts +68 -0
- package/dist/types/generated/codama/errors/srsly.d.ts.map +1 -0
- package/dist/types/generated/codama/index.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/acceptRental.d.ts +132 -0
- package/dist/types/generated/codama/instructions/acceptRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/cancelRental.d.ts +87 -0
- package/dist/types/generated/codama/instructions/cancelRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/closeContract.d.ts +71 -0
- package/dist/types/generated/codama/instructions/closeContract.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/closeRental.d.ts +119 -0
- package/dist/types/generated/codama/instructions/closeRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/createContract.d.ts +112 -0
- package/dist/types/generated/codama/instructions/createContract.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/instructions/index.d.ts +2 -0
- package/dist/types/generated/codama/instructions/index.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/initializeConfig.d.ts +60 -0
- package/dist/types/generated/codama/instructions/initializeConfig.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/payRental.d.ts +103 -0
- package/dist/types/generated/codama/instructions/payRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/resetRental.d.ts +79 -0
- package/dist/types/generated/codama/instructions/resetRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/updateConfig.d.ts +109 -0
- package/dist/types/generated/codama/instructions/updateConfig.d.ts.map +1 -0
- package/dist/types/generated/codama/programs/index.d.ts.map +1 -0
- package/dist/types/{codama/mainnet → generated/codama}/programs/srsly.d.ts +12 -6
- package/dist/types/generated/codama/programs/srsly.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/shared/index.d.ts +14 -3
- package/dist/types/generated/codama/shared/index.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/types/clockData.d.ts +4 -3
- package/dist/types/generated/codama/types/clockData.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/types/equality.d.ts +4 -4
- package/dist/types/generated/codama/types/equality.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/types/execContext.d.ts +2 -1
- package/dist/types/generated/codama/types/execContext.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/types/index.d.ts +1 -0
- package/dist/types/generated/codama/types/index.d.ts.map +1 -0
- package/dist/types/generated/codama/types/paymentFrequency.d.ts +24 -0
- package/dist/types/generated/codama/types/paymentFrequency.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/types/serializableAccount.d.ts +4 -3
- package/dist/types/generated/codama/types/serializableAccount.d.ts.map +1 -0
- package/dist/types/{codama/mainnet → generated/codama}/types/serializableInstruction.d.ts +2 -1
- package/dist/types/generated/codama/types/serializableInstruction.d.ts.map +1 -0
- package/dist/types/{codama/devnet → generated/codama}/types/threadResponse.d.ts +2 -1
- package/dist/types/generated/codama/types/threadResponse.d.ts.map +1 -0
- package/dist/types/generated/codama/types/trigger.d.ts.map +1 -0
- package/dist/types/generated/codama/types/triggerContext.d.ts.map +1 -0
- package/dist/types/idl/index.d.ts +21 -0
- package/dist/types/idl/index.d.ts.map +1 -0
- package/dist/types/idl/srsly-data.d.ts +1458 -0
- package/dist/types/idl/srsly-data.d.ts.map +1 -0
- package/dist/types/index.d.ts +213 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rental/accept.d.ts +165 -61
- package/dist/types/rental/accept.d.ts.map +1 -1
- package/dist/types/rental/cancel.d.ts +119 -22
- package/dist/types/rental/cancel.d.ts.map +1 -1
- package/dist/types/rental/close.d.ts +108 -27
- package/dist/types/rental/close.d.ts.map +1 -1
- package/dist/types/rental/index.d.ts +88 -4
- package/dist/types/rental/index.d.ts.map +1 -1
- package/dist/types/rental/reset.d.ts +137 -39
- package/dist/types/rental/reset.d.ts.map +1 -1
- package/dist/types/types/payment-frequency.d.ts +55 -0
- package/dist/types/types/payment-frequency.d.ts.map +1 -0
- package/dist/types/types/srsly.d.ts +3111 -0
- package/dist/types/types/srsly.d.ts.map +1 -0
- package/dist/types/utils/config.d.ts +78 -61
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/constants.d.ts +16 -22
- package/dist/types/utils/constants.d.ts.map +1 -1
- package/dist/types/utils/cron.d.ts +77 -0
- package/dist/types/utils/cron.d.ts.map +1 -0
- package/dist/types/utils/derive-pda.d.ts +213 -0
- package/dist/types/utils/derive-pda.d.ts.map +1 -0
- package/dist/types/utils/fetch-accounts.d.ts +158 -0
- package/dist/types/utils/fetch-accounts.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +16 -3
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/instruction-converter.d.ts +171 -0
- package/dist/types/utils/instruction-converter.d.ts.map +1 -0
- package/dist/types/utils/param-converters.d.ts +67 -0
- package/dist/types/utils/param-converters.d.ts.map +1 -0
- package/dist/types/utils/payment-frequency.d.ts +38 -0
- package/dist/types/utils/payment-frequency.d.ts.map +1 -0
- package/dist/types/utils/schedule-builder.d.ts +64 -0
- package/dist/types/utils/schedule-builder.d.ts.map +1 -0
- package/dist/types/utils/schedule-validation.d.ts +36 -0
- package/dist/types/utils/schedule-validation.d.ts.map +1 -0
- package/dist/types/utils/signer.d.ts +61 -0
- package/dist/types/utils/signer.d.ts.map +1 -0
- package/dist/types/utils/smart-params.d.ts +112 -0
- package/dist/types/utils/smart-params.d.ts.map +1 -0
- package/package.json +55 -34
- 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 +0 -89
- package/dist/cjs/codama/devnet/accounts/thread.js.map +0 -1
- package/dist/cjs/codama/devnet/constants.js +0 -32
- package/dist/cjs/codama/devnet/constants.js.map +0 -1
- package/dist/cjs/codama/devnet/errors/index.js.map +0 -1
- package/dist/cjs/codama/devnet/errors/srsly.js +0 -74
- package/dist/cjs/codama/devnet/errors/srsly.js.map +0 -1
- package/dist/cjs/codama/devnet/index.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/acceptRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/cancelRental.js +0 -225
- package/dist/cjs/codama/devnet/instructions/cancelRental.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/closeContract.js +0 -246
- package/dist/cjs/codama/devnet/instructions/closeContract.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/closeRental.js +0 -260
- 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 +0 -31
- package/dist/cjs/codama/devnet/instructions/index.js.map +0 -1
- package/dist/cjs/codama/devnet/instructions/payRental.js +0 -280
- 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 +0 -31
- 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/serializableAccount.js +0 -31
- package/dist/cjs/codama/devnet/types/serializableAccount.js.map +0 -1
- package/dist/cjs/codama/devnet/types/serializableInstruction.js +0 -32
- package/dist/cjs/codama/devnet/types/serializableInstruction.js.map +0 -1
- package/dist/cjs/codama/devnet/types/threadResponse.js +0 -38
- package/dist/cjs/codama/devnet/types/threadResponse.js.map +0 -1
- package/dist/cjs/codama/devnet/types/trigger.js.map +0 -1
- package/dist/cjs/codama/devnet/types/triggerContext.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/contractState.js +0 -87
- package/dist/cjs/codama/mainnet/accounts/contractState.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/fleet.js +0 -77
- package/dist/cjs/codama/mainnet/accounts/fleet.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/index.js +0 -28
- package/dist/cjs/codama/mainnet/accounts/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/rentalState.js +0 -87
- package/dist/cjs/codama/mainnet/accounts/rentalState.js.map +0 -1
- package/dist/cjs/codama/mainnet/accounts/thread.js.map +0 -1
- package/dist/cjs/codama/mainnet/constants.js +0 -32
- package/dist/cjs/codama/mainnet/constants.js.map +0 -1
- package/dist/cjs/codama/mainnet/errors/index.js +0 -25
- package/dist/cjs/codama/mainnet/errors/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/errors/srsly.js +0 -74
- package/dist/cjs/codama/mainnet/errors/srsly.js.map +0 -1
- package/dist/cjs/codama/mainnet/index.js +0 -29
- package/dist/cjs/codama/mainnet/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/acceptRental.js +0 -357
- package/dist/cjs/codama/mainnet/instructions/acceptRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/cancelRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/closeContract.js +0 -246
- package/dist/cjs/codama/mainnet/instructions/closeContract.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/closeRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/createContract.js +0 -261
- package/dist/cjs/codama/mainnet/instructions/createContract.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/payRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/instructions/resetRental.js.map +0 -1
- package/dist/cjs/codama/mainnet/programs/index.js +0 -25
- package/dist/cjs/codama/mainnet/programs/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/programs/srsly.js +0 -73
- package/dist/cjs/codama/mainnet/programs/srsly.js.map +0 -1
- package/dist/cjs/codama/mainnet/shared/index.js +0 -95
- package/dist/cjs/codama/mainnet/shared/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/clockData.js +0 -31
- package/dist/cjs/codama/mainnet/types/clockData.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/equality.js +0 -30
- package/dist/cjs/codama/mainnet/types/equality.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/execContext.js +0 -38
- package/dist/cjs/codama/mainnet/types/execContext.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/index.js +0 -32
- package/dist/cjs/codama/mainnet/types/index.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/serializableAccount.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/serializableInstruction.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/threadResponse.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/trigger.js +0 -90
- package/dist/cjs/codama/mainnet/types/trigger.js.map +0 -1
- package/dist/cjs/codama/mainnet/types/triggerContext.js +0 -49
- package/dist/cjs/codama/mainnet/types/triggerContext.js.map +0 -1
- package/dist/cjs/utils/profiles.js +0 -159
- package/dist/cjs/utils/profiles.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/contractState.js +0 -75
- 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 +0 -74
- package/dist/esm/codama/devnet/accounts/rentalState.js.map +0 -1
- package/dist/esm/codama/devnet/accounts/thread.js +0 -77
- package/dist/esm/codama/devnet/accounts/thread.js.map +0 -1
- package/dist/esm/codama/devnet/constants.js +0 -29
- package/dist/esm/codama/devnet/constants.js.map +0 -1
- package/dist/esm/codama/devnet/errors/index.js.map +0 -1
- package/dist/esm/codama/devnet/errors/srsly.js +0 -69
- package/dist/esm/codama/devnet/errors/srsly.js.map +0 -1
- package/dist/esm/codama/devnet/index.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/acceptRental.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/cancelRental.js +0 -215
- package/dist/esm/codama/devnet/instructions/cancelRental.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/closeContract.js +0 -236
- 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 +0 -251
- package/dist/esm/codama/devnet/instructions/createContract.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/index.js +0 -15
- package/dist/esm/codama/devnet/instructions/index.js.map +0 -1
- package/dist/esm/codama/devnet/instructions/payRental.js +0 -270
- 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 +0 -26
- 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 +0 -33
- 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/serializableAccount.js +0 -26
- package/dist/esm/codama/devnet/types/serializableAccount.js.map +0 -1
- package/dist/esm/codama/devnet/types/serializableInstruction.js +0 -27
- package/dist/esm/codama/devnet/types/serializableInstruction.js.map +0 -1
- package/dist/esm/codama/devnet/types/threadResponse.js +0 -33
- package/dist/esm/codama/devnet/types/threadResponse.js.map +0 -1
- package/dist/esm/codama/devnet/types/trigger.js.map +0 -1
- package/dist/esm/codama/devnet/types/triggerContext.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/contractState.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/fleet.js +0 -64
- package/dist/esm/codama/mainnet/accounts/fleet.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/index.js +0 -12
- package/dist/esm/codama/mainnet/accounts/index.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/rentalState.js +0 -74
- package/dist/esm/codama/mainnet/accounts/rentalState.js.map +0 -1
- package/dist/esm/codama/mainnet/accounts/thread.js.map +0 -1
- package/dist/esm/codama/mainnet/constants.js +0 -29
- package/dist/esm/codama/mainnet/constants.js.map +0 -1
- package/dist/esm/codama/mainnet/errors/index.js +0 -9
- package/dist/esm/codama/mainnet/errors/index.js.map +0 -1
- package/dist/esm/codama/mainnet/errors/srsly.js +0 -69
- package/dist/esm/codama/mainnet/errors/srsly.js.map +0 -1
- package/dist/esm/codama/mainnet/index.js +0 -13
- package/dist/esm/codama/mainnet/index.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/acceptRental.js +0 -347
- package/dist/esm/codama/mainnet/instructions/acceptRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/cancelRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/closeContract.js +0 -236
- package/dist/esm/codama/mainnet/instructions/closeContract.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/closeRental.js +0 -250
- package/dist/esm/codama/mainnet/instructions/closeRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/createContract.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/index.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/payRental.js.map +0 -1
- package/dist/esm/codama/mainnet/instructions/resetRental.js.map +0 -1
- package/dist/esm/codama/mainnet/programs/index.js +0 -9
- package/dist/esm/codama/mainnet/programs/index.js.map +0 -1
- package/dist/esm/codama/mainnet/programs/srsly.js +0 -68
- package/dist/esm/codama/mainnet/programs/srsly.js.map +0 -1
- package/dist/esm/codama/mainnet/shared/index.js +0 -87
- package/dist/esm/codama/mainnet/shared/index.js.map +0 -1
- package/dist/esm/codama/mainnet/types/clockData.js +0 -26
- package/dist/esm/codama/mainnet/types/clockData.js.map +0 -1
- package/dist/esm/codama/mainnet/types/equality.js +0 -24
- package/dist/esm/codama/mainnet/types/equality.js.map +0 -1
- package/dist/esm/codama/mainnet/types/execContext.js +0 -33
- package/dist/esm/codama/mainnet/types/execContext.js.map +0 -1
- package/dist/esm/codama/mainnet/types/index.js +0 -16
- package/dist/esm/codama/mainnet/types/index.js.map +0 -1
- package/dist/esm/codama/mainnet/types/serializableAccount.js +0 -26
- package/dist/esm/codama/mainnet/types/serializableAccount.js.map +0 -1
- package/dist/esm/codama/mainnet/types/serializableInstruction.js +0 -27
- package/dist/esm/codama/mainnet/types/serializableInstruction.js.map +0 -1
- package/dist/esm/codama/mainnet/types/threadResponse.js +0 -33
- package/dist/esm/codama/mainnet/types/threadResponse.js.map +0 -1
- package/dist/esm/codama/mainnet/types/trigger.js +0 -83
- package/dist/esm/codama/mainnet/types/trigger.js.map +0 -1
- package/dist/esm/codama/mainnet/types/triggerContext.js +0 -42
- package/dist/esm/codama/mainnet/types/triggerContext.js.map +0 -1
- package/dist/esm/utils/profiles.js +0 -152
- package/dist/esm/utils/profiles.js.map +0 -1
- package/dist/types/codama/devnet/accounts/contractState.d.ts +0 -51
- package/dist/types/codama/devnet/accounts/contractState.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/fleet.d.ts +0 -38
- package/dist/types/codama/devnet/accounts/fleet.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/rentalState.d.ts +0 -48
- package/dist/types/codama/devnet/accounts/rentalState.d.ts.map +0 -1
- package/dist/types/codama/devnet/accounts/thread.d.ts +0 -74
- package/dist/types/codama/devnet/accounts/thread.d.ts.map +0 -1
- package/dist/types/codama/devnet/constants.d.ts +0 -33
- package/dist/types/codama/devnet/constants.d.ts.map +0 -1
- package/dist/types/codama/devnet/errors/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/errors/srsly.d.ts +0 -50
- 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 -131
- package/dist/types/codama/devnet/instructions/acceptRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/cancelRental.d.ts +0 -71
- package/dist/types/codama/devnet/instructions/cancelRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/closeContract.d.ts +0 -100
- package/dist/types/codama/devnet/instructions/closeContract.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/closeRental.d.ts +0 -83
- 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/payRental.d.ts +0 -110
- package/dist/types/codama/devnet/instructions/payRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/instructions/resetRental.d.ts +0 -71
- package/dist/types/codama/devnet/instructions/resetRental.d.ts.map +0 -1
- package/dist/types/codama/devnet/programs/index.d.ts.map +0 -1
- package/dist/types/codama/devnet/programs/srsly.d.ts +0 -47
- 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/serializableAccount.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/serializableInstruction.d.ts +0 -30
- package/dist/types/codama/devnet/types/serializableInstruction.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/threadResponse.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/trigger.d.ts.map +0 -1
- package/dist/types/codama/devnet/types/triggerContext.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/contractState.d.ts +0 -51
- package/dist/types/codama/mainnet/accounts/contractState.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/fleet.d.ts +0 -38
- package/dist/types/codama/mainnet/accounts/fleet.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/index.d.ts +0 -12
- package/dist/types/codama/mainnet/accounts/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/rentalState.d.ts +0 -48
- package/dist/types/codama/mainnet/accounts/rentalState.d.ts.map +0 -1
- package/dist/types/codama/mainnet/accounts/thread.d.ts.map +0 -1
- package/dist/types/codama/mainnet/constants.d.ts +0 -33
- package/dist/types/codama/mainnet/constants.d.ts.map +0 -1
- package/dist/types/codama/mainnet/errors/index.d.ts +0 -9
- package/dist/types/codama/mainnet/errors/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/errors/srsly.d.ts +0 -50
- package/dist/types/codama/mainnet/errors/srsly.d.ts.map +0 -1
- package/dist/types/codama/mainnet/index.d.ts +0 -13
- package/dist/types/codama/mainnet/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/acceptRental.d.ts +0 -131
- package/dist/types/codama/mainnet/instructions/acceptRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/cancelRental.d.ts +0 -71
- package/dist/types/codama/mainnet/instructions/cancelRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/closeContract.d.ts +0 -100
- package/dist/types/codama/mainnet/instructions/closeContract.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/closeRental.d.ts +0 -83
- package/dist/types/codama/mainnet/instructions/closeRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/createContract.d.ts +0 -108
- package/dist/types/codama/mainnet/instructions/createContract.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/index.d.ts +0 -15
- package/dist/types/codama/mainnet/instructions/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/payRental.d.ts +0 -110
- package/dist/types/codama/mainnet/instructions/payRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/instructions/resetRental.d.ts +0 -71
- package/dist/types/codama/mainnet/instructions/resetRental.d.ts.map +0 -1
- package/dist/types/codama/mainnet/programs/index.d.ts +0 -9
- package/dist/types/codama/mainnet/programs/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/programs/srsly.d.ts.map +0 -1
- package/dist/types/codama/mainnet/shared/index.d.ts +0 -50
- package/dist/types/codama/mainnet/shared/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/clockData.d.ts +0 -29
- package/dist/types/codama/mainnet/types/clockData.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/equality.d.ts +0 -18
- package/dist/types/codama/mainnet/types/equality.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/execContext.d.ts +0 -48
- package/dist/types/codama/mainnet/types/execContext.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/index.d.ts +0 -16
- package/dist/types/codama/mainnet/types/index.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/serializableAccount.d.ts +0 -22
- package/dist/types/codama/mainnet/types/serializableAccount.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/serializableInstruction.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/threadResponse.d.ts +0 -42
- package/dist/types/codama/mainnet/types/threadResponse.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/trigger.d.ts +0 -98
- package/dist/types/codama/mainnet/types/trigger.d.ts.map +0 -1
- package/dist/types/codama/mainnet/types/triggerContext.d.ts +0 -75
- package/dist/types/codama/mainnet/types/triggerContext.d.ts.map +0 -1
- package/dist/types/utils/profiles.d.ts +0 -54
- package/dist/types/utils/profiles.d.ts.map +0 -1
- package/target/idl/srsly-devnet.json +0 -3275
- package/target/idl/srsly-mainnet.json +0 -3275
- package/target/types/srsly-devnet.ts +0 -1
- package/target/types/srsly-mainnet.ts +0 -1
- /package/dist/cjs/{codama/devnet → generated/codama}/errors/index.js +0 -0
- /package/dist/cjs/{codama/devnet → generated/codama}/index.js +0 -0
- /package/dist/cjs/{codama/devnet → generated/codama}/programs/index.js +0 -0
- /package/dist/cjs/{codama/devnet → generated/codama}/types/equality.js +0 -0
- /package/dist/cjs/{codama/devnet → generated/codama}/types/trigger.js +0 -0
- /package/dist/cjs/{codama/devnet → generated/codama}/types/triggerContext.js +0 -0
- /package/dist/esm/{codama/devnet → generated/codama}/errors/index.js +0 -0
- /package/dist/esm/{codama/devnet → generated/codama}/index.js +0 -0
- /package/dist/esm/{codama/devnet → generated/codama}/programs/index.js +0 -0
- /package/dist/esm/{codama/devnet → generated/codama}/types/equality.js +0 -0
- /package/dist/esm/{codama/devnet → generated/codama}/types/trigger.js +0 -0
- /package/dist/esm/{codama/devnet → generated/codama}/types/triggerContext.js +0 -0
- /package/dist/types/{codama/devnet → generated/codama}/errors/index.d.ts +0 -0
- /package/dist/types/{codama/devnet → generated/codama}/index.d.ts +0 -0
- /package/dist/types/{codama/devnet → generated/codama}/programs/index.d.ts +0 -0
- /package/dist/types/{codama/devnet → generated/codama}/types/trigger.d.ts +0 -0
- /package/dist/types/{codama/devnet → generated/codama}/types/triggerContext.d.ts +0 -0
package/README.md
CHANGED
|
@@ -4,665 +4,530 @@
|
|
|
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
10
|
|
|
11
|
-
|
|
11
|
+
The SRSLY SDK is a focused instruction builder that helps you create Solana instructions for fleet rentals. It provides:
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
- ✅ **Smart Parameters** - Intuitive parameter formats with ATLAS as default unit
|
|
18
|
+
- ✅ **Network Agnostic** - Same program works across all networks (mainnet, devnet, etc.)
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
**Current Status**: Instruction-only SDK using @solana/kit. Users handle transaction assembly and sending.
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
pnpm add @wuwei-labs/srsly
|
|
21
|
-
```
|
|
22
|
+
**RPC Requirement**: The SDK requires an RPC URL to fetch account states. This enables automatic PDA derivation and validation but means you must configure an RPC endpoint.
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
## Installation
|
|
24
25
|
|
|
25
26
|
```bash
|
|
26
|
-
|
|
27
|
+
# Install the SDK (includes @solana/kit as a dependency)
|
|
28
|
+
npm install @wuwei-labs/srsly
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
The SDK uses @solana/kit internally and provides seamless conversion to @solana/web3.js format for browser wallet compatibility.
|
|
32
|
+
|
|
29
33
|
## Quick Start
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
import {
|
|
33
|
-
createContract,
|
|
34
|
-
acceptRental,
|
|
35
|
-
setConfig,
|
|
36
|
-
setNetwork,
|
|
37
|
-
ATLAS_TO_STARDUST
|
|
38
|
-
} from '@wuwei-labs/srsly';
|
|
35
|
+
### Using with @solana/kit (Default)
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// or use the convenience function: setNetwork('mainnet');
|
|
37
|
+
```typescript
|
|
38
|
+
import { createContract, setConfig } from '@wuwei-labs/srsly';
|
|
43
39
|
|
|
44
|
-
//
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
ownerProfile: profileAddress,
|
|
49
|
-
rate: 1000000, // Rate in ATLAS tokens
|
|
50
|
-
durationMin: 86400, // 1 day in seconds
|
|
51
|
-
durationMax: 604800, // 1 week in seconds
|
|
52
|
-
paymentsFreq: 'daily'
|
|
53
|
-
}); // Uses mainnet from global config
|
|
40
|
+
// 1. Configure SDK with your RPC endpoint
|
|
41
|
+
setConfig({
|
|
42
|
+
rpcUrl: 'https://your-rpc-endpoint.com' // Required - no defaults provided
|
|
43
|
+
});
|
|
54
44
|
|
|
55
|
-
//
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// amount is automatically calculated: rate * duration * ATLAS_TO_STARDUST
|
|
65
|
-
}); // Uses mainnet from global config
|
|
45
|
+
// 2. Create an instruction with smart parameters (v3)
|
|
46
|
+
const instruction = await createContract({
|
|
47
|
+
owner: signer, // Can be a signer object or string address
|
|
48
|
+
fleet: "FleetAddress123...", // String address
|
|
49
|
+
ownerProfile: "ProfileAddr...", // String address
|
|
50
|
+
rate: 10, // ATLAS tokens per payment period (v3 default)
|
|
51
|
+
durationMax: { days: 7 }, // Smart duration parameter
|
|
52
|
+
paymentsFreq: 'daily' // Payment frequency
|
|
53
|
+
});
|
|
66
54
|
|
|
67
|
-
//
|
|
68
|
-
|
|
55
|
+
// 3. Add instruction to your transaction and send
|
|
56
|
+
// (Use your preferred transaction building and sending method)
|
|
69
57
|
```
|
|
70
58
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### Contract Management
|
|
74
|
-
|
|
75
|
-
Create and manage rental contracts for Star Atlas fleets:
|
|
59
|
+
### Using with @solana/web3.js (wallet-adapter)
|
|
76
60
|
|
|
77
61
|
```typescript
|
|
78
|
-
import { createContract,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
durationMin: 86400, // Minimum 1 day
|
|
87
|
-
durationMax: 2592000, // Maximum 30 days
|
|
88
|
-
paymentsFreq: 'daily',
|
|
89
|
-
ownerKeyIndex: 0
|
|
90
|
-
}).set({ network: 'mainnet' }); // Use mainnet configuration
|
|
91
|
-
|
|
92
|
-
// Close an existing contract using devnet defaults (direct await)
|
|
93
|
-
const closeIx = await closeContract({
|
|
94
|
-
owner: wallet,
|
|
95
|
-
fleet: fleetAddress,
|
|
96
|
-
contract: contractAddress,
|
|
97
|
-
faction: 'mud' // or faction number: 1, 2, 3
|
|
62
|
+
import { createContract, setConfig } from '@wuwei-labs/srsly';
|
|
63
|
+
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
64
|
+
|
|
65
|
+
// 1. Configure SDK with your RPC endpoint
|
|
66
|
+
setConfig({
|
|
67
|
+
rpcUrl: 'https://your-rpc-endpoint.com', // Required - no defaults provided
|
|
68
|
+
library: 'web3js',
|
|
69
|
+
PublicKey // required to ensure addresses use web3js publickey format
|
|
98
70
|
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Rental Operations
|
|
102
|
-
|
|
103
|
-
Handle rental lifecycle operations with automatic token conversion:
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
import {
|
|
107
|
-
acceptRental,
|
|
108
|
-
cancelRental,
|
|
109
|
-
closeRental,
|
|
110
|
-
resetRental,
|
|
111
|
-
ATLAS_TO_STARDUST
|
|
112
|
-
} from '@wuwei-labs/srsly';
|
|
113
|
-
|
|
114
|
-
// Accept a rental offer on devnet (rate-based with automatic conversion)
|
|
115
|
-
const acceptIx = await acceptRental({
|
|
116
|
-
borrower: borrowerWallet,
|
|
117
|
-
borrowerProfile: borrowerProfileAddress,
|
|
118
|
-
borrowerFaction: 'oni', // or faction number: 1=mud, 2=oni, 3=ustur
|
|
119
|
-
fleet: fleetAddress,
|
|
120
|
-
contract: contractAddress,
|
|
121
|
-
rate: 100, // ATLAS tokens (not per second, just ATLAS)
|
|
122
|
-
duration: 86400 // 1 day in seconds
|
|
123
|
-
// amount = rate * duration * ATLAS_TO_STARDUST automatically calculated
|
|
124
|
-
}).set({ network: 'devnet' });
|
|
125
71
|
|
|
126
|
-
//
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
72
|
+
// 2. Create and convert to web3.js format
|
|
73
|
+
const web3jsInstruction = await createContract({
|
|
74
|
+
owner: wallet.publicKey.toString(), // String address
|
|
75
|
+
fleet: "FleetAddress123...", // String address
|
|
76
|
+
ownerProfile: "ProfileAddr...", // String address
|
|
77
|
+
rate: 10, // ATLAS per period (v3 default)
|
|
78
|
+
durationMax: { days: 7 }, // Smart duration parameter
|
|
79
|
+
paymentsFreq: 'daily'
|
|
131
80
|
});
|
|
132
81
|
|
|
133
|
-
//
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
contract: contractAddress,
|
|
137
|
-
rentalState: rentalStateAddress,
|
|
138
|
-
ownerTokenAccount: ownerTokenAccountAddress
|
|
139
|
-
}).set({ network: 'mainnet' });
|
|
140
|
-
|
|
141
|
-
// Reset rental state with custom configuration
|
|
142
|
-
const resetIx = await resetRental({
|
|
143
|
-
fleet: fleetAddress,
|
|
144
|
-
contract: contractAddress,
|
|
145
|
-
rentalState: rentalStateAddress,
|
|
146
|
-
faction: 'mud',
|
|
147
|
-
ownerProfile: ownerProfileAddress
|
|
148
|
-
}).set({
|
|
149
|
-
network: 'mainnet',
|
|
150
|
-
sageProgramAddress: 'custom...',
|
|
151
|
-
gameId: 'custom...'
|
|
152
|
-
});
|
|
82
|
+
// 3. Add to transaction and send
|
|
83
|
+
const transaction = new Transaction().add(web3jsInstruction);
|
|
84
|
+
const signature = await wallet.sendTransaction(transaction, connection);
|
|
153
85
|
```
|
|
154
86
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
Fetch and decode account states using network-specific functions:
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
import { getCachedNetworkModule } from '@wuwei-labs/srsly';
|
|
87
|
+
## Core Features
|
|
161
88
|
|
|
162
|
-
|
|
163
|
-
const accountsModule = await getCachedNetworkModule('accounts');
|
|
164
|
-
const { fetchContractState, fetchRentalState } = accountsModule;
|
|
89
|
+
### Universal Signer Pattern
|
|
165
90
|
|
|
166
|
-
|
|
167
|
-
const mainnetAccountsModule = await getCachedNetworkModule('accounts', 'mainnet');
|
|
91
|
+
The SDK supports both CLI/Node.js and browser usage patterns through its Universal Signer functionality:
|
|
168
92
|
|
|
169
|
-
|
|
170
|
-
const contractState = await fetchContractState(rpc, contractPublicKey);
|
|
171
|
-
console.log('Contract rate:', contractState.rate.toString());
|
|
172
|
-
console.log('Duration range:', contractState.durationMin.toString(), '-', contractState.durationMax.toString());
|
|
93
|
+
**Browser Usage** (String Addresses):
|
|
173
94
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
95
|
+
```typescript
|
|
96
|
+
// Pass string addresses for browser wallets
|
|
97
|
+
const instruction = await acceptRental({
|
|
98
|
+
borrower: wallet.publicKey.toString(), // String address
|
|
99
|
+
// ... other params
|
|
100
|
+
});
|
|
101
|
+
// Browser wallet handles signing separately
|
|
178
102
|
```
|
|
179
103
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
The SDK includes automatic ATLAS to stardust conversion for rental operations:
|
|
104
|
+
**CLI/Node.js Usage** (Signer Objects):
|
|
183
105
|
|
|
184
106
|
```typescript
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
// Final amount = rate * duration * ATLAS_TO_STARDUST
|
|
192
|
-
// Example: 100 ATLAS * 86400 seconds * 100_000_000 = 864,000,000,000,000 stardust
|
|
107
|
+
// Pass signer objects for full signing capability
|
|
108
|
+
const instruction = await acceptRental({
|
|
109
|
+
borrower: wallet, // Signer object
|
|
110
|
+
// ... other params
|
|
111
|
+
});
|
|
112
|
+
// Can sign transactions directly
|
|
193
113
|
```
|
|
194
114
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- **Program ID**: `SRSLY1fq9TJqCk1gNSE7VZL2bztvTn9wm4VR8u8jMKT`
|
|
198
|
-
- **Network**: Solana Mainnet or Atlasnet
|
|
199
|
-
- **Built with**: Anchor Framework
|
|
200
|
-
|
|
201
|
-
## Payment Structure
|
|
115
|
+
### Instruction Building & Format Conversion
|
|
202
116
|
|
|
203
|
-
The
|
|
117
|
+
The SDK creates @solana/kit compatible instructions with seamless web3.js conversion:
|
|
204
118
|
|
|
205
|
-
|
|
119
|
+
- **📦 Instruction-Only**: Focus on instruction building, users handle transaction assembly/sending
|
|
120
|
+
- **🔄 Format Conversion**: Built-in `.web3js(PublicKey)` method for wallet compatibility
|
|
121
|
+
- **🎯 Universal Signer**: Accepts both string addresses and signer objects
|
|
122
|
+
- **⚡ Lightweight**: Uses @solana/kit internally with optional web3.js conversion
|
|
206
123
|
|
|
207
|
-
|
|
208
|
-
Rental Lifecycle:
|
|
209
|
-
1. Escrow Deposit (Full Payment Upfront)
|
|
210
|
-
2. Periodic Payments (Based on Payment Frequency)
|
|
211
|
-
3. Fee Collection (Platform + Referral Fees)
|
|
212
|
-
4. Owner Payments (After Fee Deduction)
|
|
213
|
-
5. Refunds (For Early Cancellation)
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### 1. Escrow Deposit
|
|
124
|
+
### Web3.js Format Conversion
|
|
217
125
|
|
|
218
|
-
|
|
126
|
+
The SDK accepts string addresses as input and provides seamless conversion to @solana/web3.js format for browser wallet compatibility:
|
|
219
127
|
|
|
220
128
|
```typescript
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
129
|
+
import { createContract } from '@wuwei-labs/srsly';
|
|
130
|
+
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
131
|
+
|
|
132
|
+
// Web3.js format with PublicKey instances
|
|
133
|
+
const web3jsInstruction = await createContract({
|
|
134
|
+
owner: "OwnerAddress123...", // String address input
|
|
135
|
+
fleet: "FleetAddress123...", // String address input
|
|
136
|
+
ownerProfile: "ProfileAddr...", // String address input
|
|
137
|
+
rate: 1000000,
|
|
138
|
+
durationMax: days(7),
|
|
139
|
+
paymentsFreq: 'daily'
|
|
140
|
+
}).web3js(PublicKey);
|
|
141
|
+
|
|
142
|
+
// Chain configuration with conversion
|
|
143
|
+
const configuredInstruction = await createContract({
|
|
144
|
+
owner: "OwnerAddress123...",
|
|
145
|
+
fleet: "FleetAddress123...",
|
|
146
|
+
ownerProfile: "ProfileAddr...",
|
|
147
|
+
rate: 1000000,
|
|
148
|
+
durationMax: days(7),
|
|
149
|
+
paymentsFreq: 'daily'
|
|
150
|
+
}).set({
|
|
151
|
+
rpcUrl: 'https://api.mainnet-beta.solana.com'
|
|
152
|
+
}).web3js(PublicKey);
|
|
153
|
+
|
|
154
|
+
// Use in transactions
|
|
155
|
+
const transaction = new Transaction().add(web3jsInstruction);
|
|
233
156
|
```
|
|
234
157
|
|
|
235
|
-
**Key
|
|
158
|
+
**Key points:**
|
|
236
159
|
|
|
237
|
-
-
|
|
238
|
-
-
|
|
239
|
-
-
|
|
240
|
-
- No payments to owner until periodic execution
|
|
241
|
-
- **Minimum enforcement**: 24 hours from start time (if no payments) or last payment time
|
|
160
|
+
- SDK inputs are always **string addresses**
|
|
161
|
+
- `.web3js(PublicKey)` converts output to web3.js format with PublicKey instances
|
|
162
|
+
- Use when working with browser wallets (Phantom, Solflare, etc.)
|
|
242
163
|
|
|
243
|
-
###
|
|
164
|
+
### Smart Parameters (v3)
|
|
244
165
|
|
|
245
|
-
The
|
|
166
|
+
The SDK v3 introduces smart parameters that make working with amounts and durations more intuitive:
|
|
246
167
|
|
|
168
|
+
#### Duration Parameters
|
|
247
169
|
```typescript
|
|
248
|
-
//
|
|
249
|
-
const
|
|
170
|
+
// Smart duration objects - no mental math needed!
|
|
171
|
+
const contract = await createContract({
|
|
250
172
|
owner: wallet,
|
|
251
173
|
fleet: fleetAddress,
|
|
252
174
|
ownerProfile: profileAddress,
|
|
253
|
-
rate:
|
|
254
|
-
durationMin:
|
|
255
|
-
durationMax:
|
|
256
|
-
paymentsFreq: 'daily'
|
|
175
|
+
rate: 10, // ATLAS per period (v3 default)
|
|
176
|
+
durationMin: { hours: 1 }, // 1 hour minimum
|
|
177
|
+
durationMax: { weeks: 2 }, // 2 weeks maximum
|
|
178
|
+
paymentsFreq: 'daily'
|
|
257
179
|
});
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
**Payment Schedule:**
|
|
261
180
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
181
|
+
// Supported duration formats
|
|
182
|
+
duration: { minutes: 30 } // 30 minutes
|
|
183
|
+
duration: { hours: 12 } // 12 hours
|
|
184
|
+
duration: { days: 7 } // 7 days
|
|
185
|
+
duration: { weeks: 4 } // 4 weeks
|
|
186
|
+
duration: { months: 3 } // 3 months (31 days each)
|
|
265
187
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
Each payment is calculated based on elapsed time since the last payment:
|
|
269
|
-
|
|
270
|
-
```text
|
|
271
|
-
payment_amount = (elapsed_time / frequency_seconds) × rate × ATLAS_TO_STARDUST
|
|
188
|
+
// Backwards compatible - raw seconds still work
|
|
189
|
+
duration: 604800 // 7 days in seconds
|
|
272
190
|
```
|
|
273
191
|
|
|
274
|
-
|
|
192
|
+
#### Amount and Rate Parameters
|
|
193
|
+
```typescript
|
|
194
|
+
// v3 Default: Numbers are ATLAS
|
|
195
|
+
const contract = await createContract({
|
|
196
|
+
rate: 10, // 10 ATLAS per period (NEW DEFAULT)
|
|
197
|
+
durationMax: { days: 30 },
|
|
198
|
+
// ...
|
|
199
|
+
});
|
|
275
200
|
|
|
276
|
-
|
|
201
|
+
// Explicit formats for clarity
|
|
202
|
+
rate: { atlas: 10 } // 10 ATLAS per period
|
|
203
|
+
rate: { stardust: 1000000000 } // 10 ATLAS in stardust units
|
|
277
204
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
205
|
+
// Accept rental with smart amount
|
|
206
|
+
const rental = await acceptRental({
|
|
207
|
+
borrower: wallet,
|
|
208
|
+
contract: "ContractAddr...",
|
|
209
|
+
duration: { days: 7 }, // Smart duration
|
|
210
|
+
// amount calculated automatically
|
|
211
|
+
});
|
|
283
212
|
```
|
|
284
213
|
|
|
285
|
-
|
|
214
|
+
#### Breaking Change Notice
|
|
215
|
+
**v3 Breaking Change**: Rate and amount parameters now default to ATLAS units instead of stardust. This makes the SDK more intuitive but requires updating existing code:
|
|
286
216
|
|
|
287
217
|
```typescript
|
|
288
|
-
//
|
|
289
|
-
|
|
290
|
-
const referralFee = totalFee * REFERRAL_BPS / BASE_BPS; // 10% of total fee
|
|
291
|
-
const platformFee = totalFee - referralFee; // 90% of total fee
|
|
292
|
-
const ownerPayment = paymentAmount - totalFee; // 90% of payment
|
|
293
|
-
```
|
|
218
|
+
// v2 (old) - rate in stardust
|
|
219
|
+
rate: 1000000000 // 10 ATLAS in stardust
|
|
294
220
|
|
|
295
|
-
|
|
221
|
+
// v3 (new) - rate in ATLAS
|
|
222
|
+
rate: 10 // 10 ATLAS (much cleaner!)
|
|
296
223
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
├── Total Fee (10%): 100 ATLAS
|
|
300
|
-
│ ├── Referral Fee (10% of total fee): 10 ATLAS → Referrer
|
|
301
|
-
│ └── Platform Fee (90% of total fee): 90 ATLAS → Platform
|
|
302
|
-
└── Owner Payment (90%): 900 ATLAS → Fleet Owner
|
|
224
|
+
// v3 with explicit unit
|
|
225
|
+
rate: { atlas: 10 }
|
|
303
226
|
```
|
|
304
227
|
|
|
305
|
-
###
|
|
306
|
-
|
|
307
|
-
Each periodic payment is distributed in this order:
|
|
308
|
-
|
|
309
|
-
1. **Referral Payment** (if referrer exists and ≠ system_program::ID)
|
|
310
|
-
- Amount: `total_fee × REFERRAL_BPS ÷ BASE_BPS`
|
|
311
|
-
- Destination: Referrer's token account
|
|
312
|
-
|
|
313
|
-
2. **Platform Fee Payment**
|
|
314
|
-
- Amount: `total_fee - referral_payment`
|
|
315
|
-
- Destination: Platform fee account
|
|
228
|
+
### Contract Management
|
|
316
229
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
- Destination: Fleet owner's token account
|
|
230
|
+
```typescript
|
|
231
|
+
import { createContract, closeContract } from '@wuwei-labs/srsly';
|
|
320
232
|
|
|
321
|
-
|
|
233
|
+
// Create rental contract instruction
|
|
234
|
+
const createIx = await createContract({
|
|
235
|
+
owner: wallet,
|
|
236
|
+
fleet: fleetAddress,
|
|
237
|
+
ownerProfile: profileAddress,
|
|
238
|
+
rate: 5, // 5 ATLAS per day (v3 default)
|
|
239
|
+
durationMax: { months: 1 }, // 1 month maximum
|
|
240
|
+
paymentsFreq: 'daily'
|
|
241
|
+
});
|
|
322
242
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
borrower: wallet,
|
|
327
|
-
borrowerProfile: profileAddress,
|
|
328
|
-
borrowerFaction: 'mud',
|
|
243
|
+
// Close contract instruction
|
|
244
|
+
const closeIx = await closeContract({
|
|
245
|
+
owner: wallet,
|
|
329
246
|
fleet: fleetAddress,
|
|
330
247
|
contract: contractAddress,
|
|
331
|
-
|
|
332
|
-
duration: 86400,
|
|
333
|
-
referralTokenAccount: referrerTokenAccount // 10% of fees
|
|
248
|
+
faction: 'mud' // or 1, 2, 3
|
|
334
249
|
});
|
|
335
250
|
```
|
|
336
251
|
|
|
337
|
-
|
|
252
|
+
#### Important Contract Close Behavior
|
|
338
253
|
|
|
339
|
-
|
|
254
|
+
**Contract closure behavior depends on the rental state:**
|
|
340
255
|
|
|
341
|
-
**
|
|
256
|
+
- **No Active Rental**: If `current_rental_state` is not set (equals system program ID), the contract closes immediately
|
|
257
|
+
- **Active Rental**: If there's an active rental (`current_rental_state` is set), the contract is only flagged for closure (`to_close = true`)
|
|
258
|
+
- **Two-Step Closure Process**: When a contract has an active rental, you must:
|
|
259
|
+
1. Use `closeRental()` to close the rental (when expired)
|
|
260
|
+
2. Then use `closeContract()` to close the flagged contract
|
|
342
261
|
|
|
343
262
|
```typescript
|
|
344
|
-
|
|
345
|
-
|
|
263
|
+
// Step 1: Close the expired rental
|
|
264
|
+
const closeRentalIx = await closeRental({
|
|
265
|
+
borrower: borrowerWallet,
|
|
346
266
|
contract: contractAddress,
|
|
347
|
-
rentalState: rentalStateAddress
|
|
267
|
+
rentalState: rentalStateAddress,
|
|
268
|
+
ownerTokenAccount: ownerTokenAccountAddress
|
|
348
269
|
});
|
|
349
|
-
```
|
|
350
270
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
**Scenario**: 10-day rental with daily payments, 1000 ATLAS/day rate
|
|
360
|
-
|
|
361
|
-
```text
|
|
362
|
-
Day 0: Rental Accepted
|
|
363
|
-
├── Escrow: 10,000 ATLAS deposited
|
|
364
|
-
├── Thread: Created for daily execution at 00:00 UTC
|
|
365
|
-
├── Fleet: Transferred to borrower
|
|
366
|
-
└── Minimum 24-hour commitment begins (from start time)
|
|
367
|
-
|
|
368
|
-
00:00 UTC Next Day: First Payment
|
|
369
|
-
├── Amount: 1,000 ATLAS from escrow
|
|
370
|
-
├── Total Fee (10%): 100 ATLAS
|
|
371
|
-
│ ├── Referrer: 10 ATLAS (10% of total fee)
|
|
372
|
-
│ └── Platform: 90 ATLAS (90% of total fee)
|
|
373
|
-
├── Owner: 900 ATLAS (90% of payment)
|
|
374
|
-
├── Escrow: 9,000 ATLAS remaining
|
|
375
|
-
└── New 24-hour minimum period begins (from payment time)
|
|
376
|
-
|
|
377
|
-
Daily at 00:00 UTC: Subsequent Payments
|
|
378
|
-
├── Same distribution pattern
|
|
379
|
-
├── Escrow decreases by 1,000 ATLAS each day
|
|
380
|
-
└── Each payment resets 24-hour minimum period
|
|
381
|
-
|
|
382
|
-
Final Day at 00:00 UTC: Final Payment & Cleanup
|
|
383
|
-
├── Final payment processed
|
|
384
|
-
├── Thread: Automatically closed
|
|
385
|
-
├── Rental State: Closed, lamports to borrower
|
|
386
|
-
└── Fleet: Returned to owner or contract
|
|
387
|
-
|
|
388
|
-
Early Cancellation Examples:
|
|
389
|
-
|
|
390
|
-
Scenario A - Cancel before first payment (Day 0 at 6 PM):
|
|
391
|
-
├── Cancelled 6 hours after start
|
|
392
|
-
├── Rental extends until 24 hours from start time (Day 1 at start time)
|
|
393
|
-
├── Pro-rata refund calculated from Day 1 extended end onwards
|
|
394
|
-
└── Borrower receives refund for Days 1-10
|
|
395
|
-
|
|
396
|
-
Scenario B - Cancel after payments made (Day 3 at 6 PM):
|
|
397
|
-
├── Cancelled 18 hours after Day 3 payment (00:00 UTC)
|
|
398
|
-
├── Rental extends until 24 hours from last payment (Day 4 at 00:00 UTC)
|
|
399
|
-
├── Pro-rata refund calculated from Day 4 onwards
|
|
400
|
-
└── Borrower receives refund for Days 4-10
|
|
271
|
+
// Step 2: Close the flagged contract (must be done by contract owner)
|
|
272
|
+
const closeContractIx = await closeContract({
|
|
273
|
+
owner: wallet,
|
|
274
|
+
fleet: fleetAddress,
|
|
275
|
+
contract: contractAddress,
|
|
276
|
+
faction: 'mud'
|
|
277
|
+
});
|
|
401
278
|
```
|
|
402
279
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
**Insufficient Escrow Balance:**
|
|
406
|
-
|
|
407
|
-
- Payment amount is limited to available escrow balance
|
|
408
|
-
- Remaining balance distributed proportionally
|
|
409
|
-
|
|
410
|
-
**Early Termination:**
|
|
411
|
-
|
|
412
|
-
- **Cancellation Notice**: Must have more than one payment period remaining to cancel
|
|
413
|
-
- **Minimum Period Enforcement**:
|
|
414
|
-
- Before first payment: Active for 24 hours from start time
|
|
415
|
-
- After payment(s): Active for 24 hours from last payment time
|
|
416
|
-
- **Pro-rata Refund**: Refund calculated from the enforced minimum end time
|
|
417
|
-
- Fleet returned to owner when minimum period expires
|
|
418
|
-
- Payment thread continues until minimum period ends
|
|
419
|
-
|
|
420
|
-
**Contract Closure:**
|
|
421
|
-
|
|
422
|
-
- Final payment processed if rental active
|
|
423
|
-
- All remaining resources cleaned up
|
|
424
|
-
- Fleet rental capability removed
|
|
280
|
+
**Thread-based Payment Processing**: The SRSLY program uses automated thread-based payment processing through the Antegen/Clockwork system. The `rental_pay` instruction automatically:
|
|
425
281
|
|
|
426
|
-
|
|
282
|
+
- Processes periodic payments from escrow to owner
|
|
283
|
+
- Handles rental completion and cleanup when expired
|
|
284
|
+
- Closes flagged contracts after rental ends
|
|
427
285
|
|
|
428
|
-
|
|
286
|
+
Manual intervention is only needed when the automated system doesn't process successfully.
|
|
429
287
|
|
|
430
|
-
|
|
431
|
-
- `weekly` - Weekly payments at specific day/time
|
|
432
|
-
- `monthly` - Monthly payments at specific day/time
|
|
433
|
-
|
|
434
|
-
## Error Handling
|
|
435
|
-
|
|
436
|
-
The SDK includes comprehensive error types:
|
|
288
|
+
### Rental Operations
|
|
437
289
|
|
|
438
290
|
```typescript
|
|
439
|
-
import {
|
|
440
|
-
|
|
441
|
-
try {
|
|
442
|
-
const instruction = await createContract({...});
|
|
443
|
-
} catch (error) {
|
|
444
|
-
if (error instanceof SrslyError) {
|
|
445
|
-
console.error('SRSLY Error:', error.message);
|
|
446
|
-
console.error('Error code:', error.code);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
## Network Configuration
|
|
291
|
+
import { acceptRental, cancelRental, closeRental, resetRental } from '@wuwei-labs/srsly';
|
|
292
|
+
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
452
293
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
294
|
+
// Accept rental offer instruction (all addresses are strings)
|
|
295
|
+
const acceptIx = await acceptRental({
|
|
296
|
+
borrower: borrowerWallet, // signer object or string address
|
|
297
|
+
borrowerProfile: borrowerProfileAddress, // string address
|
|
298
|
+
borrowerFaction: 'mud', // or 1, 2, 3 (optional - auto-resolved from fleet)
|
|
299
|
+
contract: contractAddress, // string address
|
|
300
|
+
duration: { days: 1 } // Smart duration parameter (v3)
|
|
301
|
+
// amount is calculated automatically based on contract rate
|
|
302
|
+
});
|
|
458
303
|
|
|
459
|
-
|
|
460
|
-
|
|
304
|
+
// Cancel active rental instruction
|
|
305
|
+
// Note: Must cancel at least one payment period before rental ends
|
|
306
|
+
const cancelIx = await cancelRental({
|
|
307
|
+
borrower: borrowerWallet,
|
|
308
|
+
contract: contractAddress,
|
|
309
|
+
rentalState: rentalStateAddress
|
|
310
|
+
});
|
|
461
311
|
|
|
462
|
-
//
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
312
|
+
// Close completed rental instruction
|
|
313
|
+
const closeIx = await closeRental({
|
|
314
|
+
borrower: borrowerWallet,
|
|
315
|
+
contract: contractAddress,
|
|
316
|
+
rentalState: rentalStateAddress,
|
|
317
|
+
ownerTokenAccount: ownerTokenAccountAddress
|
|
466
318
|
});
|
|
467
319
|
|
|
468
|
-
//
|
|
469
|
-
|
|
320
|
+
// Reset rental instruction
|
|
321
|
+
const resetIx = await resetRental({
|
|
322
|
+
borrower: borrowerWallet,
|
|
323
|
+
contract: contractAddress,
|
|
324
|
+
rentalState: rentalStateAddress
|
|
325
|
+
});
|
|
470
326
|
|
|
471
|
-
//
|
|
472
|
-
|
|
327
|
+
// Convert any instruction to web3.js format for wallet compatibility
|
|
328
|
+
const web3jsAcceptIx = await acceptRental(params).web3js(PublicKey);
|
|
329
|
+
const web3jsCancelIx = await cancelRental(params).web3js(PublicKey);
|
|
473
330
|
|
|
474
|
-
//
|
|
475
|
-
const
|
|
476
|
-
|
|
331
|
+
// Use in web3.js transactions
|
|
332
|
+
const transaction = new Transaction()
|
|
333
|
+
.add(web3jsAcceptIx)
|
|
334
|
+
.add(web3jsCancelIx);
|
|
477
335
|
```
|
|
478
336
|
|
|
479
|
-
|
|
337
|
+
## Configuration
|
|
480
338
|
|
|
481
|
-
|
|
339
|
+
The SDK provides simple configuration:
|
|
482
340
|
|
|
483
341
|
```typescript
|
|
484
|
-
import {
|
|
485
|
-
|
|
486
|
-
//
|
|
487
|
-
setConfig({
|
|
342
|
+
import { setConfig, getConfig, clearConfig } from '@wuwei-labs/srsly';
|
|
343
|
+
|
|
344
|
+
// Set configuration (RPC URL is always required)
|
|
345
|
+
setConfig({
|
|
346
|
+
rpcUrl: 'https://your-rpc-endpoint.com', // REQUIRED - no defaults provided
|
|
347
|
+
srslyProgramAddress: 'custom-program-address...', // Optional override
|
|
348
|
+
profileFactionProgramAddress: 'custom-profile-program...', // Optional override
|
|
349
|
+
gameId: 'custom-game-id...', // Optional override
|
|
350
|
+
atlasMint: 'custom-atlas-mint...' // Optional override
|
|
351
|
+
});
|
|
488
352
|
|
|
489
|
-
//
|
|
490
|
-
|
|
353
|
+
// Example configurations
|
|
354
|
+
setConfig({
|
|
355
|
+
rpcUrl: 'https://api.mainnet-beta.solana.com'
|
|
356
|
+
});
|
|
357
|
+
setConfig({
|
|
358
|
+
rpcUrl: 'https://api.devnet.solana.com'
|
|
359
|
+
});
|
|
491
360
|
|
|
492
|
-
//
|
|
493
|
-
|
|
361
|
+
// Check current configuration
|
|
362
|
+
console.log(getConfig());
|
|
494
363
|
|
|
495
|
-
//
|
|
496
|
-
|
|
497
|
-
sageProgramAddress: 'custom...',
|
|
498
|
-
gameId: 'custom...'
|
|
499
|
-
// network: 'mainnet' inherited from global config
|
|
500
|
-
});
|
|
364
|
+
// Reset to defaults (you'll need to setConfig again with rpcUrl)
|
|
365
|
+
clearConfig();
|
|
501
366
|
```
|
|
502
367
|
|
|
503
368
|
### Configuration Options
|
|
504
369
|
|
|
505
|
-
|
|
370
|
+
| Option | Type | Description | Default |
|
|
371
|
+
|--------|------|-------------|---------|
|
|
372
|
+
| `rpcUrl` | `string` | **REQUIRED** - RPC endpoint for fetching accounts | None (must provide) |
|
|
373
|
+
| `srslyProgramAddress` | `string` | SRSLY program address override | `SRSLY1fq9TJqCk1gNSE7VZL2bztvTn9wm4VR8u8jMKT` |
|
|
374
|
+
| `profileFactionProgramAddress` | `string` | Profile Faction program override | Network dependent |
|
|
375
|
+
| `gameId` | `string` | SAGE game ID override | Network dependent |
|
|
376
|
+
| `atlasMint` | `string` | ATLAS token mint override | Network dependent |
|
|
506
377
|
|
|
507
|
-
|
|
378
|
+
## Duration and Payment Frequency
|
|
508
379
|
|
|
509
|
-
|
|
510
|
-
// Uses global configuration if set, otherwise devnet
|
|
511
|
-
await createContract(params);
|
|
512
|
-
await acceptRental(params);
|
|
513
|
-
```
|
|
380
|
+
**Important**: All durations must be aligned with the payment frequency to ensure proper payment calculations.
|
|
514
381
|
|
|
515
|
-
|
|
382
|
+
### Duration Rules
|
|
516
383
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
- `clearConfig()` - Reset to devnet defaults
|
|
384
|
+
1. **Duration Units**: Use smart duration objects (`{ days: 7 }`) or raw seconds for backwards compatibility
|
|
385
|
+
2. **Alignment Requirement**: Durations must be multiples of the payment frequency interval
|
|
386
|
+
3. **Validation**: The SDK automatically validates duration alignment and throws an error if invalid
|
|
521
387
|
|
|
522
|
-
|
|
388
|
+
### Payment Frequency Intervals
|
|
523
389
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
390
|
+
| Frequency | Interval | Example Valid Durations |
|
|
391
|
+
|-----------|----------|------------------------|
|
|
392
|
+
| `hourly` | 3,600 seconds (1 hour) | 3,600 (1h), 7,200 (2h), 86,400 (24h) |
|
|
393
|
+
| `daily` | 86,400 seconds (1 day) | 86,400 (1d), 172,800 (2d), 604,800 (7d) |
|
|
394
|
+
| `weekly` | 604,800 seconds (1 week) | 604,800 (1w), 1,209,600 (2w), 2,419,200 (4w) |
|
|
395
|
+
| `monthly` | 2,678,400 seconds (31 days) | 2,678,400 (1m), 5,356,800 (2m) |
|
|
527
396
|
|
|
528
|
-
|
|
397
|
+
### Examples
|
|
529
398
|
|
|
530
399
|
```typescript
|
|
531
|
-
//
|
|
532
|
-
await createContract(
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
setConfig({ network: 'mainnet' });
|
|
538
|
-
await createContract(params); // Uses mainnet
|
|
539
|
-
await acceptRental(params).set({ network: 'devnet' }); // Override to devnet
|
|
540
|
-
await closeContract(params).set({ gameId: 'custom...' }); // Custom gameId, mainnet network
|
|
541
|
-
```
|
|
400
|
+
// ✅ Valid: 7 day max duration with daily payments
|
|
401
|
+
await createContract({
|
|
402
|
+
rate: 10, // 10 ATLAS per day (v3 default)
|
|
403
|
+
durationMax: { days: 7 }, // Smart duration parameter
|
|
404
|
+
paymentsFreq: 'daily' // Min duration automatically set to 1 day
|
|
405
|
+
});
|
|
542
406
|
|
|
543
|
-
|
|
407
|
+
// ❌ Invalid: 3.5 day max duration with daily payments
|
|
408
|
+
await createContract({
|
|
409
|
+
rate: 10,
|
|
410
|
+
durationMax: 302400, // 3.5 days (302400 % 86400 = 43200) ✗
|
|
411
|
+
paymentsFreq: 'daily'
|
|
412
|
+
});
|
|
413
|
+
// Error: Duration (302400 seconds) must be a multiple of daily frequency (86400 seconds)
|
|
544
414
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}
|
|
415
|
+
// ✅ Valid: Hourly payments with hour-aligned max duration
|
|
416
|
+
await createContract({
|
|
417
|
+
rate: 1, // 1 ATLAS per hour
|
|
418
|
+
durationMax: { hours: 48 }, // 48 hours (smart parameter)
|
|
419
|
+
paymentsFreq: 'hourly' // Min duration automatically set to 1 hour
|
|
420
|
+
});
|
|
552
421
|
```
|
|
553
422
|
|
|
554
|
-
###
|
|
423
|
+
### Rate Calculation
|
|
555
424
|
|
|
556
|
-
The
|
|
557
|
-
|
|
558
|
-
```typescript
|
|
559
|
-
import {
|
|
560
|
-
getSageProgramAddress,
|
|
561
|
-
getProfileFactionProgramAddress,
|
|
562
|
-
getSageGameId
|
|
563
|
-
} from '@wuwei-labs/srsly';
|
|
425
|
+
The `rate` parameter in contracts represents ATLAS tokens per payment period that the owner will receive:
|
|
564
426
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
427
|
+
- For `daily` frequency: rate is ATLAS per day
|
|
428
|
+
- For `weekly` frequency: rate is ATLAS per week
|
|
429
|
+
- For `hourly` frequency: rate is ATLAS per hour
|
|
568
430
|
|
|
569
|
-
|
|
570
|
-
const mainnetSageProgram = await getSageProgramAddress({ network: 'mainnet' });
|
|
571
|
-
const mainnetGameId = await getSageGameId({ network: 'mainnet' });
|
|
572
|
-
```
|
|
431
|
+
**Important**: The 10% service fee is collected upfront from the borrower. The rental state stores the net rate (after fees) to ensure consistent payments to the owner regardless of future fee changes.
|
|
573
432
|
|
|
574
|
-
##
|
|
433
|
+
## Payment System
|
|
575
434
|
|
|
576
|
-
|
|
435
|
+
SRSLY implements an escrow-based payment system:
|
|
577
436
|
|
|
578
|
-
|
|
437
|
+
1. **Escrow**: Borrower deposits full rental amount upfront
|
|
438
|
+
2. **Service Fee**: 10% fee collected upfront at rental acceptance
|
|
439
|
+
3. **Net Rate**: Rental state stores the net rate (after fees), ensuring owners receive consistent payments
|
|
440
|
+
4. **Periodic Payments**: Automated payments based on frequency (hourly/daily/weekly/monthly)
|
|
441
|
+
5. **Refunds**: Pro-rata refunds for early cancellation (must cancel at least one payment period before rental ends)
|
|
579
442
|
|
|
580
443
|
```typescript
|
|
581
|
-
//
|
|
582
|
-
|
|
444
|
+
// Payment calculation example (v3 with ATLAS as default)
|
|
445
|
+
const rate = 10; // 10 ATLAS per day (v3 default unit)
|
|
446
|
+
const paymentFrequency = 'daily'; // Payment every 86400 seconds
|
|
447
|
+
const durationDays = 7; // 7 days
|
|
448
|
+
const paymentPeriods = 7; // 7 daily periods
|
|
449
|
+
const grossAmount = rate * paymentPeriods; // 70 ATLAS total
|
|
450
|
+
const serviceFee = grossAmount * 0.10; // 7 ATLAS fee (10%)
|
|
451
|
+
const netAmount = grossAmount - serviceFee; // 63 ATLAS to escrow
|
|
452
|
+
|
|
453
|
+
// The rental state will store: netAmount / paymentPeriods = 9 ATLAS per period
|
|
454
|
+
// This ensures the owner receives the full rate regardless of fee changes
|
|
455
|
+
```
|
|
583
456
|
|
|
584
|
-
|
|
585
|
-
import devnetIdl from '@wuwei-labs/srsly/idl/devnet';
|
|
457
|
+
## Program Information
|
|
586
458
|
|
|
587
|
-
|
|
588
|
-
import { Program } from '@coral-xyz/anchor';
|
|
589
|
-
const program = new Program(mainnetIdl, provider);
|
|
590
|
-
```
|
|
459
|
+
The SRSLY program is network agnostic with the same address across all networks:
|
|
591
460
|
|
|
592
|
-
|
|
461
|
+
**SRSLY Program ID**: `SRSLY1fq9TJqCk1gNSE7VZL2bztvTn9wm4VR8u8jMKT`
|
|
593
462
|
|
|
594
|
-
|
|
463
|
+
Note: While the SRSLY program is network agnostic, Star Atlas programs (SAGE, Profile, etc.) may have different addresses on different networks. The SDK will automatically detect these based on your RPC endpoint.
|
|
464
|
+
|
|
465
|
+
## Types and Constants
|
|
595
466
|
|
|
596
467
|
```typescript
|
|
597
|
-
import type {
|
|
468
|
+
import type {
|
|
598
469
|
ContractState,
|
|
599
470
|
RentalState,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
ThreadResponse,
|
|
603
|
-
ConfigOptions
|
|
471
|
+
ConfigOptions,
|
|
472
|
+
PaymentFrequency
|
|
604
473
|
} from '@wuwei-labs/srsly';
|
|
605
474
|
|
|
606
|
-
|
|
607
|
-
import type { Srsly as SrslyMainnet } from '@wuwei-labs/srsly/types/mainnet';
|
|
608
|
-
import type { Srsly as SrslyDevnet } from '@wuwei-labs/srsly/types/devnet';
|
|
609
|
-
```
|
|
610
|
-
|
|
611
|
-
## Constants and Utilities
|
|
612
|
-
|
|
613
|
-
### Available Constants
|
|
614
|
-
|
|
615
|
-
```typescript
|
|
616
|
-
import {
|
|
475
|
+
import {
|
|
617
476
|
ATLAS_TO_STARDUST,
|
|
618
|
-
|
|
619
|
-
STARBASE_PLAYER_SEED,
|
|
620
|
-
SAGE_PLAYER_PROFILE_SEED,
|
|
621
|
-
PROFILE_FACTION_SEED,
|
|
622
|
-
FACTION_MAPPING,
|
|
623
|
-
FACTION_SPECIFIC_CSS
|
|
477
|
+
FACTION_MAPPING
|
|
624
478
|
} from '@wuwei-labs/srsly';
|
|
625
479
|
|
|
626
|
-
//
|
|
480
|
+
// Conversion rate: 1 ATLAS = 100,000,000 stardust
|
|
627
481
|
console.log(ATLAS_TO_STARDUST); // 100_000_000
|
|
628
482
|
|
|
629
483
|
// Faction mappings
|
|
630
484
|
console.log(FACTION_MAPPING[1]); // 'mud'
|
|
631
|
-
console.log(FACTION_MAPPING[2]); // 'oni'
|
|
485
|
+
console.log(FACTION_MAPPING[2]); // 'oni'
|
|
632
486
|
console.log(FACTION_MAPPING[3]); // 'ustur'
|
|
487
|
+
|
|
488
|
+
// Smart duration parameters (v3)
|
|
489
|
+
// Use objects for duration: { days: 7 }, { hours: 12 }, { months: 1 }
|
|
490
|
+
// Or raw seconds for backwards compatibility: 604800
|
|
633
491
|
```
|
|
634
492
|
|
|
635
|
-
|
|
493
|
+
## IDL and Program Information
|
|
636
494
|
|
|
637
495
|
```typescript
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
deriveStarbase,
|
|
642
|
-
deriveStarbasePlayer,
|
|
643
|
-
deriveGameAccounts
|
|
644
|
-
} from '@wuwei-labs/srsly';
|
|
496
|
+
// Access program IDL
|
|
497
|
+
import idl from '@wuwei-labs/srsly/idl';
|
|
498
|
+
```
|
|
645
499
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
500
|
+
## Error Handling
|
|
501
|
+
|
|
502
|
+
```typescript
|
|
503
|
+
import { SrslyError } from '@wuwei-labs/srsly';
|
|
504
|
+
|
|
505
|
+
try {
|
|
506
|
+
const instruction = await createContract(params);
|
|
507
|
+
// Add to transaction and send...
|
|
508
|
+
} catch (error) {
|
|
509
|
+
if (error instanceof SrslyError) {
|
|
510
|
+
console.error('SRSLY SDK Error:', error.message, error.code);
|
|
511
|
+
} else {
|
|
512
|
+
console.error('Other Error:', error);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
658
515
|
```
|
|
659
516
|
|
|
660
|
-
##
|
|
517
|
+
## Package Structure
|
|
661
518
|
|
|
662
|
-
|
|
519
|
+
The SDK provides optimized builds for different environments:
|
|
520
|
+
|
|
521
|
+
- **CommonJS**: `./dist/cjs/` (Node.js, webpack)
|
|
522
|
+
- **ESM**: `./dist/esm/` (Modern ES modules)
|
|
523
|
+
- **Types**: `./dist/types/` (TypeScript definitions)
|
|
524
|
+
- **Codama**: `./dist/*/codama/` (Generated Solana program interfaces)
|
|
525
|
+
- **IDL**: `./target/idl/srsly.json` (Anchor IDL)
|
|
526
|
+
- **Types**: `./target/types/srsly.ts` (Generated types)
|
|
663
527
|
|
|
664
|
-
##
|
|
528
|
+
## Links
|
|
665
529
|
|
|
666
|
-
- **
|
|
667
|
-
- **
|
|
668
|
-
- **
|
|
530
|
+
- **NPM Package**: [@wuwei-labs/srsly](https://www.npmjs.com/package/@wuwei-labs/srsly)
|
|
531
|
+
- **TypeDoc Documentation**: [API Reference](https://wuwei-labs.github.io/srsly/)
|
|
532
|
+
- **Browser Usage Examples**: [Browser Integration Guide](./examples/browser-usage.md)
|
|
533
|
+
- **Universal Signer Tests**: [Test Examples](./tests/features/universal-signer.test.mjs)
|