@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
|
@@ -21,7 +21,6 @@ export interface ConfigOptions {
|
|
|
21
21
|
rpcUrl?: string;
|
|
22
22
|
library?: 'kit' | 'web3js';
|
|
23
23
|
PublicKey?: any;
|
|
24
|
-
connection?: any;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* Resolve program addresses based on configuration
|
|
@@ -35,7 +34,7 @@ export declare function resolveProgramAddresses(config: ConfigOptions): Promise<
|
|
|
35
34
|
antegenProgramAddress: any;
|
|
36
35
|
gameId: any;
|
|
37
36
|
atlasMint: any;
|
|
38
|
-
rpcUrl: string
|
|
37
|
+
rpcUrl: string;
|
|
39
38
|
}>;
|
|
40
39
|
/**
|
|
41
40
|
* Set global configuration options that will be used as defaults for all SDK operations
|
|
@@ -55,13 +54,12 @@ export declare function resolveProgramAddresses(config: ConfigOptions): Promise<
|
|
|
55
54
|
* gameId: 'custom-game-id...'
|
|
56
55
|
* });
|
|
57
56
|
*
|
|
58
|
-
* // Configure for web3js
|
|
59
|
-
* import {
|
|
60
|
-
* const connection = new Connection('https://api.mainnet-beta.solana.com');
|
|
57
|
+
* // Configure for web3js
|
|
58
|
+
* import { PublicKey } from '@solana/web3.js';
|
|
61
59
|
* setConfig({
|
|
62
60
|
* library: 'web3js',
|
|
63
61
|
* PublicKey,
|
|
64
|
-
*
|
|
62
|
+
* rpcUrl: 'https://api.mainnet-beta.solana.com'
|
|
65
63
|
* });
|
|
66
64
|
*
|
|
67
65
|
* // Can still override per instruction
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/utils/config.ts"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,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAQD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,aAAa;;;;;;;;GA4ClE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAErD;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAEzC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAGD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,CAE3E;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,GAAG,CAa3F;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAKpF;AAID;;;GAGG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;IACvD;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IAE/C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;CACrB;AAsCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,GAChD,cAAc,CAAC,CAAC,CAAC,CAcnB"}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { type Address } from '@solana/kit';
|
|
2
|
+
import { fetchContractState as fetchContractStateCodama, fetchRentalState as fetchRentalStateCodama } from '../codama/accounts';
|
|
2
3
|
/**
|
|
3
4
|
* Convenience wrapper functions for fetching account states with RPC URL strings.
|
|
4
5
|
* These functions handle creating the RPC connection for you.
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
|
-
* Fetches contract state data from the blockchain using
|
|
8
|
+
* Fetches contract state data from the blockchain using RPC URL from global config
|
|
9
|
+
*
|
|
10
|
+
* @param contractAddress - The contract account address to fetch (string or Address)
|
|
11
|
+
* @returns The deserialized contract state data
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Uses RPC URL from global config
|
|
16
|
+
* const contractState = await fetchContractState('ContractAddress123...');
|
|
17
|
+
* console.log('Contract owner:', contractState.data.owner);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchContractState<TAddress extends string = string>(contractAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchContractStateCodama>>;
|
|
21
|
+
/**
|
|
22
|
+
* Fetches contract state data from the blockchain using a specific RPC URL
|
|
8
23
|
*
|
|
9
24
|
* @param rpcUrl - The RPC endpoint URL as a string
|
|
10
|
-
* @param contractAddress - The contract account address to fetch
|
|
25
|
+
* @param contractAddress - The contract account address to fetch (string or Address)
|
|
11
26
|
* @returns The deserialized contract state data
|
|
12
27
|
*
|
|
13
28
|
* @example
|
|
@@ -21,12 +36,26 @@ import { type Address } from '@solana/kit';
|
|
|
21
36
|
* console.log('Contract rate:', contractState.data.rate);
|
|
22
37
|
* ```
|
|
23
38
|
*/
|
|
24
|
-
export declare function fetchContractState<TAddress extends string = string>(rpcUrl: string, contractAddress: Address<TAddress>): Promise<
|
|
39
|
+
export declare function fetchContractState<TAddress extends string = string>(rpcUrl: string, contractAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchContractStateCodama>>;
|
|
40
|
+
/**
|
|
41
|
+
* Fetches rental state data from the blockchain using RPC URL from global config
|
|
42
|
+
*
|
|
43
|
+
* @param rentalAddress - The rental account address to fetch (string or Address)
|
|
44
|
+
* @returns The deserialized rental state data
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Uses RPC URL from global config
|
|
49
|
+
* const rentalState = await fetchRentalState('RentalAddress123...');
|
|
50
|
+
* console.log('Rental borrower:', rentalState.data.borrower);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function fetchRentalState<TAddress extends string = string>(rentalAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchRentalStateCodama>>;
|
|
25
54
|
/**
|
|
26
|
-
* Fetches rental state data from the blockchain using a
|
|
55
|
+
* Fetches rental state data from the blockchain using a specific RPC URL
|
|
27
56
|
*
|
|
28
57
|
* @param rpcUrl - The RPC endpoint URL as a string
|
|
29
|
-
* @param rentalAddress - The rental account address to fetch
|
|
58
|
+
* @param rentalAddress - The rental account address to fetch (string or Address)
|
|
30
59
|
* @returns The deserialized rental state data
|
|
31
60
|
*
|
|
32
61
|
* @example
|
|
@@ -40,7 +69,7 @@ export declare function fetchContractState<TAddress extends string = string>(rpc
|
|
|
40
69
|
* console.log('Rental start:', rentalState.data.start);
|
|
41
70
|
* ```
|
|
42
71
|
*/
|
|
43
|
-
export declare function fetchRentalState<TAddress extends string = string>(rpcUrl: string, rentalAddress: Address<TAddress>): Promise<
|
|
72
|
+
export declare function fetchRentalState<TAddress extends string = string>(rpcUrl: string, rentalAddress: string | Address<TAddress>): Promise<ReturnType<typeof fetchRentalStateCodama>>;
|
|
44
73
|
/**
|
|
45
74
|
* Fetches multiple contract states in a single RPC call
|
|
46
75
|
*
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"fetch-accounts.d.ts","sourceRoot":"","sources":["../../../src/utils/fetch-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK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BG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAC9E,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,sFAOrC"}
|
|
@@ -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"}
|
|
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"}
|
|
@@ -83,17 +83,15 @@ export interface FluentInstruction {
|
|
|
83
83
|
kit(): KitInstruction;
|
|
84
84
|
/**
|
|
85
85
|
* Convert instruction to @solana/web3.js format with string addresses
|
|
86
|
-
* @param connection Optional Connection object (not used by FluentInstruction but kept for API consistency)
|
|
87
86
|
* @returns Instruction in @solana/web3.js format with string pubkeys
|
|
88
87
|
*/
|
|
89
|
-
web3js(
|
|
88
|
+
web3js(): Web3jsInstructionWithStrings;
|
|
90
89
|
/**
|
|
91
90
|
* Convert instruction to @solana/web3.js format with PublicKey instances
|
|
92
91
|
* @param PublicKey Constructor for creating PublicKey instances (cleaner API than PublicKeyConstructor)
|
|
93
|
-
* @param connection Optional Connection object (not used by FluentInstruction but kept for API consistency)
|
|
94
92
|
* @returns Instruction in @solana/web3.js format with PublicKey instances
|
|
95
93
|
*/
|
|
96
|
-
web3js<TPublicKey>(PublicKey: PublicKeyConstructor<TPublicKey
|
|
94
|
+
web3js<TPublicKey>(PublicKey: PublicKeyConstructor<TPublicKey>): Web3jsInstructionWithPublicKeys<TPublicKey>;
|
|
97
95
|
}
|
|
98
96
|
/**
|
|
99
97
|
* Fluent config selector that adds format conversion methods
|
|
@@ -103,17 +101,15 @@ export interface FluentInstruction {
|
|
|
103
101
|
export interface FluentConfigSelector<T extends FluentInstruction> extends ConfigSelector<T> {
|
|
104
102
|
/**
|
|
105
103
|
* Convert instruction to @solana/web3.js format with string addresses
|
|
106
|
-
* @param connection Optional Connection object for account fetching during instruction building
|
|
107
104
|
* @returns Promise that resolves to Web3jsInstructionWithStrings
|
|
108
105
|
*/
|
|
109
|
-
web3js(
|
|
106
|
+
web3js(): Promise<Web3jsInstructionWithStrings>;
|
|
110
107
|
/**
|
|
111
108
|
* Convert instruction to @solana/web3.js format with PublicKey instances
|
|
112
109
|
* @param PublicKey Constructor for creating PublicKey instances (cleaner API than PublicKeyConstructor)
|
|
113
|
-
* @param connection Optional Connection object for account fetching during instruction building
|
|
114
110
|
* @returns Promise that resolves to Web3jsInstructionWithPublicKeys
|
|
115
111
|
*/
|
|
116
|
-
web3js<TPublicKey>(PublicKey: PublicKeyConstructor<TPublicKey
|
|
112
|
+
web3js<TPublicKey>(PublicKey: PublicKeyConstructor<TPublicKey>): Promise<Web3jsInstructionWithPublicKeys<TPublicKey>>;
|
|
117
113
|
}
|
|
118
114
|
/**
|
|
119
115
|
* Smart fluent config selector that returns different types based on library configuration
|
|
@@ -139,17 +135,15 @@ export interface SmartFluentConfigSelector<T extends FluentInstruction> extends
|
|
|
139
135
|
kit(): Promise<KitInstruction>;
|
|
140
136
|
/**
|
|
141
137
|
* Convert instruction to @solana/web3.js format with string addresses
|
|
142
|
-
* @param connection Optional Connection object for account fetching during instruction building
|
|
143
138
|
* @returns Promise that resolves to Web3jsInstructionWithStrings
|
|
144
139
|
*/
|
|
145
|
-
web3js(
|
|
140
|
+
web3js(): Promise<Web3jsInstructionWithStrings>;
|
|
146
141
|
/**
|
|
147
142
|
* Convert instruction to @solana/web3.js format with PublicKey instances
|
|
148
143
|
* @param PublicKey Constructor for creating PublicKey instances (cleaner API than PublicKeyConstructor)
|
|
149
|
-
* @param connection Optional Connection object for account fetching during instruction building
|
|
150
144
|
* @returns Promise that resolves to Web3jsInstructionWithPublicKeys
|
|
151
145
|
*/
|
|
152
|
-
web3js<TPublicKey>(PublicKey: PublicKeyConstructor<TPublicKey
|
|
146
|
+
web3js<TPublicKey>(PublicKey: PublicKeyConstructor<TPublicKey>): Promise<Web3jsInstructionWithPublicKeys<TPublicKey>>;
|
|
153
147
|
}
|
|
154
148
|
/**
|
|
155
149
|
* Create a fluent instruction from a kit instruction using non-polluting design
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-converter.d.ts","sourceRoot":"","sources":["../../../src/utils/instruction-converter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAsB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEnG;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,KAAK,CAAC;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,+BAA+B,CAAC,UAAU,GAAG,GAAG;IAC/D,IAAI,EAAE,KAAK,CAAC;QACV,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;IACH,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,UAAU,GAAG,MAAM,IAAI,UAAU,SAAS,MAAM,GAC1E,4BAA4B,GAC5B,+BAA+B,CAAC,UAAU,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,WAAW,EAAE,cAAc,CAAC;IAE5B;;;OAGG;IACH,GAAG,IAAI,cAAc,CAAC;IAEtB
|
|
1
|
+
{"version":3,"file":"instruction-converter.d.ts","sourceRoot":"","sources":["../../../src/utils/instruction-converter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAsB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEnG;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,KAAK,CAAC;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB,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C,CAAC,CAAC;CACvH;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,iBAAiB,CAAE,SAAQ,cAAc,CAAC,GAAG,CAAC;IACjG;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAE1D;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IAEpB;;;OAGG;IACH,GAAG,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IAE/B;;;OAGG;IACH,MAAM,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAEhD;;;;OAIG;IACH,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC,CAAC;CACvH;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,cAAc,GAAG,iBAAiB,CAsCzF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,iBAAiB,EACpE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,GAC9B,oBAAoB,CAAC,CAAC,CAAC,CAgBzB;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,iBAAiB,EACzE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,GAC9B,yBAAyB,CAAC,CAAC,CAAC,CAiD9B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal signer handling utilities for cross-library compatibility
|
|
3
|
+
*
|
|
4
|
+
* 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 { type TransactionSigner } from '@solana/kit';
|
|
8
|
+
/**
|
|
9
|
+
* Enhanced UniversalSigner type that accepts both signer objects and address strings
|
|
10
|
+
*/
|
|
11
|
+
export type UniversalSigner = string | {
|
|
12
|
+
address: string;
|
|
13
|
+
} | {
|
|
14
|
+
publicKey: {
|
|
15
|
+
toString(): string;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
publicKey: string;
|
|
19
|
+
} | any;
|
|
20
|
+
/**
|
|
21
|
+
* Creates TransactionSigner from UniversalSigner input for universal compatibility
|
|
22
|
+
*
|
|
23
|
+
* This function provides universal compatibility by:
|
|
24
|
+
* - Converting string addresses to TransactionSigner using createNoopSigner
|
|
25
|
+
* - Passing through existing TransactionSigner objects unchanged
|
|
26
|
+
* - Safely handling different signer interfaces (kit, web3.js, etc.)
|
|
27
|
+
*
|
|
28
|
+
* The returned TransactionSigner has both .address property and signing capability,
|
|
29
|
+
* making it suitable for both PDA derivation and codama instruction building.
|
|
30
|
+
*
|
|
31
|
+
* @param signer - The signer input (string address or signer object)
|
|
32
|
+
* @returns TransactionSigner that can be used directly for codama and has .address property
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // Browser usage with string address
|
|
37
|
+
* const borrower = createTransactionSigner("base58AddressString");
|
|
38
|
+
* // borrower.address → Address object for PDA derivation
|
|
39
|
+
* // borrower → TransactionSigner for codama
|
|
40
|
+
*
|
|
41
|
+
* // CLI usage with wallet object
|
|
42
|
+
* const borrower = createTransactionSigner(wallet);
|
|
43
|
+
* // borrower.address → wallet.address for PDA derivation
|
|
44
|
+
* // borrower → wallet signer for codama
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function createTransactionSigner(signer: UniversalSigner): TransactionSigner;
|
|
48
|
+
/**
|
|
49
|
+
* Type guard to check if a value is a signer object (not a string)
|
|
50
|
+
*/
|
|
51
|
+
export declare function isSignerObject(signer: UniversalSigner): signer is Exclude<UniversalSigner, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Type guard to check if a value is an address string
|
|
54
|
+
*/
|
|
55
|
+
export declare function isAddressString(signer: UniversalSigner): signer is string;
|
|
56
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../src/utils/signer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhF;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,SAAS,EAAE;QAAE,QAAQ,IAAI,MAAM,CAAA;KAAE,CAAA;CAAE,GACrC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACrB,GAAG,CAAC;AAGR;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,iBAAiB,CASlF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,IAAI,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAElG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,IAAI,MAAM,CAEzE"}
|