@wuwei-labs/srsly 2.0.0-beta.43 → 2.0.0-beta.45
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 +27 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/rental/accept.js +28 -33
- package/dist/cjs/rental/accept.js.map +1 -1
- package/dist/cjs/rental/cancel.js +5 -2
- package/dist/cjs/rental/cancel.js.map +1 -1
- package/dist/cjs/utils/config.js +13 -33
- package/dist/cjs/utils/config.js.map +1 -1
- package/dist/cjs/utils/fetch-accounts.js +30 -48
- package/dist/cjs/utils/fetch-accounts.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/instruction-converter.js +5 -21
- package/dist/cjs/utils/instruction-converter.js.map +1 -1
- package/dist/cjs/utils/signer.js +61 -0
- package/dist/cjs/utils/signer.js.map +1 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/rental/accept.js +28 -33
- package/dist/esm/rental/accept.js.map +1 -1
- package/dist/esm/rental/cancel.js +5 -2
- package/dist/esm/rental/cancel.js.map +1 -1
- package/dist/esm/utils/config.js +13 -33
- package/dist/esm/utils/config.js.map +1 -1
- package/dist/esm/utils/fetch-accounts.js +30 -48
- package/dist/esm/utils/fetch-accounts.js.map +1 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/instruction-converter.js +5 -21
- package/dist/esm/utils/instruction-converter.js.map +1 -1
- package/dist/esm/utils/signer.js +56 -0
- package/dist/esm/utils/signer.js.map +1 -0
- package/dist/types/rental/accept.d.ts +23 -13
- package/dist/types/rental/accept.d.ts.map +1 -1
- package/dist/types/rental/cancel.d.ts +3 -2
- package/dist/types/rental/cancel.d.ts.map +1 -1
- package/dist/types/utils/config.d.ts +4 -6
- package/dist/types/utils/config.d.ts.map +1 -1
- package/dist/types/utils/fetch-accounts.d.ts +35 -6
- package/dist/types/utils/fetch-accounts.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/instruction-converter.d.ts +6 -12
- package/dist/types/utils/instruction-converter.d.ts.map +1 -1
- package/dist/types/utils/signer.d.ts +56 -0
- package/dist/types/utils/signer.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@ import { getModule, createConfigSelector, resolveProgramAddresses, getConfig } f
|
|
|
2
2
|
import { ATLAS_TO_STARDUST, toAddress } from '../utils/constants';
|
|
3
3
|
import { deriveGameAccounts } from '../utils';
|
|
4
4
|
import { createFluentInstruction, createSmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
5
|
-
import {
|
|
6
|
-
import { createSolanaRpc } from '@solana/kit';
|
|
5
|
+
import { fetchContractState } from '../utils/fetch-accounts';
|
|
7
6
|
import { paymentFrequencyStringToSeconds } from '../utils/paymentFrequency';
|
|
8
7
|
import { deriveRentalThread, deriveRentalState, deriveRentalAuthority } from '../utils/pda';
|
|
8
|
+
import { createTransactionSigner } from '../utils/signer';
|
|
9
9
|
/**
|
|
10
10
|
* Internal function to accept a rental instruction with configuration options.
|
|
11
11
|
*
|
|
@@ -21,7 +21,7 @@ import { deriveRentalThread, deriveRentalState, deriveRentalAuthority } from '..
|
|
|
21
21
|
* @throws Error when contract is not found, duration constraints are violated, or account derivation fails
|
|
22
22
|
*/
|
|
23
23
|
async function _acceptRental(params, config) {
|
|
24
|
-
const {
|
|
24
|
+
const { borrowerProfile, borrowerFaction, contract, duration, } = params;
|
|
25
25
|
// Get the resolved addresses from config (including network-specific addresses)
|
|
26
26
|
// Use global config as fallback, same pattern as constants.ts
|
|
27
27
|
const globalConfig = getConfig();
|
|
@@ -30,23 +30,7 @@ async function _acceptRental(params, config) {
|
|
|
30
30
|
// Fetch contract state to get payment frequency and validate parameters
|
|
31
31
|
let contractState;
|
|
32
32
|
try {
|
|
33
|
-
|
|
34
|
-
let rpcClient;
|
|
35
|
-
if (effectiveConfig.connection) {
|
|
36
|
-
// Use provided Connection (bypasses @solana/kit completely)
|
|
37
|
-
rpcClient = effectiveConfig.connection;
|
|
38
|
-
}
|
|
39
|
-
else if (resolvedAddresses.rpcUrl) {
|
|
40
|
-
// Fall back to @solana/kit RPC creation
|
|
41
|
-
rpcClient = createSolanaRpc(resolvedAddresses.rpcUrl);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
throw new Error('No RPC client available. Provide either a connection or rpcUrl.');
|
|
45
|
-
}
|
|
46
|
-
contractState = await fetchMaybeContractState(rpcClient, toAddress(contract));
|
|
47
|
-
if (!contractState.exists) {
|
|
48
|
-
throw new Error(`Contract not found: ${contract}`);
|
|
49
|
-
}
|
|
33
|
+
contractState = await fetchContractState(contract);
|
|
50
34
|
}
|
|
51
35
|
catch (error) {
|
|
52
36
|
throw new Error(`Failed to fetch contract state: ${error}`);
|
|
@@ -70,15 +54,17 @@ async function _acceptRental(params, config) {
|
|
|
70
54
|
// Manually derive ALL game accounts - they all use different program addresses than main SAGE program
|
|
71
55
|
const { profileFaction, starbase, starbasePlayer } = await deriveGameAccounts(toAddress(borrowerProfile), borrowerFaction, resolvedAddresses.gameId, 0, // starbaseSeqId
|
|
72
56
|
config);
|
|
57
|
+
// Handle borrower using smart signer handler for universal compatibility
|
|
58
|
+
const borrower = createTransactionSigner(params.borrower);
|
|
73
59
|
// Manually derive PDAs with correct program IDs
|
|
74
|
-
const rentalStatePda = await deriveRentalState(toAddress(contract), borrower.address, //
|
|
60
|
+
const rentalStatePda = await deriveRentalState(toAddress(contract), borrower.address, // Use TransactionSigner.address for PDA derivation
|
|
75
61
|
resolvedAddresses.srslyProgramAddress);
|
|
76
62
|
const rentalAuthorityPda = await deriveRentalAuthority(resolvedAddresses.srslyProgramAddress);
|
|
77
63
|
// 🔧 FIX: Derive rental thread PDA using Antegen program ID
|
|
78
64
|
const rentalThreadPda = await deriveRentalThread(rentalAuthorityPda, rentalStatePda, resolvedAddresses.antegenProgramAddress);
|
|
79
65
|
// Create input with ALL manually derived game accounts - they use different program addresses
|
|
80
66
|
const input = {
|
|
81
|
-
borrower: borrower, //
|
|
67
|
+
borrower: borrower, // TransactionSigner for Codama
|
|
82
68
|
borrowerProfile: toAddress(borrowerProfile), // Ensure string
|
|
83
69
|
borrowerProfileFaction: toAddress(profileFaction), // Manually derived (Profile program)
|
|
84
70
|
fleet: toAddress(fleet), // Ensure string
|
|
@@ -151,27 +137,36 @@ async function _acceptRental(params, config) {
|
|
|
151
137
|
* ```typescript
|
|
152
138
|
* import { acceptRental, days } from '@srsly/sdk';
|
|
153
139
|
*
|
|
154
|
-
* //
|
|
140
|
+
* // CLI usage with wallet/signer object
|
|
155
141
|
* const instruction = await acceptRental({
|
|
156
|
-
* borrower: wallet,
|
|
157
|
-
* borrowerProfile: "ProfileAddr...",
|
|
158
|
-
* borrowerFaction: 'mud',
|
|
159
|
-
* contract: "ContractAddr...",
|
|
160
|
-
* duration: days(7)
|
|
142
|
+
* borrower: wallet, // Wallet object for signing
|
|
143
|
+
* borrowerProfile: "ProfileAddr...", // Borrower's Star Atlas profile
|
|
144
|
+
* borrowerFaction: 'mud', // Faction: 'mud', 'oni', or 'ustur'
|
|
145
|
+
* contract: "ContractAddr...", // Contract to accept
|
|
146
|
+
* duration: days(7) // 7 days rental duration
|
|
161
147
|
* });
|
|
162
148
|
*
|
|
163
|
-
* //
|
|
149
|
+
* // Browser usage with address string
|
|
150
|
+
* const browserInstruction = await acceptRental({
|
|
151
|
+
* borrower: wallet.publicKey.toString(), // Address string for browser
|
|
152
|
+
* borrowerProfile: "ProfileAddr...", // Borrower's Star Atlas profile
|
|
153
|
+
* borrowerFaction: 'mud', // Faction: 'mud', 'oni', or 'ustur'
|
|
154
|
+
* contract: "ContractAddr...", // Contract to accept
|
|
155
|
+
* duration: days(7) // 7 days rental duration
|
|
156
|
+
* });
|
|
157
|
+
*
|
|
158
|
+
* // Configure for mainnet (both patterns work)
|
|
164
159
|
* const mainnetInstruction = await acceptRental({
|
|
165
|
-
* borrower: wallet,
|
|
160
|
+
* borrower: wallet, // Wallet object (CLI style)
|
|
166
161
|
* borrowerProfile: "ProfileAddr...",
|
|
167
|
-
* borrowerFaction: 1,
|
|
162
|
+
* borrowerFaction: 1, // Can use numbers: 1=mud, 2=oni, 3=ustur
|
|
168
163
|
* contract: "ContractAddr...",
|
|
169
164
|
* duration: days(7)
|
|
170
165
|
* }).set({ programs: 'mainnet' });
|
|
171
166
|
*
|
|
172
167
|
* // Override specific game configuration
|
|
173
168
|
* const customInstruction = await acceptRental({
|
|
174
|
-
* borrower:
|
|
169
|
+
* borrower: "BorrowerAddress123...", // Address string (browser style)
|
|
175
170
|
* borrowerProfile: "ProfileAddr...",
|
|
176
171
|
* borrowerFaction: 'mud',
|
|
177
172
|
* contract: "ContractAddr...",
|
|
@@ -183,7 +178,7 @@ async function _acceptRental(params, config) {
|
|
|
183
178
|
*
|
|
184
179
|
* // Convert to @solana/web3.js format
|
|
185
180
|
* const web3jsInstruction = await acceptRental({
|
|
186
|
-
* borrower: wallet,
|
|
181
|
+
* borrower: wallet, // Universal: works with both patterns
|
|
187
182
|
* borrowerProfile: "ProfileAddr...",
|
|
188
183
|
* borrowerFaction: 'mud',
|
|
189
184
|
* contract: "ContractAddr...",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../../src/rental/accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,SAAS,EAA2C,MAAM,iBAAiB,CAAC;AAC/I,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,+BAA+B,EAA0D,MAAM,gCAAgC,CAAC;AAClK,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"acc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,CAAC;IAE/D,MAAM,cAAc,GAAG,MAAM,+BAA+B,CAC1D,KAAY,EACZ,EAAE,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,EAAE,CAC1D,CAAC;IACF,OAAO,uBAAuB,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrF,OAAO,+BAA+B,CAAC,YAAY,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAU,EAAE,OAAa;IACvE,OAAO,oBAAoB,CAAC,KAAK,IAAI,EAAE;QACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,+BAA+B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getModule, createConfigSelector } from '../utils/config';
|
|
2
2
|
import { toAddress } from '../utils/constants';
|
|
3
|
+
import { createTransactionSigner } from '../utils/signer';
|
|
3
4
|
/**
|
|
4
5
|
* Internal function to cancel a rental instruction with configuration options.
|
|
5
6
|
*
|
|
@@ -14,13 +15,15 @@ import { toAddress } from '../utils/constants';
|
|
|
14
15
|
* @throws Error when instruction generation fails or required parameters are missing
|
|
15
16
|
*/
|
|
16
17
|
async function _cancelRental(params, config) {
|
|
17
|
-
const {
|
|
18
|
+
const { contract, } = params;
|
|
19
|
+
// Handle borrower using smart signer handler for universal compatibility
|
|
20
|
+
const borrower = createTransactionSigner(params.borrower);
|
|
18
21
|
// Get the resolved addresses from config (including network-specific addresses)
|
|
19
22
|
// Note: resolvedAddresses not currently needed for this instruction but kept for consistency
|
|
20
23
|
// const resolvedAddresses = resolveProgramAddresses(config || {});
|
|
21
24
|
// Let codama derive all the optional accounts
|
|
22
25
|
const input = {
|
|
23
|
-
borrower, //
|
|
26
|
+
borrower: borrower, // TransactionSigner for Codama
|
|
24
27
|
contract: toAddress(contract), // Ensure string
|
|
25
28
|
};
|
|
26
29
|
// Get network-specific codama functions from centralized config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAoE,MAAM,iBAAiB,CAAC;AACpI,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAoE,MAAM,iBAAiB,CAAC;AACpI,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAwB,MAAM,iBAAiB,CAAC;AA+BhF;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,aAAa,CAC1B,MAA0B,EAC1B,MAAsB;IAEtB,MAAM,EACJ,QAAQ,GACT,GAAG,MAAM,CAAC;IAEX,yEAAyE;IACzE,MAAM,QAAQ,GAAG,uBAAuB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE1D,gFAAgF;IAChF,6FAA6F;IAC7F,mEAAmE;IAEnE,8CAA8C;IAC9C,MAAM,KAAK,GAAG;QACZ,QAAQ,EAAE,QAAQ,EAAE,+BAA+B;QACnD,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB;KAChD,CAAC;IAEF,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,+BAA+B,EAAE,GAAG,kBAAkB,CAAC;IAC/D,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,OAAO,+BAA+B,CACpC,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA0B;IAE1B,OAAO,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAU,EAAE,OAAa;IACvE,OAAO,oBAAoB,CAAC,KAAK,IAAI,EAAE;QACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,+BAA+B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/esm/utils/config.js
CHANGED
|
@@ -44,35 +44,16 @@ export async function resolveProgramAddresses(config) {
|
|
|
44
44
|
if (!programConfig) {
|
|
45
45
|
throw new Error(`Unknown program set: ${programSet}. Available: ${Object.keys(PROGRAM_SETS).join(', ')}`);
|
|
46
46
|
}
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
throw new Error(`PublicKey required for web3js mode. Please provide: ` +
|
|
53
|
-
`setConfig({ library: 'web3js', PublicKey, connection })`);
|
|
54
|
-
}
|
|
55
|
-
if (!config.connection) {
|
|
56
|
-
throw new Error(`connection required for web3js mode. Please provide: ` +
|
|
57
|
-
`setConfig({ library: 'web3js', PublicKey, connection })`);
|
|
58
|
-
}
|
|
59
|
-
// rpcUrl is ignored in web3js mode
|
|
47
|
+
// RPC URL validation
|
|
48
|
+
const rpcUrl = config.rpcUrl;
|
|
49
|
+
if (!rpcUrl) {
|
|
50
|
+
throw new Error(`rpcUrl is required. Please provide: ` +
|
|
51
|
+
`setConfig({ rpcUrl: "https://your-rpc-url" })`);
|
|
60
52
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`setConfig({ library: 'kit', rpcUrl: "https://your-rpc-url" })`);
|
|
66
|
-
}
|
|
67
|
-
// PublicKey and connection are ignored in kit mode
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
// No library specified - fallback to current behavior
|
|
71
|
-
if (!config.connection && !rpcUrl) {
|
|
72
|
-
throw new Error(`Either 'connection' (web3js) or 'rpcUrl' (kit) must be provided. ` +
|
|
73
|
-
`Use: setConfig({ library: 'web3js', PublicKey, connection }) ` +
|
|
74
|
-
`or: setConfig({ library: 'kit', rpcUrl: "https://..." })`);
|
|
75
|
-
}
|
|
53
|
+
// PublicKey validation for web3js mode
|
|
54
|
+
if (config.library === 'web3js' && !config.PublicKey) {
|
|
55
|
+
throw new Error(`PublicKey required for web3js mode. Please provide: ` +
|
|
56
|
+
`setConfig({ library: 'web3js', PublicKey })`);
|
|
76
57
|
}
|
|
77
58
|
const srslyAddress = config.srslyProgramAddress || 'SRSLY1fq9TJqCk1gNSE7VZL2bztvTn9wm4VR8u8jMKT';
|
|
78
59
|
const sageAddress = programConfig.SAGE_PROGRAM_ADDRESS;
|
|
@@ -87,7 +68,7 @@ export async function resolveProgramAddresses(config) {
|
|
|
87
68
|
antegenProgramAddress: toAddress(antegenAddress),
|
|
88
69
|
gameId: toAddress(gameIdAddress),
|
|
89
70
|
atlasMint: toAddress(atlasMintAddress),
|
|
90
|
-
rpcUrl:
|
|
71
|
+
rpcUrl: rpcUrl, // Always return rpcUrl
|
|
91
72
|
};
|
|
92
73
|
}
|
|
93
74
|
/**
|
|
@@ -108,13 +89,12 @@ export async function resolveProgramAddresses(config) {
|
|
|
108
89
|
* gameId: 'custom-game-id...'
|
|
109
90
|
* });
|
|
110
91
|
*
|
|
111
|
-
* // Configure for web3js
|
|
112
|
-
* import {
|
|
113
|
-
* const connection = new Connection('https://api.mainnet-beta.solana.com');
|
|
92
|
+
* // Configure for web3js
|
|
93
|
+
* import { PublicKey } from '@solana/web3.js';
|
|
114
94
|
* setConfig({
|
|
115
95
|
* library: 'web3js',
|
|
116
96
|
* PublicKey,
|
|
117
|
-
*
|
|
97
|
+
* rpcUrl: 'https://api.mainnet-beta.solana.com'
|
|
118
98
|
* });
|
|
119
99
|
*
|
|
120
100
|
* // Can still override per instruction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/utils/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,0CAA0C;AAC1C,OAAO,KAAK,YAAY,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE;QACP,oBAAoB,EAAE,6CAA6C;QACnE,+BAA+B,EAAE,6CAA6C;QAC9E,YAAY,EAAE,8CAA8C;QAC5D,UAAU,EAAE,8CAA8C;KAC3D;IACD,QAAQ,EAAE;QACR,oBAAoB,EAAE,6CAA6C;QACnE,+BAA+B,EAAE,6CAA6C;QAC9E,YAAY,EAAE,8CAA8C;QAC5D,UAAU,EAAE,8CAA8C;KAC3D;IACD,OAAO,EAAE;QACP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GAAG;QACf,GAAG,EAAE,CAAC,iBAAgC,EAAE,EAAE,CACxC,6BAA6B,CAAC,SAAS,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,iBAAiB,EAAE,CAAC;QACvF,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC;QACtC,iDAAiD;QACjD,IAAI,CACF,WAAqE,EACrE,UAAuE;YAEvE,OAAO,SAAS,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACjE,CAAC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAiD;IAEjD,MAAM,QAAQ,GAAG;QACf,GAAG,EAAE,CAAC,OAAsB,EAAE,EAAE,CAAC,6BAA6B,CAAC,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACtG,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC5C,iDAAiD;QACjD,IAAI,CACF,WAAqE,EACrE,UAAuE;YAEvE,OAAO,SAAS,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACvE,CAAC;KACF,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,56 +1,38 @@
|
|
|
1
1
|
import { createSolanaRpc } from '@solana/kit';
|
|
2
2
|
import { fetchContractState as fetchContractStateCodama, fetchRentalState as fetchRentalStateCodama, fetchAllContractState, fetchAllRentalState } from '../codama/accounts';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* 'ContractAddress123...'
|
|
19
|
-
* );
|
|
20
|
-
*
|
|
21
|
-
* console.log('Contract owner:', contractState.data.owner);
|
|
22
|
-
* console.log('Contract rate:', contractState.data.rate);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export async function fetchContractState(rpcUrl, contractAddress) {
|
|
26
|
-
// Create RPC connection
|
|
3
|
+
import { getConfig, resolveProgramAddresses } from './config';
|
|
4
|
+
import { toAddress } from './constants';
|
|
5
|
+
// Implementation
|
|
6
|
+
export async function fetchContractState(rpcUrlOrAddress, contractAddress) {
|
|
7
|
+
// If only one argument, it's the contract address using default RPC
|
|
8
|
+
if (contractAddress === undefined) {
|
|
9
|
+
const address = toAddress(rpcUrlOrAddress);
|
|
10
|
+
const config = getConfig();
|
|
11
|
+
const resolved = await resolveProgramAddresses(config);
|
|
12
|
+
const rpc = createSolanaRpc(resolved.rpcUrl);
|
|
13
|
+
return fetchContractStateCodama(rpc, address);
|
|
14
|
+
}
|
|
15
|
+
// If two arguments, first is rpcUrl, second is address
|
|
16
|
+
const rpcUrl = rpcUrlOrAddress;
|
|
17
|
+
const address = toAddress(contractAddress);
|
|
27
18
|
const rpc = createSolanaRpc(rpcUrl);
|
|
28
|
-
|
|
29
|
-
return fetchContractStateCodama(rpc, contractAddress);
|
|
19
|
+
return fetchContractStateCodama(rpc, address);
|
|
30
20
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
* console.log('Rental borrower:', rentalState.data.borrower);
|
|
46
|
-
* console.log('Rental start:', rentalState.data.start);
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export async function fetchRentalState(rpcUrl, rentalAddress) {
|
|
50
|
-
// Create RPC connection
|
|
21
|
+
// Implementation
|
|
22
|
+
export async function fetchRentalState(rpcUrlOrAddress, rentalAddress) {
|
|
23
|
+
// If only one argument, it's the rental address using default RPC
|
|
24
|
+
if (rentalAddress === undefined) {
|
|
25
|
+
const address = toAddress(rpcUrlOrAddress);
|
|
26
|
+
const config = getConfig();
|
|
27
|
+
const resolved = await resolveProgramAddresses(config);
|
|
28
|
+
const rpc = createSolanaRpc(resolved.rpcUrl);
|
|
29
|
+
return fetchRentalStateCodama(rpc, address);
|
|
30
|
+
}
|
|
31
|
+
// If two arguments, first is rpcUrl, second is address
|
|
32
|
+
const rpcUrl = rpcUrlOrAddress;
|
|
33
|
+
const address = toAddress(rentalAddress);
|
|
51
34
|
const rpc = createSolanaRpc(rpcUrl);
|
|
52
|
-
|
|
53
|
-
return fetchRentalStateCodama(rpc, rentalAddress);
|
|
35
|
+
return fetchRentalStateCodama(rpc, address);
|
|
54
36
|
}
|
|
55
37
|
/**
|
|
56
38
|
* Fetches multiple contract states in a single RPC call
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-accounts.js","sourceRoot":"","sources":["../../../src/utils/fetch-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAgB,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,kBAAkB,IAAI,wBAAwB,EAC9C,gBAAgB,IAAI,sBAAsB,EAC1C,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-accounts.js","sourceRoot":"","sources":["../../../src/utils/fetch-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAgB,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,kBAAkB,IAAI,wBAAwB,EAC9C,gBAAgB,IAAI,sBAAsB,EAC1C,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,SAAS,EAA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C;IACzC,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,MAAc,EACd,iBAAsC;IAEtC,wBAAwB;IACxB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEpC,uCAAuC;IACvC,OAAO,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,MAAc,EACd,eAAoC;IAEpC,wBAAwB;IACxB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEpC,qCAAqC;IACrC,OAAO,mBAAmB,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
|
|
@@ -11,7 +11,7 @@ export function createFluentInstruction(kitInstruction) {
|
|
|
11
11
|
function kit() {
|
|
12
12
|
return kitInstruction;
|
|
13
13
|
}
|
|
14
|
-
function web3js(PublicKey
|
|
14
|
+
function web3js(PublicKey) {
|
|
15
15
|
const accounts = kitInstruction.accounts || [];
|
|
16
16
|
if (PublicKey) {
|
|
17
17
|
// Return instruction with PublicKey instances
|
|
@@ -51,16 +51,8 @@ export function createFluentInstruction(kitInstruction) {
|
|
|
51
51
|
* @returns FluentConfigSelector with additional format conversion methods
|
|
52
52
|
*/
|
|
53
53
|
export function createFluentConfigSelector(baseSelector) {
|
|
54
|
-
async function web3js(PublicKey
|
|
55
|
-
|
|
56
|
-
if (connection) {
|
|
57
|
-
// Rebuild instruction with connection in config
|
|
58
|
-
const selectorWithConnection = baseSelector.set({ connection });
|
|
59
|
-
fluentInstruction = await selectorWithConnection.build();
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
fluentInstruction = await baseSelector.build();
|
|
63
|
-
}
|
|
54
|
+
async function web3js(PublicKey) {
|
|
55
|
+
const fluentInstruction = await baseSelector.build();
|
|
64
56
|
return fluentInstruction.web3js(PublicKey);
|
|
65
57
|
}
|
|
66
58
|
return {
|
|
@@ -115,16 +107,8 @@ export function createSmartFluentConfigSelector(baseSelector) {
|
|
|
115
107
|
const fluentInstruction = await baseSelector.build();
|
|
116
108
|
return fluentInstruction.kit();
|
|
117
109
|
},
|
|
118
|
-
async web3js(PublicKey
|
|
119
|
-
|
|
120
|
-
if (connection) {
|
|
121
|
-
// Rebuild instruction with connection in config
|
|
122
|
-
const selectorWithConnection = baseSelector.set({ connection });
|
|
123
|
-
fluentInstruction = await selectorWithConnection.build();
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
fluentInstruction = await baseSelector.build();
|
|
127
|
-
}
|
|
110
|
+
async web3js(PublicKey) {
|
|
111
|
+
const fluentInstruction = await baseSelector.build();
|
|
128
112
|
return fluentInstruction.web3js(PublicKey);
|
|
129
113
|
}
|
|
130
114
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-converter.js","sourceRoot":"","sources":["../../../src/utils/instruction-converter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAiC,kBAAkB,EAAwB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"instruction-converter.js","sourceRoot":"","sources":["../../../src/utils/instruction-converter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAiC,kBAAkB,EAAwB,MAAM,UAAU,CAAC;AA8JnG;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAA8B;IACpE,SAAS,GAAG;QACV,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,SAAS,MAAM,CAAa,SAA4C;QACtE,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAC;QAE/C,IAAI,SAAS,EAAE,CAAC;YACd,8CAA8C;YAC9C,OAAO;gBACL,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAC7B,MAAM,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC;oBACtC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,+BAA+B;oBACrE,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,EAAI,6BAA6B;iBACpE,CAAC,CAAC;gBACH,SAAS,EAAE,IAAI,SAAS,CAAC,cAAc,CAAC,cAAc,CAAC;gBACvD,IAAI,EAAE,cAAc,CAAC,IAAI;aAC1B,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,2CAA2C;YAC3C,OAAO;gBACL,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAC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
+
* This module provides utilities to handle different signer types across
|
|
5
|
+
* @solana/kit, @solana/web3.js, and plain address strings in a unified way.
|
|
6
|
+
*/
|
|
7
|
+
import { createNoopSigner, address } from '@solana/kit';
|
|
8
|
+
/**
|
|
9
|
+
* Creates TransactionSigner from UniversalSigner input for universal compatibility
|
|
10
|
+
*
|
|
11
|
+
* This function provides universal compatibility by:
|
|
12
|
+
* - Converting string addresses to TransactionSigner using createNoopSigner
|
|
13
|
+
* - Passing through existing TransactionSigner objects unchanged
|
|
14
|
+
* - Safely handling different signer interfaces (kit, web3.js, etc.)
|
|
15
|
+
*
|
|
16
|
+
* The returned TransactionSigner has both .address property and signing capability,
|
|
17
|
+
* making it suitable for both PDA derivation and codama instruction building.
|
|
18
|
+
*
|
|
19
|
+
* @param signer - The signer input (string address or signer object)
|
|
20
|
+
* @returns TransactionSigner that can be used directly for codama and has .address property
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Browser usage with string address
|
|
25
|
+
* const borrower = createTransactionSigner("base58AddressString");
|
|
26
|
+
* // borrower.address → Address object for PDA derivation
|
|
27
|
+
* // borrower → TransactionSigner for codama
|
|
28
|
+
*
|
|
29
|
+
* // CLI usage with wallet object
|
|
30
|
+
* const borrower = createTransactionSigner(wallet);
|
|
31
|
+
* // borrower.address → wallet.address for PDA derivation
|
|
32
|
+
* // borrower → wallet signer for codama
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export function createTransactionSigner(signer) {
|
|
36
|
+
// Handle string address case (browser usage)
|
|
37
|
+
if (typeof signer === 'string') {
|
|
38
|
+
return createNoopSigner(address(signer)); // Returns TransactionSigner with .address property
|
|
39
|
+
}
|
|
40
|
+
// Handle signer object cases (CLI and other wallet interfaces)
|
|
41
|
+
// These should already be TransactionSigner objects with .address property
|
|
42
|
+
return signer;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Type guard to check if a value is a signer object (not a string)
|
|
46
|
+
*/
|
|
47
|
+
export function isSignerObject(signer) {
|
|
48
|
+
return typeof signer !== 'string';
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Type guard to check if a value is an address string
|
|
52
|
+
*/
|
|
53
|
+
export function isAddressString(signer) {
|
|
54
|
+
return typeof signer === 'string';
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../src/utils/signer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAA0B,MAAM,aAAa,CAAC;AAchF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAuB;IAC7D,6CAA6C;IAC7C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,mDAAmD;IAChG,CAAC;IAED,+DAA+D;IAC/D,2EAA2E;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAuB;IACpD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB;IACrD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC;AACpC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ConfigSelector } from '../utils/config';
|
|
2
2
|
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
3
|
+
import { type UniversalSigner } from '../utils/signer';
|
|
3
4
|
type UniversalAddress = string;
|
|
4
|
-
type UniversalSigner = any;
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for accepting a rental contract.
|
|
7
7
|
*
|
|
@@ -13,8 +13,9 @@ type UniversalSigner = any;
|
|
|
13
13
|
*/
|
|
14
14
|
export interface AcceptRentalParams {
|
|
15
15
|
/**
|
|
16
|
-
* The borrower who will rent the fleet (
|
|
16
|
+
* The borrower who will rent the fleet (signer object or base58 string address).
|
|
17
17
|
* This account will control the fleet during the rental period and make payments.
|
|
18
|
+
* Can be a wallet/signer object (CLI usage) or base58 address string (browser usage).
|
|
18
19
|
*/
|
|
19
20
|
borrower: UniversalSigner;
|
|
20
21
|
/**
|
|
@@ -96,27 +97,36 @@ export interface AcceptRentalParams {
|
|
|
96
97
|
* ```typescript
|
|
97
98
|
* import { acceptRental, days } from '@srsly/sdk';
|
|
98
99
|
*
|
|
99
|
-
* //
|
|
100
|
+
* // CLI usage with wallet/signer object
|
|
100
101
|
* const instruction = await acceptRental({
|
|
101
|
-
* borrower: wallet,
|
|
102
|
-
* borrowerProfile: "ProfileAddr...",
|
|
103
|
-
* borrowerFaction: 'mud',
|
|
104
|
-
* contract: "ContractAddr...",
|
|
105
|
-
* duration: days(7)
|
|
102
|
+
* borrower: wallet, // Wallet object for signing
|
|
103
|
+
* borrowerProfile: "ProfileAddr...", // Borrower's Star Atlas profile
|
|
104
|
+
* borrowerFaction: 'mud', // Faction: 'mud', 'oni', or 'ustur'
|
|
105
|
+
* contract: "ContractAddr...", // Contract to accept
|
|
106
|
+
* duration: days(7) // 7 days rental duration
|
|
106
107
|
* });
|
|
107
108
|
*
|
|
108
|
-
* //
|
|
109
|
+
* // Browser usage with address string
|
|
110
|
+
* const browserInstruction = await acceptRental({
|
|
111
|
+
* borrower: wallet.publicKey.toString(), // Address string for browser
|
|
112
|
+
* borrowerProfile: "ProfileAddr...", // Borrower's Star Atlas profile
|
|
113
|
+
* borrowerFaction: 'mud', // Faction: 'mud', 'oni', or 'ustur'
|
|
114
|
+
* contract: "ContractAddr...", // Contract to accept
|
|
115
|
+
* duration: days(7) // 7 days rental duration
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* // Configure for mainnet (both patterns work)
|
|
109
119
|
* const mainnetInstruction = await acceptRental({
|
|
110
|
-
* borrower: wallet,
|
|
120
|
+
* borrower: wallet, // Wallet object (CLI style)
|
|
111
121
|
* borrowerProfile: "ProfileAddr...",
|
|
112
|
-
* borrowerFaction: 1,
|
|
122
|
+
* borrowerFaction: 1, // Can use numbers: 1=mud, 2=oni, 3=ustur
|
|
113
123
|
* contract: "ContractAddr...",
|
|
114
124
|
* duration: days(7)
|
|
115
125
|
* }).set({ programs: 'mainnet' });
|
|
116
126
|
*
|
|
117
127
|
* // Override specific game configuration
|
|
118
128
|
* const customInstruction = await acceptRental({
|
|
119
|
-
* borrower:
|
|
129
|
+
* borrower: "BorrowerAddress123...", // Address string (browser style)
|
|
120
130
|
* borrowerProfile: "ProfileAddr...",
|
|
121
131
|
* borrowerFaction: 'mud',
|
|
122
132
|
* contract: "ContractAddr...",
|
|
@@ -128,7 +138,7 @@ export interface AcceptRentalParams {
|
|
|
128
138
|
*
|
|
129
139
|
* // Convert to @solana/web3.js format
|
|
130
140
|
* const web3jsInstruction = await acceptRental({
|
|
131
|
-
* borrower: wallet,
|
|
141
|
+
* borrower: wallet, // Universal: works with both patterns
|
|
132
142
|
* borrowerProfile: "ProfileAddr...",
|
|
133
143
|
* borrowerFaction: 'mud',
|
|
134
144
|
* contract: "ContractAddr...",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../../src/rental/accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAG/I,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../../src/rental/accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAG/I,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAIlK,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAG/B;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,eAAe,EAAE,gBAAgB,CAAC;IAElC;;;;;OAKG;IACH,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC;;;;;;;;OAQG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B;AAmID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,GACzB,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK9F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ConfigSelector } from '../utils/config';
|
|
2
|
+
import { type UniversalSigner } from '../utils/signer';
|
|
2
3
|
type UniversalAddress = string;
|
|
3
|
-
type UniversalSigner = any;
|
|
4
4
|
type CancelRentalInstruction = any;
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for canceling an active rental.
|
|
@@ -13,9 +13,10 @@ type CancelRentalInstruction = any;
|
|
|
13
13
|
*/
|
|
14
14
|
export interface CancelRentalParams {
|
|
15
15
|
/**
|
|
16
|
-
* The borrower who wants to cancel the rental (
|
|
16
|
+
* The borrower who wants to cancel the rental (signer object or base58 string address).
|
|
17
17
|
* Must be the original borrower who accepted the rental contract.
|
|
18
18
|
* This account will pay any cancellation penalties.
|
|
19
|
+
* Can be a wallet/signer object (CLI usage) or base58 address string (browser usage).
|
|
19
20
|
*/
|
|
20
21
|
borrower: UniversalSigner;
|
|
21
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4D,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAEpI,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,uBAAuB,GAAG,GAAG,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAgDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,GACzB,cAAc,CAAC,uBAAuB,CAAC,CAEzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK9F"}
|