@wuwei-labs/srsly 2.0.0-beta.46 → 2.0.0-beta.48
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/dist/cjs/codama/instructions/cancelRental.js +13 -23
- package/dist/cjs/codama/instructions/cancelRental.js.map +1 -1
- package/dist/cjs/contract/close.js +106 -21
- package/dist/cjs/contract/close.js.map +1 -1
- package/dist/cjs/contract/create.js +59 -5
- package/dist/cjs/contract/create.js.map +1 -1
- package/dist/cjs/demos.js +65 -0
- package/dist/cjs/demos.js.map +1 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/rental/accept.js +31 -0
- package/dist/cjs/rental/accept.js.map +1 -1
- package/dist/cjs/rental/cancel.js +60 -9
- package/dist/cjs/rental/cancel.js.map +1 -1
- package/dist/cjs/rental/close.js +35 -23
- package/dist/cjs/rental/close.js.map +1 -1
- package/dist/cjs/rental/reset-contract-temp.js +4 -1
- package/dist/cjs/rental/reset-contract-temp.js.map +1 -1
- package/dist/cjs/rental/reset.js +131 -26
- package/dist/cjs/rental/reset.js.map +1 -1
- package/dist/cjs/utils/fetch-accounts.js +26 -0
- package/dist/cjs/utils/fetch-accounts.js.map +1 -1
- package/dist/cjs/utils/index.js +8 -0
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/pda.js.map +1 -1
- package/dist/cjs/utils/sdk-helpers.js +122 -0
- package/dist/cjs/utils/sdk-helpers.js.map +1 -0
- package/dist/cjs/utils/signer.js +19 -1
- package/dist/cjs/utils/signer.js.map +1 -1
- package/dist/esm/codama/instructions/cancelRental.js +13 -23
- package/dist/esm/codama/instructions/cancelRental.js.map +1 -1
- package/dist/esm/contract/close.js +106 -22
- package/dist/esm/contract/close.js.map +1 -1
- package/dist/esm/contract/create.js +59 -6
- package/dist/esm/contract/create.js.map +1 -1
- package/dist/esm/demos.js +23 -0
- package/dist/esm/demos.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/rental/accept.js +30 -0
- package/dist/esm/rental/accept.js.map +1 -1
- package/dist/esm/rental/cancel.js +60 -10
- package/dist/esm/rental/cancel.js.map +1 -1
- package/dist/esm/rental/close.js +37 -26
- package/dist/esm/rental/close.js.map +1 -1
- package/dist/esm/rental/reset-contract-temp.js +4 -1
- package/dist/esm/rental/reset-contract-temp.js.map +1 -1
- package/dist/esm/rental/reset.js +131 -27
- package/dist/esm/rental/reset.js.map +1 -1
- package/dist/esm/utils/fetch-accounts.js +26 -1
- 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/pda.js.map +1 -1
- package/dist/esm/utils/sdk-helpers.js +113 -0
- package/dist/esm/utils/sdk-helpers.js.map +1 -0
- package/dist/esm/utils/signer.js +19 -1
- package/dist/esm/utils/signer.js.map +1 -1
- package/dist/types/codama/instructions/cancelRental.d.ts +2 -2
- package/dist/types/codama/instructions/cancelRental.d.ts.map +1 -1
- package/dist/types/contract/close.d.ts +17 -12
- package/dist/types/contract/close.d.ts.map +1 -1
- package/dist/types/contract/create.d.ts +8 -2
- package/dist/types/contract/create.d.ts.map +1 -1
- package/dist/types/demos.d.ts +58 -0
- package/dist/types/demos.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rental/accept.d.ts +6 -0
- package/dist/types/rental/accept.d.ts.map +1 -1
- package/dist/types/rental/cancel.d.ts +9 -3
- package/dist/types/rental/cancel.d.ts.map +1 -1
- package/dist/types/rental/close.d.ts +11 -5
- package/dist/types/rental/close.d.ts.map +1 -1
- package/dist/types/rental/reset-contract-temp.d.ts +1 -1
- package/dist/types/rental/reset-contract-temp.d.ts.map +1 -1
- package/dist/types/rental/reset.d.ts +35 -24
- package/dist/types/rental/reset.d.ts.map +1 -1
- package/dist/types/utils/fetch-accounts.d.ts +48 -1
- 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/pda.d.ts.map +1 -1
- package/dist/types/utils/sdk-helpers.d.ts +49 -0
- package/dist/types/utils/sdk-helpers.d.ts.map +1 -0
- package/dist/types/utils/signer.d.ts.map +1 -1
- package/package.json +7 -1
- package/target/idl/srsly.json +1 -23
|
@@ -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 closing a rental contract.
|
|
7
7
|
*
|
|
@@ -15,12 +15,13 @@ export interface CloseContractParams {
|
|
|
15
15
|
* The fleet owner who created the contract (can be signer object or string address).
|
|
16
16
|
* This account must be the original owner of the contract and will receive any remaining lamports.
|
|
17
17
|
*/
|
|
18
|
-
owner: UniversalSigner
|
|
18
|
+
owner: UniversalSigner;
|
|
19
19
|
/**
|
|
20
20
|
* String address of the fleet associated with the contract.
|
|
21
|
+
* If omitted, the fleet address will be fetched from the contract account.
|
|
21
22
|
* This is the fleet that was made available for rental through the contract.
|
|
22
23
|
*/
|
|
23
|
-
fleet
|
|
24
|
+
fleet?: UniversalAddress;
|
|
24
25
|
/**
|
|
25
26
|
* String address of the rental contract to close.
|
|
26
27
|
* This contract will be permanently closed and cannot be reopened.
|
|
@@ -51,11 +52,12 @@ export interface CloseContractParams {
|
|
|
51
52
|
*
|
|
52
53
|
* ## Process
|
|
53
54
|
*
|
|
54
|
-
* 1. **
|
|
55
|
-
* 2. **
|
|
56
|
-
* 3. **
|
|
57
|
-
* 4. **
|
|
58
|
-
* 5. **
|
|
55
|
+
* 1. **Fetch Fleet**: Automatically fetches fleet address from contract if not provided
|
|
56
|
+
* 2. **Derive Accounts**: Automatically derives required game accounts (starbase, etc.)
|
|
57
|
+
* 3. **Validate Authority**: Ensures only the contract owner can close it
|
|
58
|
+
* 4. **Check State**: Verifies no active rentals exist
|
|
59
|
+
* 5. **Close Contract**: Removes rental capability and closes account
|
|
60
|
+
* 6. **Transfer Lamports**: Returns remaining SOL to the owner
|
|
59
61
|
*
|
|
60
62
|
* ## Requirements
|
|
61
63
|
*
|
|
@@ -67,10 +69,9 @@ export interface CloseContractParams {
|
|
|
67
69
|
* ```typescript
|
|
68
70
|
* import { closeContract } from '@srsly/sdk';
|
|
69
71
|
*
|
|
70
|
-
* // Basic contract closure
|
|
72
|
+
* // Basic contract closure (fleet automatically fetched)
|
|
71
73
|
* const instruction = await closeContract({
|
|
72
74
|
* owner: wallet, // Contract owner
|
|
73
|
-
* fleet: "FleetAddress123...", // Fleet address
|
|
74
75
|
* contract: "ContractAddr...", // Contract to close
|
|
75
76
|
* faction: 'mud' // Faction for game account derivation
|
|
76
77
|
* });
|
|
@@ -78,7 +79,6 @@ export interface CloseContractParams {
|
|
|
78
79
|
* // Configure for mainnet
|
|
79
80
|
* const mainnetInstruction = await closeContract({
|
|
80
81
|
* owner: wallet,
|
|
81
|
-
* fleet: "FleetAddress123...",
|
|
82
82
|
* contract: "ContractAddr...",
|
|
83
83
|
* faction: 'mud'
|
|
84
84
|
* }).set({ programs: 'mainnet' });
|
|
@@ -86,7 +86,6 @@ export interface CloseContractParams {
|
|
|
86
86
|
* // Override specific game configuration
|
|
87
87
|
* const customInstruction = await closeContract({
|
|
88
88
|
* owner: wallet,
|
|
89
|
-
* fleet: "FleetAddress123...",
|
|
90
89
|
* contract: "ContractAddr...",
|
|
91
90
|
* faction: 'mud'
|
|
92
91
|
* }).set({
|
|
@@ -105,5 +104,11 @@ export interface CloseContractParams {
|
|
|
105
104
|
*/
|
|
106
105
|
export declare function closeContract(params: CloseContractParams): SmartFluentConfigSelector<FluentInstruction>;
|
|
107
106
|
export declare function getCloseContractInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
107
|
+
export declare const closeContractDemo: {
|
|
108
|
+
tabName: string;
|
|
109
|
+
description: string;
|
|
110
|
+
imports: string;
|
|
111
|
+
instruction: string;
|
|
112
|
+
};
|
|
108
113
|
export {};
|
|
109
114
|
//# sourceMappingURL=close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/contract/close.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/contract/close.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;AAElK,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,eAAe,CAAC;IAEvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAyLD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,mBAAmB,GAC1B,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C;AAGD,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK/F;AAGD,eAAO,MAAM,iBAAiB;;;;;CAS7B,CAAC"}
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { PaymentFrequencyString } from '../types/paymentFrequency';
|
|
18
18
|
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
19
|
+
import { type UniversalSigner } from '../utils/signer';
|
|
19
20
|
type UniversalAddress = string;
|
|
20
|
-
type UniversalSigner = any;
|
|
21
21
|
/**
|
|
22
22
|
* Parameters for creating a rental contract.
|
|
23
23
|
*
|
|
@@ -32,7 +32,7 @@ export interface CreateContractParams {
|
|
|
32
32
|
* The fleet owner (can be a signer object or string address).
|
|
33
33
|
* This account will receive rental payments and has control over the contract.
|
|
34
34
|
*/
|
|
35
|
-
owner: UniversalSigner
|
|
35
|
+
owner: UniversalSigner;
|
|
36
36
|
/**
|
|
37
37
|
* String address of the fleet to be rented out.
|
|
38
38
|
* Must be a valid fleet registered in the Star Atlas SAGE ecosystem.
|
|
@@ -161,5 +161,11 @@ export interface CreateContractParams {
|
|
|
161
161
|
* @throws Error when payment frequency is invalid or duration alignment fails
|
|
162
162
|
*/
|
|
163
163
|
export declare function createContract(params: CreateContractParams): SmartFluentConfigSelector<FluentInstruction>;
|
|
164
|
+
export declare const createContractDemo: {
|
|
165
|
+
tabName: string;
|
|
166
|
+
description: string;
|
|
167
|
+
imports: string;
|
|
168
|
+
instruction: string;
|
|
169
|
+
};
|
|
164
170
|
export {};
|
|
165
171
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/contract/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAE,sBAAsB,EAA2B,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/contract/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAE,sBAAsB,EAA2B,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAClK,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,KAAK,EAAE,eAAe,CAAC;IAEvB;;;OAGG;IACH,KAAK,EAAE,gBAAgB,CAAC;IAExB;;;OAGG;IACH,YAAY,EAAE,gBAAgB,CAAC;IAE/B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,YAAY,EAAE,sBAAsB,CAAC;IAErC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA6HD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,CAGzG;AAGD,eAAO,MAAM,kBAAkB;;;;;CAY9B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Demo exports for documentation site
|
|
3
|
+
*
|
|
4
|
+
* This module exports demo templates for all SRSLY SDK instructions.
|
|
5
|
+
* These templates are used in the documentation site to provide interactive examples.
|
|
6
|
+
*/
|
|
7
|
+
export { createContractDemo } from './contract/create';
|
|
8
|
+
export { closeContractDemo } from './contract/close';
|
|
9
|
+
export { acceptRentalDemo } from './rental/accept';
|
|
10
|
+
export { cancelRentalDemo } from './rental/cancel';
|
|
11
|
+
export { closeRentalDemo } from './rental/close';
|
|
12
|
+
export { resetRentalDemo } from './rental/reset';
|
|
13
|
+
export interface DemoTemplate {
|
|
14
|
+
tabName: string;
|
|
15
|
+
description: string;
|
|
16
|
+
imports: string;
|
|
17
|
+
instruction: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const ALL_DEMOS: {
|
|
20
|
+
readonly createContract: () => Promise<{
|
|
21
|
+
tabName: string;
|
|
22
|
+
description: string;
|
|
23
|
+
imports: string;
|
|
24
|
+
instruction: string;
|
|
25
|
+
}>;
|
|
26
|
+
readonly closeContract: () => Promise<{
|
|
27
|
+
tabName: string;
|
|
28
|
+
description: string;
|
|
29
|
+
imports: string;
|
|
30
|
+
instruction: string;
|
|
31
|
+
}>;
|
|
32
|
+
readonly acceptRental: () => Promise<{
|
|
33
|
+
tabName: string;
|
|
34
|
+
description: string;
|
|
35
|
+
imports: string;
|
|
36
|
+
instruction: string;
|
|
37
|
+
}>;
|
|
38
|
+
readonly cancelRental: () => Promise<{
|
|
39
|
+
tabName: string;
|
|
40
|
+
description: string;
|
|
41
|
+
imports: string;
|
|
42
|
+
instruction: string;
|
|
43
|
+
}>;
|
|
44
|
+
readonly closeRental: () => Promise<{
|
|
45
|
+
tabName: string;
|
|
46
|
+
description: string;
|
|
47
|
+
imports: string;
|
|
48
|
+
instruction: string;
|
|
49
|
+
}>;
|
|
50
|
+
readonly resetRental: () => Promise<{
|
|
51
|
+
tabName: string;
|
|
52
|
+
description: string;
|
|
53
|
+
imports: string;
|
|
54
|
+
instruction: string;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
export type DemoOperation = keyof typeof ALL_DEMOS;
|
|
58
|
+
//# sourceMappingURL=demos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demos.d.ts","sourceRoot":"","sources":["../../src/demos.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAGD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,SAAS,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export type { ContractState, RentalState, CreateContractInstruction, AcceptRenta
|
|
|
68
68
|
* );
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
export { fetchContractState, fetchRentalState, fetchMultipleContractStates, fetchMultipleRentalStates } from "./utils/fetch-accounts";
|
|
71
|
+
export { fetchContractState, fetchRentalState, fetchConfigState, fetchMultipleContractStates, fetchMultipleRentalStates } from "./utils/fetch-accounts";
|
|
72
72
|
/**
|
|
73
73
|
* Payment frequency enum generated from the Rust program.
|
|
74
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAGH,cAAc,Y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,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EAGtB,SAAS,EACT,cAAc,EACf,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;GAWG;AACH,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACT,MAAM,kBAAkB,CAAC"}
|
|
@@ -168,5 +168,11 @@ export declare function acceptRental(params: AcceptRentalParams): SmartFluentCon
|
|
|
168
168
|
* @returns A ConfigSelector for the raw instruction
|
|
169
169
|
*/
|
|
170
170
|
export declare function getAcceptRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
171
|
+
export declare const acceptRentalDemo: {
|
|
172
|
+
tabName: string;
|
|
173
|
+
description: string;
|
|
174
|
+
imports: string;
|
|
175
|
+
instruction: string;
|
|
176
|
+
};
|
|
171
177
|
export {};
|
|
172
178
|
//# sourceMappingURL=accept.d.ts.map
|
|
@@ -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,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;;;;;;;;;;;;;;;;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;AAGD,eAAO,MAAM,gBAAgB;;;;;CAW5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ConfigSelector } from '../utils/config';
|
|
2
2
|
import { type UniversalSigner } from '../utils/signer';
|
|
3
|
+
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
3
4
|
type UniversalAddress = string;
|
|
4
|
-
type CancelRentalInstruction = any;
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for canceling an active rental.
|
|
7
7
|
*
|
|
@@ -91,10 +91,10 @@ export interface CancelRentalParams {
|
|
|
91
91
|
* ```
|
|
92
92
|
*
|
|
93
93
|
* @param params - The rental cancellation parameters including borrower and contract
|
|
94
|
-
* @returns A
|
|
94
|
+
* @returns A SmartFluentConfigSelector that can be configured with .set() or awaited directly
|
|
95
95
|
* @throws Error when rental is not active, caller is not the borrower, or instruction generation fails
|
|
96
96
|
*/
|
|
97
|
-
export declare function cancelRental(params: CancelRentalParams):
|
|
97
|
+
export declare function cancelRental(params: CancelRentalParams): SmartFluentConfigSelector<FluentInstruction>;
|
|
98
98
|
/**
|
|
99
99
|
* Low-level function to create a rental cancellation instruction with raw input parameters.
|
|
100
100
|
*
|
|
@@ -108,5 +108,11 @@ export declare function cancelRental(params: CancelRentalParams): ConfigSelector
|
|
|
108
108
|
* @returns A ConfigSelector for the raw instruction
|
|
109
109
|
*/
|
|
110
110
|
export declare function getCancelRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
111
|
+
export declare const cancelRentalDemo: {
|
|
112
|
+
tabName: string;
|
|
113
|
+
description: string;
|
|
114
|
+
imports: string;
|
|
115
|
+
instruction: string;
|
|
116
|
+
};
|
|
111
117
|
export {};
|
|
112
118
|
//# sourceMappingURL=cancel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/rental/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuE,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAE/I,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAKlK,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,QAAQ,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AA4GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;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;AAGD,eAAO,MAAM,gBAAgB;;;;;CAQ5B,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 closing a completed rental.
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ export interface CloseRentalParams {
|
|
|
22
22
|
* String address of the rental state to close.
|
|
23
23
|
* This is the unique rental state account that tracks the rental.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
rentalState: UniversalAddress;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Creates an instruction to close a completed rental with fluent configuration.
|
|
@@ -69,19 +69,19 @@ export interface CloseRentalParams {
|
|
|
69
69
|
* // Close a completed rental
|
|
70
70
|
* const instruction = await closeRental({
|
|
71
71
|
* payer: wallet, // Transaction payer
|
|
72
|
-
*
|
|
72
|
+
* rentalState: "RentalState..." // Rental state address
|
|
73
73
|
* });
|
|
74
74
|
*
|
|
75
75
|
* // Configure for mainnet
|
|
76
76
|
* const mainnetInstruction = await closeRental({
|
|
77
77
|
* payer: wallet,
|
|
78
|
-
*
|
|
78
|
+
* rentalState: "RentalState..."
|
|
79
79
|
* }).set({ programs: 'mainnet' });
|
|
80
80
|
*
|
|
81
81
|
* // Convert to @solana/web3.js format
|
|
82
82
|
* const web3jsInstruction = await closeRental({
|
|
83
83
|
* payer: wallet,
|
|
84
|
-
*
|
|
84
|
+
* rentalState: "RentalState..."
|
|
85
85
|
* }).web3js();
|
|
86
86
|
*
|
|
87
87
|
* // Use with your preferred Solana library
|
|
@@ -107,5 +107,11 @@ export declare function closeRental(params: CloseRentalParams): SmartFluentConfi
|
|
|
107
107
|
* @returns A ConfigSelector for the raw instruction
|
|
108
108
|
*/
|
|
109
109
|
export declare function getCloseRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
110
|
+
export declare const closeRentalDemo: {
|
|
111
|
+
tabName: string;
|
|
112
|
+
description: string;
|
|
113
|
+
imports: string;
|
|
114
|
+
instruction: string;
|
|
115
|
+
};
|
|
110
116
|
export {};
|
|
111
117
|
//# sourceMappingURL=close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/rental/close.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/rental/close.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;AAKlK,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IAEvB;;;OAGG;IACH,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAuHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,GACxB,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK7F;AAGD,eAAO,MAAM,eAAe;;;;;CAQ3B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
2
|
+
import { type UniversalSigner } from '../utils/signer';
|
|
2
3
|
type UniversalAddress = string;
|
|
3
|
-
type UniversalSigner = any;
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for resetting a contract temporarily (devnet testing).
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-contract-temp.d.ts","sourceRoot":"","sources":["../../../src/rental/reset-contract-temp.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"reset-contract-temp.d.ts","sourceRoot":"","sources":["../../../src/rental/reset-contract-temp.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4D,KAAK,iBAAiB,EAAE,KAAK,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAGlK,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,eAAe,CAAC;IAExB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,YAAY,EAAE,gBAAgB,CAAC;CAChC;AAoFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,uBAAuB,GAC9B,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ConfigSelector } from '../utils/config';
|
|
2
|
+
import { type FluentInstruction, type SmartFluentConfigSelector } from '../utils/instruction-converter';
|
|
3
|
+
import { type UniversalSigner } from '../utils/signer';
|
|
2
4
|
type UniversalAddress = string;
|
|
3
|
-
type UniversalSigner = any;
|
|
4
|
-
type ResetRentalInstruction = any;
|
|
5
5
|
/**
|
|
6
6
|
* Parameters for resetting a rental after cancellation.
|
|
7
7
|
*
|
|
@@ -20,9 +20,10 @@ export interface ResetRentalParams {
|
|
|
20
20
|
payer: UniversalSigner;
|
|
21
21
|
/**
|
|
22
22
|
* String address of the fleet associated with the rental contract.
|
|
23
|
+
* If omitted, the fleet address will be fetched from the contract account.
|
|
23
24
|
* The fleet's rental state will be reset to allow for new rentals.
|
|
24
25
|
*/
|
|
25
|
-
fleet
|
|
26
|
+
fleet?: UniversalAddress;
|
|
26
27
|
/**
|
|
27
28
|
* String address of the rental contract to reset.
|
|
28
29
|
* This contract will be made available for new rentals after reset.
|
|
@@ -30,9 +31,10 @@ export interface ResetRentalParams {
|
|
|
30
31
|
contract: UniversalAddress;
|
|
31
32
|
/**
|
|
32
33
|
* String address of the rental state account to be reset.
|
|
34
|
+
* If omitted, the rental state address will be fetched from the contract account.
|
|
33
35
|
* This account contains the canceled rental data that needs to be cleared.
|
|
34
36
|
*/
|
|
35
|
-
rentalState
|
|
37
|
+
rentalState?: UniversalAddress;
|
|
36
38
|
/**
|
|
37
39
|
* Faction identifier for Star Atlas integration.
|
|
38
40
|
* Can be provided as a number (1 = MUD, 2 = ONI, 3 = Ustur) or string ('mud', 'oni', 'ustur').
|
|
@@ -42,10 +44,11 @@ export interface ResetRentalParams {
|
|
|
42
44
|
faction: number | string;
|
|
43
45
|
/**
|
|
44
46
|
* String address of the owner's profile in the Star Atlas game.
|
|
47
|
+
* If omitted, the owner profile will be fetched from the contract account.
|
|
45
48
|
* Required for deriving game accounts (starbase, starbasePlayer) needed by SAGE.
|
|
46
49
|
* Must be the profile of the original fleet owner.
|
|
47
50
|
*/
|
|
48
|
-
ownerProfile
|
|
51
|
+
ownerProfile?: UniversalAddress;
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Creates an instruction to reset a rental contract after cancellation with fluent configuration.
|
|
@@ -89,31 +92,35 @@ export interface ResetRentalParams {
|
|
|
89
92
|
* ```typescript
|
|
90
93
|
* import { resetRental } from '@srsly/sdk';
|
|
91
94
|
*
|
|
92
|
-
* // Reset a canceled rental
|
|
95
|
+
* // Reset a canceled rental (all addresses auto-fetched from contract)
|
|
93
96
|
* const instruction = await resetRental({
|
|
94
|
-
*
|
|
97
|
+
* payer: wallet, // Transaction payer
|
|
95
98
|
* contract: "ContractAddr...", // Contract to reactivate
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
+
* faction: 'mud' // Owner's faction
|
|
100
|
+
* });
|
|
101
|
+
*
|
|
102
|
+
* // Optionally provide explicit addresses to avoid fetching
|
|
103
|
+
* const instruction = await resetRental({
|
|
104
|
+
* payer: wallet,
|
|
105
|
+
* fleet: "FleetAddress123...", // Optional: will be fetched if omitted
|
|
106
|
+
* contract: "ContractAddr...",
|
|
107
|
+
* rentalState: "RentalStateAddr...", // Optional: will be fetched if omitted
|
|
108
|
+
* faction: 'mud',
|
|
109
|
+
* ownerProfile: "OwnerProfileAddr..." // Optional: will be fetched if omitted
|
|
99
110
|
* });
|
|
100
111
|
*
|
|
101
112
|
* // Configure for mainnet
|
|
102
113
|
* const mainnetInstruction = await resetRental({
|
|
103
|
-
*
|
|
114
|
+
* payer: wallet,
|
|
104
115
|
* contract: "ContractAddr...",
|
|
105
|
-
*
|
|
106
|
-
* faction: 1, // Can use numbers: 1=mud, 2=oni, 3=ustur
|
|
107
|
-
* ownerProfile: "OwnerProfileAddr..."
|
|
116
|
+
* faction: 1 // Can use numbers: 1=mud, 2=oni, 3=ustur
|
|
108
117
|
* }).set({ programs: 'mainnet' });
|
|
109
118
|
*
|
|
110
119
|
* // Override specific game configuration
|
|
111
120
|
* const customInstruction = await resetRental({
|
|
112
|
-
*
|
|
121
|
+
* payer: wallet,
|
|
113
122
|
* contract: "ContractAddr...",
|
|
114
|
-
*
|
|
115
|
-
* faction: 'mud',
|
|
116
|
-
* ownerProfile: "OwnerProfileAddr..."
|
|
123
|
+
* faction: 'mud'
|
|
117
124
|
* }).set({
|
|
118
125
|
* programs: 'mainnet',
|
|
119
126
|
* gameId: 'custom-game-id...'
|
|
@@ -121,11 +128,9 @@ export interface ResetRentalParams {
|
|
|
121
128
|
*
|
|
122
129
|
* // Convert to @solana/web3.js format
|
|
123
130
|
* const web3jsInstruction = await resetRental({
|
|
124
|
-
*
|
|
131
|
+
* payer: wallet,
|
|
125
132
|
* contract: "ContractAddr...",
|
|
126
|
-
*
|
|
127
|
-
* faction: 'mud',
|
|
128
|
-
* ownerProfile: "OwnerProfileAddr..."
|
|
133
|
+
* faction: 'mud'
|
|
129
134
|
* }).web3js();
|
|
130
135
|
*
|
|
131
136
|
* // Use with your preferred Solana library
|
|
@@ -134,10 +139,10 @@ export interface ResetRentalParams {
|
|
|
134
139
|
* ```
|
|
135
140
|
*
|
|
136
141
|
* @param params - The rental reset parameters including fleet, contract, rental state, and owner details
|
|
137
|
-
* @returns A
|
|
142
|
+
* @returns A SmartFluentConfigSelector that can be configured with .set() or awaited directly
|
|
138
143
|
* @throws Error when rental is not in canceled state or instruction generation fails
|
|
139
144
|
*/
|
|
140
|
-
export declare function resetRental(params: ResetRentalParams):
|
|
145
|
+
export declare function resetRental(params: ResetRentalParams): SmartFluentConfigSelector<FluentInstruction>;
|
|
141
146
|
/**
|
|
142
147
|
* Low-level function to create a rental reset instruction with raw input parameters.
|
|
143
148
|
*
|
|
@@ -151,5 +156,11 @@ export declare function resetRental(params: ResetRentalParams): ConfigSelector<R
|
|
|
151
156
|
* @returns A ConfigSelector for the raw instruction
|
|
152
157
|
*/
|
|
153
158
|
export declare function getResetRentalInstructionAsync(input: any, options?: any): ConfigSelector<any>;
|
|
159
|
+
export declare const resetRentalDemo: {
|
|
160
|
+
tabName: string;
|
|
161
|
+
description: string;
|
|
162
|
+
imports: string;
|
|
163
|
+
instruction: string;
|
|
164
|
+
};
|
|
154
165
|
export {};
|
|
155
166
|
//# sourceMappingURL=reset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/rental/reset.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/rental/reset.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;AAElK,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGhF,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAE/B;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB;;;OAGG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;;OAIG;IACF,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAEhC;;;;;OAKG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AA+JD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,GACxB,yBAAyB,CAAC,iBAAiB,CAAC,CAG9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAK7F;AAGD,eAAO,MAAM,eAAe;;;;;CAS3B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address } from '@solana/kit';
|
|
2
|
-
import { fetchContractState as fetchContractStateCodama, fetchRentalState as fetchRentalStateCodama } from '../codama/accounts';
|
|
2
|
+
import { fetchContractState as fetchContractStateCodama, fetchRentalState as fetchRentalStateCodama, fetchMaybeConfig as fetchConfigStateCodama } from '../codama/accounts';
|
|
3
3
|
/**
|
|
4
4
|
* Convenience wrapper functions for fetching account states with RPC URL strings.
|
|
5
5
|
* These functions handle creating the RPC connection for you.
|
|
@@ -70,6 +70,53 @@ export declare function fetchRentalState<TAddress extends string = string>(renta
|
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
export declare function fetchRentalState<TAddress extends string = string>(rpcUrl: string, rentalAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchRentalStateCodama>>;
|
|
73
|
+
/**
|
|
74
|
+
* Fetches config state data from the blockchain using global config to derive PDA
|
|
75
|
+
*
|
|
76
|
+
* @returns The config state data with metadata
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // Uses global config to automatically derive config PDA
|
|
81
|
+
* const configState = await fetchConfigState();
|
|
82
|
+
* console.log('Config authority:', configState.data.authority);
|
|
83
|
+
* console.log('Config fees:', configState.data.fees);
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function fetchConfigState(): Promise<ReturnType<typeof fetchConfigStateCodama>>;
|
|
87
|
+
/**
|
|
88
|
+
* Fetches config state data from the blockchain using RPC URL from global config
|
|
89
|
+
*
|
|
90
|
+
* @param configAddress - The config account address to fetch
|
|
91
|
+
* @returns The config state data with metadata
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const configState = await fetchConfigState('ConfigAddress123...');
|
|
96
|
+
* console.log('Config authority:', configState.data.authority);
|
|
97
|
+
* console.log('Config fees:', configState.data.fees);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare function fetchConfigState<TAddress extends string = string>(configAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchConfigStateCodama>>;
|
|
101
|
+
/**
|
|
102
|
+
* Fetches config state data from the blockchain using a specific RPC URL
|
|
103
|
+
*
|
|
104
|
+
* @param rpcUrl - The RPC endpoint URL as a string
|
|
105
|
+
* @param configAddress - The config account address to fetch
|
|
106
|
+
* @returns The config state data with metadata
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const configState = await fetchConfigState(
|
|
111
|
+
* 'https://api.devnet.solana.com',
|
|
112
|
+
* 'ConfigAddress123...'
|
|
113
|
+
* );
|
|
114
|
+
*
|
|
115
|
+
* console.log('Config authority:', configState.data.authority);
|
|
116
|
+
* console.log('Config fees:', configState.data.fees);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function fetchConfigState<TAddress extends string = string>(rpcUrl: string, configAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchConfigStateCodama>>;
|
|
73
120
|
/**
|
|
74
121
|
* Fetches multiple contract states in a single RPC call
|
|
75
122
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-accounts.d.ts","sourceRoot":"","sources":["../../../src/utils/fetch-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,kBAAkB,IAAI,wBAAwB,EAC9C,gBAAgB,IAAI,sBAAsB,EAG3C,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-accounts.d.ts","sourceRoot":"","sources":["../../../src/utils/fetch-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EACL,kBAAkB,IAAI,wBAAwB,EAC9C,gBAAgB,IAAI,sBAAsB,EAC1C,gBAAgB,IAAI,sBAAsB,EAG3C,MAAM,oBAAoB,CAAC;AAK5B;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EACvE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,GAC1C,OAAO,C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AAC,OAAO,sBAAsB,CAAC,CAAC,CAAC;AAgCtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,2BAA2B,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChF,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,wFAOvC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAC9E,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,sFAOrC"}
|
|
@@ -7,4 +7,5 @@ export * from "./instruction-converter";
|
|
|
7
7
|
export * from "./fetch-accounts";
|
|
8
8
|
export * from "./pda";
|
|
9
9
|
export * from "./signer";
|
|
10
|
+
export { createRpcFromConfig, deriveConfigPda, fetchAccountWithValidation, fetchMultipleAccounts, deriveAllRentalPDAs, ErrorMessages } from "./sdk-helpers";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","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;AACzB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pda.d.ts","sourceRoot":"","sources":["../../../src/utils/pda.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAyE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAGlH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,GAAG,OAAO,EACvB,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,GAChC,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,OAAO,EACxB,WAAW,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,OAAO,GACzB,OAAO,CAAC,OAAO,CAAC,CAiBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,cAAc,CAAC,EAAE,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"pda.d.ts","sourceRoot":"","sources":["../../../src/utils/pda.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAyE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAGlH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,GAAG,OAAO,EACvB,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,GAChC,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,OAAO,EACxB,WAAW,EAAE,OAAO,EACpB,gBAAgB,CAAC,EAAE,OAAO,GACzB,OAAO,CAAC,OAAO,CAAC,CAiBlB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,cAAc,CAAC,EAAE,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC,CAkBlB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,qBAAqB,CACzC,cAAc,CAAC,EAAE,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC,CAalB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Rpc, type GetAccountInfoApi, type Address, type MaybeAccount } from '@solana/kit';
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
/**
|
|
4
|
+
* SDK Helper utilities to reduce code duplication across instruction implementations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Creates an RPC connection from resolved addresses, with validation
|
|
8
|
+
*/
|
|
9
|
+
export declare function createRpcFromConfig(resolvedAddresses: {
|
|
10
|
+
rpcUrl?: string;
|
|
11
|
+
}, operationName: string): Rpc<GetAccountInfoApi>;
|
|
12
|
+
/**
|
|
13
|
+
* Derives the config PDA for the SRSLY program
|
|
14
|
+
*/
|
|
15
|
+
export declare function deriveConfigPda(programAddress: string | PublicKey): Promise<[Address, number]>;
|
|
16
|
+
/**
|
|
17
|
+
* Generic fetch function with validation and error handling
|
|
18
|
+
*/
|
|
19
|
+
export declare function fetchAccountWithValidation<T extends MaybeAccount<any, string>>(fetchFn: (rpc: Rpc<GetAccountInfoApi>, address: Address) => Promise<T>, rpc: Rpc<GetAccountInfoApi>, accountAddress: string | PublicKey, accountType: string): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* Batch fetch multiple accounts with proper error handling
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchMultipleAccounts<T extends Record<string, MaybeAccount<any, string>>>(fetchOperations: Array<{
|
|
24
|
+
fetchFn: (rpc: Rpc<GetAccountInfoApi>, address: Address) => Promise<MaybeAccount<any, string>>;
|
|
25
|
+
address: string | PublicKey;
|
|
26
|
+
accountType: string;
|
|
27
|
+
key: keyof T;
|
|
28
|
+
}>, rpc: Rpc<GetAccountInfoApi>): Promise<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Convert public key to address format used by the SDK
|
|
31
|
+
*/
|
|
32
|
+
export declare function toAddressString(key: string | PublicKey): string;
|
|
33
|
+
/**
|
|
34
|
+
* Derive all rental-related PDAs in one call
|
|
35
|
+
*/
|
|
36
|
+
export declare function deriveAllRentalPDAs(contract: string | PublicKey, borrower: string | PublicKey, programAddress: string | PublicKey, antegenProgramAddress: string | PublicKey): Promise<{
|
|
37
|
+
rentalState: [Address, number];
|
|
38
|
+
rentalAuthority: [Address, number];
|
|
39
|
+
rentalThread: [Address, number];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Standard error messages for common scenarios
|
|
43
|
+
*/
|
|
44
|
+
export declare const ErrorMessages: {
|
|
45
|
+
readonly rpcRequired: (operation: string) => string;
|
|
46
|
+
readonly accountNotFound: (type: string, address: string) => string;
|
|
47
|
+
readonly fetchFailed: (type: string, error: unknown) => string;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=sdk-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/sdk-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,GAAG,EAAE,KAAK,iBAAiB,EAAW,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1H,OAAO,EAAE,SAAS,EAAE,MAAM,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