@wuwei-labs/srsly 2.3.3-canary.36.16828894446.0 → 3.0.0-beta.2
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 +126 -462
- package/dist/cjs/accounts/borrower.js +47 -0
- package/dist/cjs/accounts/borrower.js.map +1 -0
- package/dist/cjs/accounts/config.js +47 -0
- package/dist/cjs/accounts/config.js.map +1 -0
- package/dist/cjs/accounts/contract.js +47 -0
- package/dist/cjs/accounts/contract.js.map +1 -0
- package/dist/cjs/accounts/fleet.js +77 -0
- package/dist/cjs/accounts/fleet.js.map +1 -0
- package/dist/cjs/accounts/rental.js +47 -0
- package/dist/cjs/accounts/rental.js.map +1 -0
- package/dist/cjs/demos.js +124 -59
- package/dist/cjs/demos.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/borrowerState.js +84 -0
- package/dist/cjs/generated/codama/accounts/borrowerState.js.map +1 -0
- package/dist/cjs/generated/codama/accounts/configState.js +37 -52
- package/dist/cjs/generated/codama/accounts/configState.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/contractState.js +27 -51
- package/dist/cjs/generated/codama/accounts/contractState.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/index.js +5 -2
- package/dist/cjs/generated/codama/accounts/index.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/memberState.js +78 -0
- package/dist/cjs/generated/codama/accounts/memberState.js.map +1 -0
- package/dist/cjs/generated/codama/accounts/rentalState.js +23 -59
- package/dist/cjs/generated/codama/accounts/rentalState.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/thread.js +45 -61
- package/dist/cjs/generated/codama/accounts/thread.js.map +1 -1
- package/dist/cjs/generated/codama/accounts/vaultState.js +82 -0
- package/dist/cjs/generated/codama/accounts/vaultState.js.map +1 -0
- package/dist/cjs/generated/codama/errors/index.js +2 -2
- package/dist/cjs/generated/codama/errors/srsly.js +158 -19
- package/dist/cjs/generated/codama/errors/srsly.js.map +1 -1
- package/dist/cjs/generated/codama/index.js +2 -2
- package/dist/cjs/generated/codama/instructions/acceptRental.js +107 -40
- package/dist/cjs/generated/codama/instructions/acceptRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/cancelRental.js +53 -56
- package/dist/cjs/generated/codama/instructions/cancelRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/captureRental.js +129 -0
- package/dist/cjs/generated/codama/instructions/captureRental.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/claimBorrower.js +222 -0
- package/dist/cjs/generated/codama/instructions/claimBorrower.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/claimBorrowerPayments.js +225 -0
- package/dist/cjs/generated/codama/instructions/claimBorrowerPayments.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/claimContractPayments.js +230 -0
- package/dist/cjs/generated/codama/instructions/claimContractPayments.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/closeBorrower.js +84 -0
- package/dist/cjs/generated/codama/instructions/closeBorrower.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/closeContract.js +140 -31
- package/dist/cjs/generated/codama/instructions/closeContract.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/closeRental.js +31 -28
- package/dist/cjs/generated/codama/instructions/closeRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/createConfig.js +212 -0
- package/dist/cjs/generated/codama/instructions/createConfig.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/createContract.js +47 -45
- package/dist/cjs/generated/codama/instructions/createContract.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/deleteBorrower.js +126 -0
- package/dist/cjs/generated/codama/instructions/deleteBorrower.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/deleteConfig.js +193 -0
- package/dist/cjs/generated/codama/instructions/deleteConfig.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/deleteContract.js +115 -0
- package/dist/cjs/generated/codama/instructions/deleteContract.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/deleteRental.js +115 -0
- package/dist/cjs/generated/codama/instructions/deleteRental.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/discountBorrower.js +118 -0
- package/dist/cjs/generated/codama/instructions/discountBorrower.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/index.js +15 -4
- package/dist/cjs/generated/codama/instructions/index.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/payRental.js +95 -68
- package/dist/cjs/generated/codama/instructions/payRental.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/{resetRental.js → releaseRental.js} +79 -38
- package/dist/cjs/generated/codama/instructions/releaseRental.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/reserveRental.js +255 -0
- package/dist/cjs/generated/codama/instructions/reserveRental.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/{initializeConfig.js → updateBorrower.js} +45 -52
- package/dist/cjs/generated/codama/instructions/updateBorrower.js.map +1 -0
- package/dist/cjs/generated/codama/instructions/updateConfig.js +41 -32
- package/dist/cjs/generated/codama/instructions/updateConfig.js.map +1 -1
- package/dist/cjs/generated/codama/instructions/updateContract.js +134 -0
- package/dist/cjs/generated/codama/instructions/updateContract.js.map +1 -0
- package/dist/cjs/generated/codama/programs/index.js +2 -2
- package/dist/cjs/generated/codama/programs/srsly.js +74 -18
- package/dist/cjs/generated/codama/programs/srsly.js.map +1 -1
- package/dist/cjs/generated/codama/shared/index.js +2 -2
- package/dist/cjs/generated/codama/shared/index.js.map +1 -1
- package/dist/cjs/generated/codama/types/capturedFlagData.js +31 -0
- package/dist/cjs/generated/codama/types/capturedFlagData.js.map +1 -0
- package/dist/cjs/generated/codama/types/index.js +7 -9
- package/dist/cjs/generated/codama/types/index.js.map +1 -1
- package/dist/cjs/generated/codama/types/memberConfig.js +33 -0
- package/dist/cjs/generated/codama/types/memberConfig.js.map +1 -0
- package/dist/cjs/generated/codama/types/memberType.js +55 -0
- package/dist/cjs/generated/codama/types/memberType.js.map +1 -0
- package/dist/cjs/generated/codama/types/paymentFrequency.js +2 -2
- package/dist/cjs/generated/codama/types/schedule.js +65 -0
- package/dist/cjs/generated/codama/types/schedule.js.map +1 -0
- package/dist/cjs/generated/codama/types/signal.js +48 -0
- package/dist/cjs/generated/codama/types/signal.js.map +1 -0
- package/dist/cjs/generated/codama/types/trigger.js +36 -23
- package/dist/cjs/generated/codama/types/trigger.js.map +1 -1
- package/dist/cjs/index.js +172 -245
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/instructions/acceptRental.js +153 -0
- package/dist/cjs/instructions/acceptRental.js.map +1 -0
- package/dist/cjs/instructions/cancelRental.js +100 -0
- package/dist/cjs/instructions/cancelRental.js.map +1 -0
- package/dist/cjs/instructions/captureRental.js +85 -0
- package/dist/cjs/instructions/captureRental.js.map +1 -0
- package/dist/cjs/instructions/claimBorrower.js +66 -0
- package/dist/cjs/instructions/claimBorrower.js.map +1 -0
- package/dist/cjs/instructions/claimBorrowerPayments.js +69 -0
- package/dist/cjs/instructions/claimBorrowerPayments.js.map +1 -0
- package/dist/cjs/instructions/claimContractPayments.js +79 -0
- package/dist/cjs/instructions/claimContractPayments.js.map +1 -0
- package/dist/cjs/instructions/closeBorrower.js +60 -0
- package/dist/cjs/instructions/closeBorrower.js.map +1 -0
- package/dist/cjs/instructions/closeContract.js +120 -0
- package/dist/cjs/instructions/closeContract.js.map +1 -0
- package/dist/cjs/instructions/closeRental.js +105 -0
- package/dist/cjs/instructions/closeRental.js.map +1 -0
- package/dist/cjs/instructions/createConfig.js +74 -0
- package/dist/cjs/instructions/createConfig.js.map +1 -0
- package/dist/cjs/instructions/createContract.js +131 -0
- package/dist/cjs/instructions/createContract.js.map +1 -0
- package/dist/cjs/instructions/deleteBorrower.js +60 -0
- package/dist/cjs/instructions/deleteBorrower.js.map +1 -0
- package/dist/cjs/instructions/deleteConfig.js +79 -0
- package/dist/cjs/instructions/deleteConfig.js.map +1 -0
- package/dist/cjs/instructions/deleteRental.js +75 -0
- package/dist/cjs/instructions/deleteRental.js.map +1 -0
- package/dist/cjs/instructions/discountBorrower.js +75 -0
- package/dist/cjs/instructions/discountBorrower.js.map +1 -0
- package/dist/cjs/instructions/releaseRental.js +132 -0
- package/dist/cjs/instructions/releaseRental.js.map +1 -0
- package/dist/cjs/instructions/reserveRental.js +135 -0
- package/dist/cjs/instructions/reserveRental.js.map +1 -0
- package/dist/cjs/instructions/updateBorrower.js +89 -0
- package/dist/cjs/instructions/updateBorrower.js.map +1 -0
- package/dist/cjs/instructions/updateConfig.js +103 -0
- package/dist/cjs/instructions/updateConfig.js.map +1 -0
- package/dist/cjs/instructions/updateContract.js +107 -0
- package/dist/cjs/instructions/updateContract.js.map +1 -0
- package/dist/cjs/package.json +31 -33
- package/dist/cjs/params/amount.js +125 -0
- package/dist/cjs/params/amount.js.map +1 -0
- package/dist/cjs/params/duration.js +120 -0
- package/dist/cjs/params/duration.js.map +1 -0
- package/dist/cjs/params/schedule.js +164 -0
- package/dist/cjs/params/schedule.js.map +1 -0
- package/dist/cjs/pda/constants.js +73 -0
- package/dist/cjs/pda/constants.js.map +1 -0
- package/dist/cjs/pda/index.js +73 -0
- package/dist/cjs/pda/index.js.map +1 -0
- package/dist/cjs/pda/sage.js +175 -0
- package/dist/cjs/pda/sage.js.map +1 -0
- package/dist/cjs/pda/slyvault.js +56 -0
- package/dist/cjs/pda/slyvault.js.map +1 -0
- package/dist/cjs/pda/srsly.js +120 -0
- package/dist/cjs/pda/srsly.js.map +1 -0
- package/dist/cjs/pda/thread.js +64 -0
- package/dist/cjs/pda/thread.js.map +1 -0
- package/dist/cjs/pda/token.js +62 -0
- package/dist/cjs/pda/token.js.map +1 -0
- package/dist/cjs/utils/addresses.js +90 -0
- package/dist/cjs/utils/addresses.js.map +1 -0
- package/dist/cjs/utils/config.js +100 -187
- package/dist/cjs/utils/config.js.map +1 -1
- package/dist/cjs/utils/index.js +32 -28
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/instructions.js +79 -0
- package/dist/cjs/utils/instructions.js.map +1 -0
- package/dist/cjs/utils/signer.js +113 -94
- package/dist/cjs/utils/signer.js.map +1 -1
- package/dist/cjs/utils/web3js.js +76 -0
- package/dist/cjs/utils/web3js.js.map +1 -0
- package/dist/cjs/version.js +7 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/accounts/borrower.js +44 -0
- package/dist/esm/accounts/borrower.js.map +1 -0
- package/dist/esm/accounts/config.js +44 -0
- package/dist/esm/accounts/config.js.map +1 -0
- package/dist/esm/accounts/contract.js +44 -0
- package/dist/esm/accounts/contract.js.map +1 -0
- package/dist/esm/accounts/fleet.js +74 -0
- package/dist/esm/accounts/fleet.js.map +1 -0
- package/dist/esm/accounts/rental.js +44 -0
- package/dist/esm/accounts/rental.js.map +1 -0
- package/dist/esm/demos.js +123 -18
- package/dist/esm/demos.js.map +1 -1
- package/dist/esm/generated/codama/accounts/borrowerState.js +72 -0
- package/dist/esm/generated/codama/accounts/borrowerState.js.map +1 -0
- package/dist/esm/generated/codama/accounts/configState.js +38 -53
- package/dist/esm/generated/codama/accounts/configState.js.map +1 -1
- package/dist/esm/generated/codama/accounts/contractState.js +28 -52
- package/dist/esm/generated/codama/accounts/contractState.js.map +1 -1
- package/dist/esm/generated/codama/accounts/index.js +5 -2
- package/dist/esm/generated/codama/accounts/index.js.map +1 -1
- package/dist/esm/generated/codama/accounts/memberState.js +66 -0
- package/dist/esm/generated/codama/accounts/memberState.js.map +1 -0
- package/dist/esm/generated/codama/accounts/rentalState.js +23 -60
- package/dist/esm/generated/codama/accounts/rentalState.js.map +1 -1
- package/dist/esm/generated/codama/accounts/thread.js +47 -63
- package/dist/esm/generated/codama/accounts/thread.js.map +1 -1
- package/dist/esm/generated/codama/accounts/vaultState.js +70 -0
- package/dist/esm/generated/codama/accounts/vaultState.js.map +1 -0
- package/dist/esm/generated/codama/errors/index.js +2 -2
- package/dist/esm/generated/codama/errors/srsly.js +156 -18
- package/dist/esm/generated/codama/errors/srsly.js.map +1 -1
- package/dist/esm/generated/codama/index.js +2 -2
- package/dist/esm/generated/codama/instructions/acceptRental.js +107 -40
- package/dist/esm/generated/codama/instructions/acceptRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/cancelRental.js +54 -57
- package/dist/esm/generated/codama/instructions/cancelRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/captureRental.js +119 -0
- package/dist/esm/generated/codama/instructions/captureRental.js.map +1 -0
- package/dist/esm/generated/codama/instructions/claimBorrower.js +212 -0
- package/dist/esm/generated/codama/instructions/claimBorrower.js.map +1 -0
- package/dist/esm/generated/codama/instructions/claimContractPayments.js +220 -0
- package/dist/esm/generated/codama/instructions/claimContractPayments.js.map +1 -0
- package/dist/esm/generated/codama/instructions/closeBorrower.js +75 -0
- package/dist/esm/generated/codama/instructions/closeBorrower.js.map +1 -0
- package/dist/esm/generated/codama/instructions/closeContract.js +142 -33
- package/dist/esm/generated/codama/instructions/closeContract.js.map +1 -1
- package/dist/esm/generated/codama/instructions/closeRental.js +31 -28
- package/dist/esm/generated/codama/instructions/closeRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/createConfig.js +202 -0
- package/dist/esm/generated/codama/instructions/createConfig.js.map +1 -0
- package/dist/esm/generated/codama/instructions/createContract.js +48 -46
- package/dist/esm/generated/codama/instructions/createContract.js.map +1 -1
- package/dist/esm/generated/codama/instructions/deleteBorrower.js +116 -0
- package/dist/esm/generated/codama/instructions/deleteBorrower.js.map +1 -0
- package/dist/esm/generated/codama/instructions/deleteConfig.js +183 -0
- package/dist/esm/generated/codama/instructions/deleteConfig.js.map +1 -0
- package/dist/esm/generated/codama/instructions/deleteContract.js +105 -0
- package/dist/esm/generated/codama/instructions/deleteContract.js.map +1 -0
- package/dist/esm/generated/codama/instructions/deleteRental.js +105 -0
- package/dist/esm/generated/codama/instructions/deleteRental.js.map +1 -0
- package/dist/esm/generated/codama/instructions/discountBorrower.js +108 -0
- package/dist/esm/generated/codama/instructions/discountBorrower.js.map +1 -0
- package/dist/esm/generated/codama/instructions/index.js +15 -4
- package/dist/esm/generated/codama/instructions/index.js.map +1 -1
- package/dist/esm/generated/codama/instructions/payRental.js +95 -68
- package/dist/esm/generated/codama/instructions/payRental.js.map +1 -1
- package/dist/esm/generated/codama/instructions/{resetRental.js → releaseRental.js} +73 -32
- package/dist/esm/generated/codama/instructions/releaseRental.js.map +1 -0
- package/dist/esm/generated/codama/instructions/reserveRental.js +245 -0
- package/dist/esm/generated/codama/instructions/reserveRental.js.map +1 -0
- package/dist/esm/generated/codama/instructions/{initializeConfig.js → updateBorrower.js} +38 -45
- package/dist/esm/generated/codama/instructions/updateBorrower.js.map +1 -0
- package/dist/esm/generated/codama/instructions/updateConfig.js +42 -33
- package/dist/esm/generated/codama/instructions/updateConfig.js.map +1 -1
- package/dist/esm/generated/codama/instructions/updateContract.js +124 -0
- package/dist/esm/generated/codama/instructions/updateContract.js.map +1 -0
- package/dist/esm/generated/codama/programs/index.js +2 -2
- package/dist/esm/generated/codama/programs/srsly.js +74 -18
- package/dist/esm/generated/codama/programs/srsly.js.map +1 -1
- package/dist/esm/generated/codama/shared/index.js +2 -2
- package/dist/esm/generated/codama/shared/index.js.map +1 -1
- package/dist/esm/generated/codama/types/capturedFlagData.js +26 -0
- package/dist/esm/generated/codama/types/capturedFlagData.js.map +1 -0
- package/dist/esm/generated/codama/types/index.js +7 -9
- package/dist/esm/generated/codama/types/index.js.map +1 -1
- package/dist/esm/generated/codama/types/memberConfig.js +28 -0
- package/dist/esm/generated/codama/types/memberConfig.js.map +1 -0
- package/dist/esm/generated/codama/types/memberType.js +48 -0
- package/dist/esm/generated/codama/types/memberType.js.map +1 -0
- package/dist/esm/generated/codama/types/paymentFrequency.js +2 -2
- package/dist/esm/generated/codama/types/schedule.js +58 -0
- package/dist/esm/generated/codama/types/schedule.js.map +1 -0
- package/dist/esm/generated/codama/types/signal.js +41 -0
- package/dist/esm/generated/codama/types/signal.js.map +1 -0
- package/dist/esm/generated/codama/types/trigger.js +37 -24
- package/dist/esm/generated/codama/types/trigger.js.map +1 -1
- package/dist/esm/index.js +78 -208
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instructions/acceptRental.js +150 -0
- package/dist/esm/instructions/acceptRental.js.map +1 -0
- package/dist/esm/instructions/cancelRental.js +97 -0
- package/dist/esm/instructions/cancelRental.js.map +1 -0
- package/dist/esm/instructions/captureRental.js +82 -0
- package/dist/esm/instructions/captureRental.js.map +1 -0
- package/dist/esm/instructions/claimBorrower.js +63 -0
- package/dist/esm/instructions/claimBorrower.js.map +1 -0
- package/dist/esm/instructions/claimContractPayments.js +76 -0
- package/dist/esm/instructions/claimContractPayments.js.map +1 -0
- package/dist/esm/instructions/closeBorrower.js +57 -0
- package/dist/esm/instructions/closeBorrower.js.map +1 -0
- package/dist/esm/instructions/closeContract.js +117 -0
- package/dist/esm/instructions/closeContract.js.map +1 -0
- package/dist/esm/instructions/closeRental.js +102 -0
- package/dist/esm/instructions/closeRental.js.map +1 -0
- package/dist/esm/instructions/createConfig.js +71 -0
- package/dist/esm/instructions/createConfig.js.map +1 -0
- package/dist/esm/instructions/createContract.js +128 -0
- package/dist/esm/instructions/createContract.js.map +1 -0
- package/dist/esm/instructions/deleteBorrower.js +57 -0
- package/dist/esm/instructions/deleteBorrower.js.map +1 -0
- package/dist/esm/instructions/deleteConfig.js +76 -0
- package/dist/esm/instructions/deleteConfig.js.map +1 -0
- package/dist/esm/instructions/deleteRental.js +72 -0
- package/dist/esm/instructions/deleteRental.js.map +1 -0
- package/dist/esm/instructions/discountBorrower.js +72 -0
- package/dist/esm/instructions/discountBorrower.js.map +1 -0
- package/dist/esm/instructions/releaseRental.js +129 -0
- package/dist/esm/instructions/releaseRental.js.map +1 -0
- package/dist/esm/instructions/reserveRental.js +132 -0
- package/dist/esm/instructions/reserveRental.js.map +1 -0
- package/dist/esm/instructions/updateBorrower.js +86 -0
- package/dist/esm/instructions/updateBorrower.js.map +1 -0
- package/dist/esm/instructions/updateConfig.js +100 -0
- package/dist/esm/instructions/updateConfig.js.map +1 -0
- package/dist/esm/instructions/updateContract.js +104 -0
- package/dist/esm/instructions/updateContract.js.map +1 -0
- package/dist/esm/package.json +31 -33
- package/dist/esm/params/amount.js +119 -0
- package/dist/esm/params/amount.js.map +1 -0
- package/dist/esm/params/duration.js +115 -0
- package/dist/esm/params/duration.js.map +1 -0
- package/dist/esm/params/schedule.js +157 -0
- package/dist/esm/params/schedule.js.map +1 -0
- package/dist/esm/pda/constants.js +67 -0
- package/dist/esm/pda/constants.js.map +1 -0
- package/dist/esm/pda/index.js +42 -0
- package/dist/esm/pda/index.js.map +1 -0
- package/dist/esm/pda/sage.js +168 -0
- package/dist/esm/pda/sage.js.map +1 -0
- package/dist/esm/pda/slyvault.js +53 -0
- package/dist/esm/pda/slyvault.js.map +1 -0
- package/dist/esm/pda/srsly.js +113 -0
- package/dist/esm/pda/srsly.js.map +1 -0
- package/dist/esm/pda/thread.js +61 -0
- package/dist/esm/pda/thread.js.map +1 -0
- package/dist/esm/pda/token.js +59 -0
- package/dist/esm/pda/token.js.map +1 -0
- package/dist/esm/utils/addresses.js +85 -0
- package/dist/esm/utils/addresses.js.map +1 -0
- package/dist/esm/utils/config.js +95 -149
- package/dist/esm/utils/config.js.map +1 -1
- package/dist/esm/utils/index.js +12 -14
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/instructions.js +76 -0
- package/dist/esm/utils/instructions.js.map +1 -0
- package/dist/esm/utils/signer.js +109 -90
- package/dist/esm/utils/signer.js.map +1 -1
- package/dist/esm/utils/web3js.js +72 -0
- package/dist/esm/utils/web3js.js.map +1 -0
- package/dist/esm/version.js +4 -0
- package/dist/esm/version.js.map +1 -0
- package/dist/types/accounts/borrower.d.ts +34 -0
- package/dist/types/accounts/borrower.d.ts.map +1 -0
- package/dist/types/accounts/config.d.ts +31 -0
- package/dist/types/accounts/config.d.ts.map +1 -0
- package/dist/types/accounts/contract.d.ts +34 -0
- package/dist/types/accounts/contract.d.ts.map +1 -0
- package/dist/types/accounts/fleet.d.ts +49 -0
- package/dist/types/accounts/fleet.d.ts.map +1 -0
- package/dist/types/accounts/rental.d.ts +34 -0
- package/dist/types/accounts/rental.d.ts.map +1 -0
- package/dist/types/demos.d.ts +20 -52
- package/dist/types/demos.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/borrowerState.d.ts +94 -0
- package/dist/types/generated/codama/accounts/borrowerState.d.ts.map +1 -0
- package/dist/types/generated/codama/accounts/configState.d.ts +65 -22
- package/dist/types/generated/codama/accounts/configState.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/contractState.d.ts +62 -23
- package/dist/types/generated/codama/accounts/contractState.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/index.d.ts +5 -2
- package/dist/types/generated/codama/accounts/index.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/memberState.d.ts +58 -0
- package/dist/types/generated/codama/accounts/memberState.d.ts.map +1 -0
- package/dist/types/generated/codama/accounts/rentalState.d.ts +35 -39
- package/dist/types/generated/codama/accounts/rentalState.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/thread.d.ts +44 -51
- package/dist/types/generated/codama/accounts/thread.d.ts.map +1 -1
- package/dist/types/generated/codama/accounts/vaultState.d.ts +66 -0
- package/dist/types/generated/codama/accounts/vaultState.d.ts.map +1 -0
- package/dist/types/generated/codama/errors/index.d.ts +2 -2
- package/dist/types/generated/codama/errors/srsly.d.ts +111 -19
- package/dist/types/generated/codama/errors/srsly.d.ts.map +1 -1
- package/dist/types/generated/codama/index.d.ts +2 -2
- package/dist/types/generated/codama/instructions/acceptRental.d.ts +60 -45
- package/dist/types/generated/codama/instructions/acceptRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/cancelRental.d.ts +37 -32
- package/dist/types/generated/codama/instructions/cancelRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/captureRental.d.ts +59 -0
- package/dist/types/generated/codama/instructions/captureRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/claimBorrower.d.ts +90 -0
- package/dist/types/generated/codama/instructions/claimBorrower.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/claimBorrowerPayments.d.ts +75 -0
- package/dist/types/generated/codama/instructions/claimBorrowerPayments.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/claimContractPayments.d.ts +98 -0
- package/dist/types/generated/codama/instructions/claimContractPayments.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/closeBorrower.d.ts +43 -0
- package/dist/types/generated/codama/instructions/closeBorrower.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/closeContract.d.ts +44 -28
- package/dist/types/generated/codama/instructions/closeContract.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/closeRental.d.ts +38 -34
- package/dist/types/generated/codama/instructions/closeRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/createConfig.d.ts +79 -0
- package/dist/types/generated/codama/instructions/createConfig.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/createContract.d.ts +38 -30
- package/dist/types/generated/codama/instructions/createContract.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/deleteBorrower.d.ts +55 -0
- package/dist/types/generated/codama/instructions/deleteBorrower.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/deleteConfig.d.ts +75 -0
- package/dist/types/generated/codama/instructions/deleteConfig.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/deleteContract.d.ts +55 -0
- package/dist/types/generated/codama/instructions/deleteContract.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/deleteRental.d.ts +55 -0
- package/dist/types/generated/codama/instructions/deleteRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/discountBorrower.d.ts +56 -0
- package/dist/types/generated/codama/instructions/discountBorrower.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/index.d.ts +15 -4
- package/dist/types/generated/codama/instructions/index.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/payRental.d.ts +61 -46
- package/dist/types/generated/codama/instructions/payRental.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/releaseRental.d.ts +105 -0
- package/dist/types/generated/codama/instructions/releaseRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/reserveRental.d.ts +129 -0
- package/dist/types/generated/codama/instructions/reserveRental.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/updateBorrower.d.ts +62 -0
- package/dist/types/generated/codama/instructions/updateBorrower.d.ts.map +1 -0
- package/dist/types/generated/codama/instructions/updateConfig.d.ts +88 -28
- package/dist/types/generated/codama/instructions/updateConfig.d.ts.map +1 -1
- package/dist/types/generated/codama/instructions/updateContract.d.ts +88 -0
- package/dist/types/generated/codama/instructions/updateContract.d.ts.map +1 -0
- package/dist/types/generated/codama/programs/index.d.ts +2 -2
- package/dist/types/generated/codama/programs/srsly.d.ts +57 -21
- package/dist/types/generated/codama/programs/srsly.d.ts.map +1 -1
- package/dist/types/generated/codama/shared/index.d.ts +2 -13
- package/dist/types/generated/codama/shared/index.d.ts.map +1 -1
- package/dist/types/generated/codama/types/capturedFlagData.d.ts +35 -0
- package/dist/types/generated/codama/types/capturedFlagData.d.ts.map +1 -0
- package/dist/types/generated/codama/types/index.d.ts +7 -9
- package/dist/types/generated/codama/types/index.d.ts.map +1 -1
- package/dist/types/generated/codama/types/memberConfig.d.ts +33 -0
- package/dist/types/generated/codama/types/memberConfig.d.ts.map +1 -0
- package/dist/types/generated/codama/types/memberType.d.ts +48 -0
- package/dist/types/generated/codama/types/memberType.d.ts.map +1 -0
- package/dist/types/generated/codama/types/paymentFrequency.d.ts +2 -2
- package/dist/types/generated/codama/types/schedule.d.ts +46 -0
- package/dist/types/generated/codama/types/schedule.d.ts.map +1 -0
- package/dist/types/generated/codama/types/signal.d.ts +56 -0
- package/dist/types/generated/codama/types/signal.d.ts.map +1 -0
- package/dist/types/generated/codama/types/trigger.d.ts +45 -34
- package/dist/types/generated/codama/types/trigger.d.ts.map +1 -1
- package/dist/types/index.d.ts +37 -207
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/instructions/acceptRental.d.ts +99 -0
- package/dist/types/instructions/acceptRental.d.ts.map +1 -0
- package/dist/types/instructions/cancelRental.d.ts +90 -0
- package/dist/types/instructions/cancelRental.d.ts.map +1 -0
- package/dist/types/instructions/captureRental.d.ts +58 -0
- package/dist/types/instructions/captureRental.d.ts.map +1 -0
- package/dist/types/instructions/claimBorrower.d.ts +53 -0
- package/dist/types/instructions/claimBorrower.d.ts.map +1 -0
- package/dist/types/instructions/claimBorrowerPayments.d.ts +59 -0
- package/dist/types/instructions/claimBorrowerPayments.d.ts.map +1 -0
- package/dist/types/instructions/claimContractPayments.d.ts +78 -0
- package/dist/types/instructions/claimContractPayments.d.ts.map +1 -0
- package/dist/types/instructions/closeBorrower.d.ts +45 -0
- package/dist/types/instructions/closeBorrower.d.ts.map +1 -0
- package/dist/types/instructions/closeContract.d.ts +91 -0
- package/dist/types/instructions/closeContract.d.ts.map +1 -0
- package/dist/types/instructions/closeRental.d.ts +62 -0
- package/dist/types/instructions/closeRental.d.ts.map +1 -0
- package/dist/types/instructions/createConfig.d.ts +62 -0
- package/dist/types/instructions/createConfig.d.ts.map +1 -0
- package/dist/types/instructions/createContract.d.ts +127 -0
- package/dist/types/instructions/createContract.d.ts.map +1 -0
- package/dist/types/instructions/deleteBorrower.d.ts +53 -0
- package/dist/types/instructions/deleteBorrower.d.ts.map +1 -0
- package/dist/types/instructions/deleteConfig.d.ts +64 -0
- package/dist/types/instructions/deleteConfig.d.ts.map +1 -0
- package/dist/types/instructions/deleteRental.d.ts +67 -0
- package/dist/types/instructions/deleteRental.d.ts.map +1 -0
- package/dist/types/instructions/discountBorrower.d.ts +64 -0
- package/dist/types/instructions/discountBorrower.d.ts.map +1 -0
- package/dist/types/instructions/releaseRental.d.ts +104 -0
- package/dist/types/instructions/releaseRental.d.ts.map +1 -0
- package/dist/types/instructions/reserveRental.d.ts +80 -0
- package/dist/types/instructions/reserveRental.d.ts.map +1 -0
- package/dist/types/instructions/updateBorrower.d.ts +81 -0
- package/dist/types/instructions/updateBorrower.d.ts.map +1 -0
- package/dist/types/instructions/updateConfig.d.ts +142 -0
- package/dist/types/instructions/updateConfig.d.ts.map +1 -0
- package/dist/types/instructions/updateContract.d.ts +113 -0
- package/dist/types/instructions/updateContract.d.ts.map +1 -0
- package/dist/types/params/amount.d.ts +70 -0
- package/dist/types/params/amount.d.ts.map +1 -0
- package/dist/types/params/duration.d.ts +65 -0
- package/dist/types/params/duration.d.ts.map +1 -0
- package/dist/types/params/schedule.d.ts +74 -0
- package/dist/types/params/schedule.d.ts.map +1 -0
- package/dist/types/pda/constants.d.ts +51 -0
- package/dist/types/pda/constants.d.ts.map +1 -0
- package/dist/types/pda/index.d.ts +36 -0
- package/dist/types/pda/index.d.ts.map +1 -0
- package/dist/types/pda/sage.d.ts +69 -0
- package/dist/types/pda/sage.d.ts.map +1 -0
- package/dist/types/pda/slyvault.d.ts +29 -0
- package/dist/types/pda/slyvault.d.ts.map +1 -0
- package/dist/types/pda/srsly.d.ts +40 -0
- package/dist/types/pda/srsly.d.ts.map +1 -0
- package/dist/types/pda/thread.d.ts +31 -0
- package/dist/types/pda/thread.d.ts.map +1 -0
- package/dist/types/pda/token.d.ts +29 -0
- package/dist/types/pda/token.d.ts.map +1 -0
- package/dist/types/utils/addresses.d.ts +75 -0
- package/dist/types/utils/addresses.d.ts.map +1 -0
- package/dist/types/utils/config.d.ts +103 -83
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +7 -14
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/instructions.d.ts +52 -0
- package/dist/types/utils/instructions.d.ts.map +1 -0
- package/dist/types/utils/signer.d.ts +78 -39
- package/dist/types/utils/signer.d.ts.map +1 -1
- package/dist/types/utils/web3js.d.ts +85 -0
- package/dist/types/utils/web3js.d.ts.map +1 -0
- package/dist/types/version.d.ts +2 -0
- package/dist/types/version.d.ts.map +1 -0
- package/package.json +33 -48
- package/dist/cjs/config/index.js +0 -12
- package/dist/cjs/config/index.js.map +0 -1
- package/dist/cjs/config/initialize.js +0 -95
- package/dist/cjs/config/initialize.js.map +0 -1
- package/dist/cjs/config/update.js +0 -163
- package/dist/cjs/config/update.js.map +0 -1
- package/dist/cjs/contract/close.js +0 -159
- package/dist/cjs/contract/close.js.map +0 -1
- package/dist/cjs/contract/create.js +0 -259
- package/dist/cjs/contract/create.js.map +0 -1
- package/dist/cjs/contract/index.js +0 -68
- package/dist/cjs/contract/index.js.map +0 -1
- package/dist/cjs/generated/codama/instructions/initializeConfig.js.map +0 -1
- package/dist/cjs/generated/codama/instructions/resetRental.js.map +0 -1
- package/dist/cjs/generated/codama/types/clockData.js +0 -58
- package/dist/cjs/generated/codama/types/clockData.js.map +0 -1
- package/dist/cjs/generated/codama/types/equality.js +0 -30
- package/dist/cjs/generated/codama/types/equality.js.map +0 -1
- package/dist/cjs/generated/codama/types/execContext.js +0 -68
- package/dist/cjs/generated/codama/types/execContext.js.map +0 -1
- package/dist/cjs/generated/codama/types/serializableAccount.js +0 -58
- package/dist/cjs/generated/codama/types/serializableAccount.js.map +0 -1
- package/dist/cjs/generated/codama/types/serializableInstruction.js +0 -59
- package/dist/cjs/generated/codama/types/serializableInstruction.js.map +0 -1
- package/dist/cjs/generated/codama/types/threadResponse.js +0 -68
- package/dist/cjs/generated/codama/types/threadResponse.js.map +0 -1
- package/dist/cjs/generated/codama/types/triggerContext.js +0 -49
- package/dist/cjs/generated/codama/types/triggerContext.js.map +0 -1
- package/dist/cjs/idl/index.js +0 -27
- package/dist/cjs/idl/index.js.map +0 -1
- package/dist/cjs/idl/srsly-data.js +0 -3140
- package/dist/cjs/idl/srsly-data.js.map +0 -1
- package/dist/cjs/idl/srsly.json +0 -3104
- package/dist/cjs/rental/accept.js +0 -263
- package/dist/cjs/rental/accept.js.map +0 -1
- package/dist/cjs/rental/cancel.js +0 -184
- package/dist/cjs/rental/cancel.js.map +0 -1
- package/dist/cjs/rental/close.js +0 -184
- package/dist/cjs/rental/close.js.map +0 -1
- package/dist/cjs/rental/index.js +0 -105
- package/dist/cjs/rental/index.js.map +0 -1
- package/dist/cjs/rental/reset.js +0 -192
- package/dist/cjs/rental/reset.js.map +0 -1
- package/dist/cjs/types/payment-frequency.js +0 -87
- package/dist/cjs/types/payment-frequency.js.map +0 -1
- package/dist/cjs/types/srsly.js +0 -3
- package/dist/cjs/types/srsly.js.map +0 -1
- package/dist/cjs/utils/constants.js +0 -78
- package/dist/cjs/utils/constants.js.map +0 -1
- package/dist/cjs/utils/cron.js +0 -204
- package/dist/cjs/utils/cron.js.map +0 -1
- package/dist/cjs/utils/derive-pda.js +0 -415
- package/dist/cjs/utils/derive-pda.js.map +0 -1
- package/dist/cjs/utils/fetch-accounts.js +0 -241
- package/dist/cjs/utils/fetch-accounts.js.map +0 -1
- package/dist/cjs/utils/instruction-converter.js +0 -125
- package/dist/cjs/utils/instruction-converter.js.map +0 -1
- package/dist/cjs/utils/param-converters.js +0 -190
- package/dist/cjs/utils/param-converters.js.map +0 -1
- package/dist/cjs/utils/payment-frequency.js +0 -111
- package/dist/cjs/utils/payment-frequency.js.map +0 -1
- package/dist/cjs/utils/schedule-builder.js +0 -158
- package/dist/cjs/utils/schedule-builder.js.map +0 -1
- package/dist/cjs/utils/schedule-validation.js +0 -136
- package/dist/cjs/utils/schedule-validation.js.map +0 -1
- package/dist/cjs/utils/smart-params.js +0 -52
- package/dist/cjs/utils/smart-params.js.map +0 -1
- package/dist/esm/config/index.js +0 -7
- package/dist/esm/config/index.js.map +0 -1
- package/dist/esm/config/initialize.js +0 -92
- package/dist/esm/config/initialize.js.map +0 -1
- package/dist/esm/config/update.js +0 -159
- package/dist/esm/config/update.js.map +0 -1
- package/dist/esm/contract/close.js +0 -154
- package/dist/esm/contract/close.js.map +0 -1
- package/dist/esm/contract/create.js +0 -255
- package/dist/esm/contract/create.js.map +0 -1
- package/dist/esm/contract/index.js +0 -52
- package/dist/esm/contract/index.js.map +0 -1
- package/dist/esm/generated/codama/instructions/initializeConfig.js.map +0 -1
- package/dist/esm/generated/codama/instructions/resetRental.js.map +0 -1
- package/dist/esm/generated/codama/types/clockData.js +0 -53
- package/dist/esm/generated/codama/types/clockData.js.map +0 -1
- package/dist/esm/generated/codama/types/equality.js +0 -24
- package/dist/esm/generated/codama/types/equality.js.map +0 -1
- package/dist/esm/generated/codama/types/execContext.js +0 -63
- package/dist/esm/generated/codama/types/execContext.js.map +0 -1
- package/dist/esm/generated/codama/types/serializableAccount.js +0 -53
- package/dist/esm/generated/codama/types/serializableAccount.js.map +0 -1
- package/dist/esm/generated/codama/types/serializableInstruction.js +0 -54
- package/dist/esm/generated/codama/types/serializableInstruction.js.map +0 -1
- package/dist/esm/generated/codama/types/threadResponse.js +0 -63
- package/dist/esm/generated/codama/types/threadResponse.js.map +0 -1
- package/dist/esm/generated/codama/types/triggerContext.js +0 -42
- package/dist/esm/generated/codama/types/triggerContext.js.map +0 -1
- package/dist/esm/idl/index.js +0 -21
- package/dist/esm/idl/index.js.map +0 -1
- package/dist/esm/idl/srsly-data.js +0 -3137
- package/dist/esm/idl/srsly-data.js.map +0 -1
- package/dist/esm/idl/srsly.json +0 -3104
- package/dist/esm/rental/accept.js +0 -258
- package/dist/esm/rental/accept.js.map +0 -1
- package/dist/esm/rental/cancel.js +0 -179
- package/dist/esm/rental/cancel.js.map +0 -1
- package/dist/esm/rental/close.js +0 -179
- package/dist/esm/rental/close.js.map +0 -1
- package/dist/esm/rental/index.js +0 -89
- package/dist/esm/rental/index.js.map +0 -1
- package/dist/esm/rental/reset.js +0 -187
- package/dist/esm/rental/reset.js.map +0 -1
- package/dist/esm/types/payment-frequency.js +0 -83
- package/dist/esm/types/payment-frequency.js.map +0 -1
- package/dist/esm/types/srsly.js +0 -2
- package/dist/esm/types/srsly.js.map +0 -1
- package/dist/esm/utils/constants.js +0 -70
- package/dist/esm/utils/constants.js.map +0 -1
- package/dist/esm/utils/cron.js +0 -195
- package/dist/esm/utils/cron.js.map +0 -1
- package/dist/esm/utils/derive-pda.js +0 -402
- package/dist/esm/utils/derive-pda.js.map +0 -1
- package/dist/esm/utils/fetch-accounts.js +0 -233
- package/dist/esm/utils/fetch-accounts.js.map +0 -1
- package/dist/esm/utils/instruction-converter.js +0 -120
- package/dist/esm/utils/instruction-converter.js.map +0 -1
- package/dist/esm/utils/param-converters.js +0 -182
- package/dist/esm/utils/param-converters.js.map +0 -1
- package/dist/esm/utils/payment-frequency.js +0 -104
- package/dist/esm/utils/payment-frequency.js.map +0 -1
- package/dist/esm/utils/schedule-builder.js +0 -153
- package/dist/esm/utils/schedule-builder.js.map +0 -1
- package/dist/esm/utils/schedule-validation.js +0 -132
- package/dist/esm/utils/schedule-validation.js.map +0 -1
- package/dist/esm/utils/smart-params.js +0 -49
- package/dist/esm/utils/smart-params.js.map +0 -1
- package/dist/types/config/index.d.ts +0 -7
- package/dist/types/config/index.d.ts.map +0 -1
- package/dist/types/config/initialize.d.ts +0 -66
- package/dist/types/config/initialize.d.ts.map +0 -1
- package/dist/types/config/update.d.ts +0 -143
- package/dist/types/config/update.d.ts.map +0 -1
- package/dist/types/contract/close.d.ts +0 -124
- package/dist/types/contract/close.d.ts.map +0 -1
- package/dist/types/contract/create.d.ts +0 -150
- package/dist/types/contract/create.d.ts.map +0 -1
- package/dist/types/contract/index.d.ts +0 -52
- package/dist/types/contract/index.d.ts.map +0 -1
- package/dist/types/generated/codama/instructions/initializeConfig.d.ts +0 -60
- package/dist/types/generated/codama/instructions/initializeConfig.d.ts.map +0 -1
- package/dist/types/generated/codama/instructions/resetRental.d.ts +0 -79
- package/dist/types/generated/codama/instructions/resetRental.d.ts.map +0 -1
- package/dist/types/generated/codama/types/clockData.d.ts +0 -30
- package/dist/types/generated/codama/types/clockData.d.ts.map +0 -1
- package/dist/types/generated/codama/types/equality.d.ts +0 -18
- package/dist/types/generated/codama/types/equality.d.ts.map +0 -1
- package/dist/types/generated/codama/types/execContext.d.ts +0 -49
- package/dist/types/generated/codama/types/execContext.d.ts.map +0 -1
- package/dist/types/generated/codama/types/serializableAccount.d.ts +0 -23
- package/dist/types/generated/codama/types/serializableAccount.d.ts.map +0 -1
- package/dist/types/generated/codama/types/serializableInstruction.d.ts +0 -31
- package/dist/types/generated/codama/types/serializableInstruction.d.ts.map +0 -1
- package/dist/types/generated/codama/types/threadResponse.d.ts +0 -43
- package/dist/types/generated/codama/types/threadResponse.d.ts.map +0 -1
- package/dist/types/generated/codama/types/triggerContext.d.ts +0 -75
- package/dist/types/generated/codama/types/triggerContext.d.ts.map +0 -1
- package/dist/types/idl/index.d.ts +0 -21
- package/dist/types/idl/index.d.ts.map +0 -1
- package/dist/types/idl/srsly-data.d.ts +0 -1458
- package/dist/types/idl/srsly-data.d.ts.map +0 -1
- package/dist/types/rental/accept.d.ts +0 -196
- package/dist/types/rental/accept.d.ts.map +0 -1
- package/dist/types/rental/cancel.d.ts +0 -141
- package/dist/types/rental/cancel.d.ts.map +0 -1
- package/dist/types/rental/close.d.ts +0 -130
- package/dist/types/rental/close.d.ts.map +0 -1
- package/dist/types/rental/index.d.ts +0 -89
- package/dist/types/rental/index.d.ts.map +0 -1
- package/dist/types/rental/reset.d.ts +0 -166
- package/dist/types/rental/reset.d.ts.map +0 -1
- package/dist/types/types/payment-frequency.d.ts +0 -55
- package/dist/types/types/payment-frequency.d.ts.map +0 -1
- package/dist/types/types/srsly.d.ts +0 -3111
- package/dist/types/types/srsly.d.ts.map +0 -1
- package/dist/types/utils/constants.d.ts +0 -26
- package/dist/types/utils/constants.d.ts.map +0 -1
- package/dist/types/utils/cron.d.ts +0 -77
- package/dist/types/utils/cron.d.ts.map +0 -1
- package/dist/types/utils/derive-pda.d.ts +0 -213
- package/dist/types/utils/derive-pda.d.ts.map +0 -1
- package/dist/types/utils/fetch-accounts.d.ts +0 -158
- package/dist/types/utils/fetch-accounts.d.ts.map +0 -1
- package/dist/types/utils/instruction-converter.d.ts +0 -171
- package/dist/types/utils/instruction-converter.d.ts.map +0 -1
- package/dist/types/utils/param-converters.d.ts +0 -67
- package/dist/types/utils/param-converters.d.ts.map +0 -1
- package/dist/types/utils/payment-frequency.d.ts +0 -38
- package/dist/types/utils/payment-frequency.d.ts.map +0 -1
- package/dist/types/utils/schedule-builder.d.ts +0 -64
- package/dist/types/utils/schedule-builder.d.ts.map +0 -1
- package/dist/types/utils/schedule-validation.d.ts +0 -36
- package/dist/types/utils/schedule-validation.d.ts.map +0 -1
- package/dist/types/utils/smart-params.d.ts +0 -112
- package/dist/types/utils/smart-params.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,533 +1,197 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @wuwei-labs/srsly
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.typescriptlang.org/)
|
|
5
|
-
[](https://solana.com/)
|
|
3
|
+
> Simplified TypeScript SDK for SRSLY
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
**Status:** 🚧 Beta - Under active development
|
|
8
6
|
|
|
9
|
-
## What
|
|
7
|
+
## What is this?
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
This is a simplified TypeScript SDK for SRSLY. It's a thin convenience wrapper around Codama-generated TypeScript clients, focusing on simplicity and maintainability.
|
|
12
10
|
|
|
13
|
-
|
|
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.)
|
|
11
|
+
## Key Differences from `@wuwei-labs/srsly`
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
### Simpler (80% less code)
|
|
14
|
+
- **Old**: 4,000+ lines of custom abstractions
|
|
15
|
+
- **New**: ~800 lines of thin wrappers
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
### Clearer Purpose
|
|
18
|
+
- **Old**: Framework with fluent APIs, factories, builders
|
|
19
|
+
- **New**: Convenience wrapper around Codama
|
|
20
|
+
|
|
21
|
+
### Easier Configuration
|
|
22
|
+
- **Old**: Fluent selectors, chainable configs, network modules
|
|
23
|
+
- **New**: Simple global config + optional overrides
|
|
24
|
+
|
|
25
|
+
### Better Maintenance
|
|
26
|
+
- **Old**: Complex abstractions break when Codama updates
|
|
27
|
+
- **New**: Thin wrappers adapt easily to Codama changes
|
|
23
28
|
|
|
24
29
|
## Installation
|
|
25
30
|
|
|
26
31
|
```bash
|
|
27
|
-
|
|
28
|
-
npm install @wuwei-labs/srsly
|
|
32
|
+
pnpm add @wuwei-labs/srsly
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
The SDK uses @solana/kit internally and provides seamless conversion to @solana/web3.js format for browser wallet compatibility.
|
|
32
|
-
|
|
33
35
|
## Quick Start
|
|
34
36
|
|
|
35
|
-
###
|
|
37
|
+
### With @solana/kit (default)
|
|
36
38
|
|
|
37
39
|
```typescript
|
|
38
|
-
import {
|
|
40
|
+
import { setSdkConfig, createContract } from '@wuwei-labs/srsly';
|
|
39
41
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
rpcUrl: 'https://your-rpc-endpoint.com' // Required - no defaults provided
|
|
43
|
-
});
|
|
42
|
+
// Set global config once
|
|
43
|
+
setSdkConfig({ network: 'atlasnet' });
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// Create a contract - returns @solana/kit instruction
|
|
46
46
|
const instruction = await createContract({
|
|
47
|
-
owner:
|
|
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
|
-
});
|
|
54
|
-
|
|
55
|
-
// 3. Add instruction to your transaction and send
|
|
56
|
-
// (Use your preferred transaction building and sending method)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Using with @solana/web3.js (wallet-adapter)
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
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
|
|
70
|
-
});
|
|
71
|
-
|
|
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'
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// 3. Add to transaction and send
|
|
83
|
-
const transaction = new Transaction().add(web3jsInstruction);
|
|
84
|
-
const signature = await wallet.sendTransaction(transaction, connection);
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Core Features
|
|
88
|
-
|
|
89
|
-
### Universal Signer Pattern
|
|
90
|
-
|
|
91
|
-
The SDK supports both CLI/Node.js and browser usage patterns through its Universal Signer functionality:
|
|
92
|
-
|
|
93
|
-
**Browser Usage** (String Addresses):
|
|
94
|
-
|
|
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
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**CLI/Node.js Usage** (Signer Objects):
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
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
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Instruction Building & Format Conversion
|
|
116
|
-
|
|
117
|
-
The SDK creates @solana/kit compatible instructions with seamless web3.js conversion:
|
|
118
|
-
|
|
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
|
|
123
|
-
|
|
124
|
-
### Web3.js Format Conversion
|
|
125
|
-
|
|
126
|
-
The SDK accepts string addresses as input and provides seamless conversion to @solana/web3.js format for browser wallet compatibility:
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
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);
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**Key points:**
|
|
159
|
-
|
|
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.)
|
|
163
|
-
|
|
164
|
-
### Smart Parameters (v3)
|
|
165
|
-
|
|
166
|
-
The SDK v3 introduces smart parameters that make working with amounts and durations more intuitive:
|
|
167
|
-
|
|
168
|
-
#### Duration Parameters
|
|
169
|
-
```typescript
|
|
170
|
-
// Smart duration objects - no mental math needed!
|
|
171
|
-
const contract = await createContract({
|
|
172
|
-
owner: wallet,
|
|
47
|
+
owner: walletAddress, // string address
|
|
173
48
|
fleet: fleetAddress,
|
|
174
49
|
ownerProfile: profileAddress,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
durationMax: { weeks: 2 }, // 2 weeks maximum
|
|
178
|
-
paymentsFreq: 'daily'
|
|
179
|
-
});
|
|
180
|
-
|
|
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)
|
|
187
|
-
|
|
188
|
-
// Backwards compatible - raw seconds still work
|
|
189
|
-
duration: 604800 // 7 days in seconds
|
|
190
|
-
```
|
|
191
|
-
|
|
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)
|
|
50
|
+
gameId: gameAddress,
|
|
51
|
+
rate: 100, // 100 ATLAS per payment
|
|
197
52
|
durationMax: { days: 30 },
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
// Explicit formats for clarity
|
|
202
|
-
rate: { atlas: 10 } // 10 ATLAS per period
|
|
203
|
-
rate: { stardust: 1000000000 } // 10 ATLAS in stardust units
|
|
204
|
-
|
|
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
|
|
53
|
+
paymentsFreq: '@daily'
|
|
211
54
|
});
|
|
212
55
|
```
|
|
213
56
|
|
|
214
|
-
|
|
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:
|
|
216
|
-
|
|
217
|
-
```typescript
|
|
218
|
-
// v2 (old) - rate in stardust
|
|
219
|
-
rate: 1000000000 // 10 ATLAS in stardust
|
|
220
|
-
|
|
221
|
-
// v3 (new) - rate in ATLAS
|
|
222
|
-
rate: 10 // 10 ATLAS (much cleaner!)
|
|
223
|
-
|
|
224
|
-
// v3 with explicit unit
|
|
225
|
-
rate: { atlas: 10 }
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Contract Management
|
|
57
|
+
### With @solana/web3.js
|
|
229
58
|
|
|
230
59
|
```typescript
|
|
231
|
-
import {
|
|
60
|
+
import { PublicKey } from '@solana/web3.js';
|
|
61
|
+
import { setSdkConfig, createContract } from '@wuwei-labs/srsly';
|
|
232
62
|
|
|
233
|
-
//
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
ownerProfile: profileAddress,
|
|
238
|
-
rate: 5, // 5 ATLAS per day (v3 default)
|
|
239
|
-
durationMax: { months: 1 }, // 1 month maximum
|
|
240
|
-
paymentsFreq: 'daily'
|
|
63
|
+
// Set global config with PublicKey constructor
|
|
64
|
+
setSdkConfig({
|
|
65
|
+
network: 'mainnet-beta',
|
|
66
|
+
PublicKey // Enable web3.js mode
|
|
241
67
|
});
|
|
242
68
|
|
|
243
|
-
//
|
|
244
|
-
const
|
|
245
|
-
owner:
|
|
246
|
-
fleet:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
#### Important Contract Close Behavior
|
|
253
|
-
|
|
254
|
-
**Contract closure behavior depends on the rental state:**
|
|
255
|
-
|
|
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
|
|
261
|
-
|
|
262
|
-
```typescript
|
|
263
|
-
// Step 1: Close the expired rental
|
|
264
|
-
const closeRentalIx = await closeRental({
|
|
265
|
-
borrower: borrowerWallet,
|
|
266
|
-
contract: contractAddress,
|
|
267
|
-
rentalState: rentalStateAddress,
|
|
268
|
-
ownerTokenAccount: ownerTokenAccountAddress
|
|
69
|
+
// Create a contract - returns web3.js TransactionInstruction
|
|
70
|
+
const instruction = await createContract({
|
|
71
|
+
owner: keypair, // Accepts web3.js Keypair
|
|
72
|
+
fleet: fleetPubkey, // Accepts web3.js PublicKey
|
|
73
|
+
ownerProfile: profilePubkey,
|
|
74
|
+
gameId: gamePubkey,
|
|
75
|
+
rate: 100,
|
|
76
|
+
durationMax: { days: 30 },
|
|
77
|
+
paymentsFreq: '@daily'
|
|
269
78
|
});
|
|
270
79
|
|
|
271
|
-
//
|
|
272
|
-
const closeContractIx = await closeContract({
|
|
273
|
-
owner: wallet,
|
|
274
|
-
fleet: fleetAddress,
|
|
275
|
-
contract: contractAddress,
|
|
276
|
-
faction: 'mud'
|
|
277
|
-
});
|
|
80
|
+
// instruction.keys[0].pubkey is a PublicKey instance
|
|
278
81
|
```
|
|
279
82
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
- Processes periodic payments from escrow to owner
|
|
283
|
-
- Handles rental completion and cleanup when expired
|
|
284
|
-
- Closes flagged contracts after rental ends
|
|
285
|
-
|
|
286
|
-
Manual intervention is only needed when the automated system doesn't process successfully.
|
|
83
|
+
## Configuration
|
|
287
84
|
|
|
288
|
-
###
|
|
85
|
+
### Basic Configuration
|
|
289
86
|
|
|
290
87
|
```typescript
|
|
291
|
-
import {
|
|
292
|
-
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
293
|
-
|
|
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
|
-
});
|
|
303
|
-
|
|
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
|
-
});
|
|
311
|
-
|
|
312
|
-
// Close completed rental instruction
|
|
313
|
-
const closeIx = await closeRental({
|
|
314
|
-
borrower: borrowerWallet,
|
|
315
|
-
contract: contractAddress,
|
|
316
|
-
rentalState: rentalStateAddress,
|
|
317
|
-
ownerTokenAccount: ownerTokenAccountAddress
|
|
318
|
-
});
|
|
88
|
+
import { setSdkConfig, getSdkConfig, clearSdkConfig } from '@wuwei-labs/srsly';
|
|
319
89
|
|
|
320
|
-
//
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
90
|
+
// Set global config
|
|
91
|
+
setSdkConfig({
|
|
92
|
+
network: 'atlasnet' | 'mainnet-beta' | 'localnet',
|
|
93
|
+
rpcUrl: 'https://custom-rpc.com', // Optional
|
|
94
|
+
programId: 'custom-program-id', // Optional
|
|
95
|
+
commitment: 'confirmed', // Optional
|
|
96
|
+
PublicKey: PublicKey // Optional for web3.js mode
|
|
325
97
|
});
|
|
326
98
|
|
|
327
|
-
//
|
|
328
|
-
const
|
|
329
|
-
const web3jsCancelIx = await cancelRental(params).web3js(PublicKey);
|
|
330
|
-
|
|
331
|
-
// Use in web3.js transactions
|
|
332
|
-
const transaction = new Transaction()
|
|
333
|
-
.add(web3jsAcceptIx)
|
|
334
|
-
.add(web3jsCancelIx);
|
|
335
|
-
```
|
|
99
|
+
// Get current config
|
|
100
|
+
const config = getSdkConfig();
|
|
336
101
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
The SDK provides simple configuration:
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
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
|
-
});
|
|
102
|
+
// Clear config (reset to defaults)
|
|
103
|
+
clearSdkConfig();
|
|
352
104
|
|
|
353
|
-
//
|
|
354
|
-
|
|
355
|
-
rpcUrl: 'https://
|
|
356
|
-
});
|
|
357
|
-
setConfig({
|
|
358
|
-
rpcUrl: 'https://api.devnet.solana.com'
|
|
105
|
+
// Override per-call
|
|
106
|
+
const ix = await createContract(params, {
|
|
107
|
+
rpcUrl: 'https://temporary-rpc.com'
|
|
359
108
|
});
|
|
360
|
-
|
|
361
|
-
// Check current configuration
|
|
362
|
-
console.log(getConfig());
|
|
363
|
-
|
|
364
|
-
// Reset to defaults (you'll need to setConfig again with rpcUrl)
|
|
365
|
-
clearConfig();
|
|
366
109
|
```
|
|
367
110
|
|
|
368
|
-
###
|
|
369
|
-
|
|
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 |
|
|
377
|
-
|
|
378
|
-
## Duration and Payment Frequency
|
|
379
|
-
|
|
380
|
-
**Important**: All durations must be aligned with the payment frequency to ensure proper payment calculations.
|
|
111
|
+
### Network Addresses
|
|
381
112
|
|
|
382
|
-
|
|
383
|
-
|
|
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
|
|
387
|
-
|
|
388
|
-
### Payment Frequency Intervals
|
|
389
|
-
|
|
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) |
|
|
396
|
-
|
|
397
|
-
### Examples
|
|
113
|
+
The SDK provides centralized address management for different networks:
|
|
398
114
|
|
|
399
115
|
```typescript
|
|
400
|
-
|
|
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
|
-
});
|
|
406
|
-
|
|
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)
|
|
116
|
+
import { getAddresses, ATLASNET_ADDRESSES, MAINNET_ADDRESSES } from '@wuwei-labs/srsly';
|
|
414
117
|
|
|
415
|
-
//
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
});
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
### Rate Calculation
|
|
424
|
-
|
|
425
|
-
The `rate` parameter in contracts represents ATLAS tokens per payment period that the owner will receive:
|
|
118
|
+
// Get addresses for current network (from global config)
|
|
119
|
+
const addresses = getAddresses();
|
|
120
|
+
console.log(addresses.atlasMint); // ATLAS token mint
|
|
121
|
+
console.log(addresses.sage); // SAGE program
|
|
122
|
+
console.log(addresses.srsly); // SRSLY program
|
|
426
123
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
- For `hourly` frequency: rate is ATLAS per hour
|
|
124
|
+
// Override for specific network
|
|
125
|
+
const mainnetAddrs = getAddresses({ network: 'mainnet-beta' });
|
|
430
126
|
|
|
431
|
-
|
|
127
|
+
// Custom SRSLY program
|
|
128
|
+
const customAddrs = getAddresses({ programId: 'MyCustomSRSLY...' });
|
|
129
|
+
console.log(customAddrs.srsly); // 'MyCustomSRSLY...'
|
|
432
130
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
131
|
+
// Direct access to network addresses
|
|
132
|
+
console.log(ATLASNET_ADDRESSES); // All atlasnet addresses
|
|
133
|
+
console.log(MAINNET_ADDRESSES); // All mainnet addresses
|
|
134
|
+
```
|
|
436
135
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
5. **Refunds**: Pro-rata refunds for early cancellation (must cancel at least one payment period before rental ends)
|
|
136
|
+
**Available Networks:**
|
|
137
|
+
- `'atlasnet'` - Star Atlas testnet (default)
|
|
138
|
+
- `'mainnet-beta'` - Solana mainnet / Star Atlas production
|
|
139
|
+
- `'localnet'` - Local development
|
|
442
140
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
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
|
|
141
|
+
**Network Addresses:**
|
|
142
|
+
- `srsly` - SRSLY rental program
|
|
143
|
+
- `sage` - Star Atlas SAGE program
|
|
144
|
+
- `atlasMint` - ATLAS token mint
|
|
145
|
+
- `profileFaction` - Profile Faction program
|
|
146
|
+
- `gameId` - Star Atlas game ID
|
|
455
147
|
```
|
|
456
148
|
|
|
457
|
-
##
|
|
149
|
+
## API Reference
|
|
458
150
|
|
|
459
|
-
|
|
151
|
+
### Instructions
|
|
460
152
|
|
|
461
|
-
|
|
153
|
+
- `createContract(params, config?)` - Create a rental contract
|
|
154
|
+
- `closeContract(params, config?)` - Close a rental contract
|
|
155
|
+
- `acceptRental(params, config?)` - Accept a rental
|
|
156
|
+
- `cancelRental(params, config?)` - Cancel a rental
|
|
157
|
+
- _(More to come)_
|
|
462
158
|
|
|
463
|
-
|
|
159
|
+
### Parameters
|
|
464
160
|
|
|
465
|
-
|
|
161
|
+
All instruction params accept:
|
|
466
162
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
PaymentFrequency
|
|
473
|
-
} from '@wuwei-labs/srsly';
|
|
474
|
-
|
|
475
|
-
import {
|
|
476
|
-
ATLAS_TO_STARDUST,
|
|
477
|
-
FACTION_MAPPING
|
|
478
|
-
} from '@wuwei-labs/srsly';
|
|
479
|
-
|
|
480
|
-
// Conversion rate: 1 ATLAS = 100,000,000 stardust
|
|
481
|
-
console.log(ATLAS_TO_STARDUST); // 100_000_000
|
|
482
|
-
|
|
483
|
-
// Faction mappings
|
|
484
|
-
console.log(FACTION_MAPPING[1]); // 'mud'
|
|
485
|
-
console.log(FACTION_MAPPING[2]); // 'oni'
|
|
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
|
|
491
|
-
```
|
|
163
|
+
- **Signers**: String addresses, web3.js Keypairs, or @solana/kit signers
|
|
164
|
+
- **Addresses**: String addresses or web3.js PublicKeys
|
|
165
|
+
- **Rates**: Numbers (ATLAS) or objects `{ atlas: 1.5 }` or `{ stardust: 150_000_000 }`
|
|
166
|
+
- **Durations**: Objects `{ days: 7 }`, `{ hours: 24 }`, `{ weeks: 2 }`, etc.
|
|
167
|
+
- **Schedules**: Strings `'@daily'`, `'@hourly'`, or cron expressions
|
|
492
168
|
|
|
493
|
-
|
|
169
|
+
### Return Types
|
|
494
170
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
import idl from '@wuwei-labs/srsly/idl';
|
|
498
|
-
```
|
|
171
|
+
- **Without PublicKey in config**: Returns @solana/kit instruction
|
|
172
|
+
- **With PublicKey in config**: Returns web3.js TransactionInstruction
|
|
499
173
|
|
|
500
|
-
##
|
|
174
|
+
## Development Status
|
|
501
175
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
```
|
|
176
|
+
- ✅ Core config system
|
|
177
|
+
- ✅ Centralized address management
|
|
178
|
+
- ✅ Signer handling (web3.js + kit)
|
|
179
|
+
- ✅ web3.js conversion
|
|
180
|
+
- ✅ Parameter converters (amount, duration, schedule)
|
|
181
|
+
- ✅ First instruction: `createContract`
|
|
182
|
+
- 🚧 Additional contract instructions
|
|
183
|
+
- 🚧 Rental instructions
|
|
184
|
+
- 🚧 Other instructions
|
|
185
|
+
- 🚧 Tests
|
|
186
|
+
|
|
187
|
+
## Migration from `@wuwei-labs/srsly`
|
|
516
188
|
|
|
517
|
-
|
|
189
|
+
Coming soon - see migration guide once this package reaches 1.0.0.
|
|
518
190
|
|
|
519
|
-
|
|
191
|
+
## Contributing
|
|
520
192
|
|
|
521
|
-
|
|
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)
|
|
193
|
+
This package is currently in beta. Please report issues on GitHub.
|
|
527
194
|
|
|
528
|
-
##
|
|
195
|
+
## License
|
|
529
196
|
|
|
530
|
-
|
|
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)
|
|
197
|
+
ISC
|