@farcaster/frame-core 0.0.33 → 0.0.35
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/actions/ComposeCast.d.ts +1 -1
- package/dist/actions/SendToken.d.ts +48 -0
- package/dist/actions/SignIn.d.ts +14 -0
- package/dist/actions/{Swap.d.ts → SwapToken.d.ts} +8 -8
- package/dist/actions/SwapToken.js +2 -0
- package/dist/actions/index.d.ts +2 -1
- package/dist/actions/index.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/solana.d.ts +51 -0
- package/dist/solana.js +13 -0
- package/dist/types.d.ts +8 -3
- package/esm/actions/ComposeCast.d.ts +1 -1
- package/esm/actions/SendToken.d.ts +48 -0
- package/esm/actions/SignIn.d.ts +14 -0
- package/esm/actions/{Swap.d.ts → SwapToken.d.ts} +8 -8
- package/esm/actions/SwapToken.js +1 -0
- package/esm/actions/index.d.ts +2 -1
- package/esm/actions/index.js +2 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/solana.d.ts +51 -0
- package/esm/solana.js +9 -0
- package/esm/tsconfig.tsbuildinfo +1 -1
- package/esm/types.d.ts +8 -3
- package/package.json +2 -1
- package/src/actions/ComposeCast.ts +1 -1
- package/src/actions/SendToken.ts +57 -0
- package/src/actions/SignIn.ts +16 -0
- package/src/actions/{Swap.ts → SwapToken.ts} +8 -8
- package/src/actions/index.ts +2 -1
- package/src/index.ts +1 -0
- package/src/solana.ts +82 -0
- package/src/types.ts +9 -3
- /package/dist/actions/{Swap.js → SendToken.js} +0 -0
- /package/esm/actions/{Swap.js → SendToken.js} +0 -0
|
@@ -2,7 +2,7 @@ export type Options<close extends boolean | undefined = undefined> = {
|
|
|
2
2
|
/**
|
|
3
3
|
* Suggested text for the body of the cast.
|
|
4
4
|
*
|
|
5
|
-
* Mentions can be included using the human-
|
|
5
|
+
* Mentions can be included using the human-writable form (e.g. @farcaster).
|
|
6
6
|
**/
|
|
7
7
|
text?: string;
|
|
8
8
|
/** Suggested embeds. Max two. */
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type SendTokenOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* CAIP-19 asset ID
|
|
4
|
+
* For example, Base USDC:
|
|
5
|
+
* eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
6
|
+
*/
|
|
7
|
+
token?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Token amount, as numeric string.
|
|
10
|
+
* For example, 10 USDC: 1000000
|
|
11
|
+
*/
|
|
12
|
+
amount?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Recipient address.
|
|
15
|
+
*/
|
|
16
|
+
recipientAddress?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Recipient fid.
|
|
19
|
+
*/
|
|
20
|
+
recipientFid?: number;
|
|
21
|
+
};
|
|
22
|
+
type SendTokenDetails = {
|
|
23
|
+
/**
|
|
24
|
+
* Tx identifier.
|
|
25
|
+
*/
|
|
26
|
+
transaction: `0x${string}`;
|
|
27
|
+
};
|
|
28
|
+
type SendTokenErrorDetails = {
|
|
29
|
+
/**
|
|
30
|
+
* Error code.
|
|
31
|
+
*/
|
|
32
|
+
error: string;
|
|
33
|
+
/**
|
|
34
|
+
* Error message.
|
|
35
|
+
*/
|
|
36
|
+
message?: string;
|
|
37
|
+
};
|
|
38
|
+
export type SendTokenErrorReason = 'rejected_by_user' | 'send_failed';
|
|
39
|
+
export type SendTokenResult = {
|
|
40
|
+
success: true;
|
|
41
|
+
send: SendTokenDetails;
|
|
42
|
+
} | {
|
|
43
|
+
success: false;
|
|
44
|
+
reason: SendTokenErrorReason;
|
|
45
|
+
error?: SendTokenErrorDetails;
|
|
46
|
+
};
|
|
47
|
+
export type SendToken = (options: SendTokenOptions) => Promise<SendTokenResult>;
|
|
48
|
+
export {};
|
package/dist/actions/SignIn.d.ts
CHANGED
|
@@ -15,10 +15,24 @@ export type SignInOptions = {
|
|
|
15
15
|
* ISO 8601 datetime.
|
|
16
16
|
*/
|
|
17
17
|
expirationTime?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether an [Auth
|
|
20
|
+
* Address](https://github.com/farcasterxyz/protocol/discussions/225) signed
|
|
21
|
+
* message is acceptable. Defaults to `false` to maintain backwards
|
|
22
|
+
* compatibility, though applications should set this to `true` for the best
|
|
23
|
+
* user experience assuming their verification method supports it.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
acceptAuthAddress?: boolean;
|
|
18
28
|
};
|
|
19
29
|
export type SignInResult = {
|
|
20
30
|
signature: string;
|
|
21
31
|
message: string;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates if the signature was produced by a custody or auth address.
|
|
34
|
+
*/
|
|
35
|
+
authMethod: 'custody' | 'authAddress';
|
|
22
36
|
};
|
|
23
37
|
export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
|
|
24
38
|
type RejectedByUserJsonError = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type SwapTokenOptions = {
|
|
2
2
|
/**
|
|
3
3
|
* CAIP-19 asset ID
|
|
4
4
|
* For example, Base USDC:
|
|
@@ -12,18 +12,18 @@ export type SwapOptions = {
|
|
|
12
12
|
buyToken?: string;
|
|
13
13
|
/**
|
|
14
14
|
* Sell token amount, as numeric string.
|
|
15
|
-
* For example,
|
|
15
|
+
* For example, 1 USDC: 1000000
|
|
16
16
|
*/
|
|
17
17
|
sellAmount?: string;
|
|
18
18
|
};
|
|
19
|
-
type
|
|
19
|
+
type SwapTokenDetails = {
|
|
20
20
|
/**
|
|
21
21
|
* Array of tx identifiers in order of execution.
|
|
22
22
|
* Some swaps will have both an approval and swap tx.
|
|
23
23
|
*/
|
|
24
24
|
transactions: `0x${string}`[];
|
|
25
25
|
};
|
|
26
|
-
type
|
|
26
|
+
type SwapTokenErrorDetails = {
|
|
27
27
|
/**
|
|
28
28
|
* Error code.
|
|
29
29
|
*/
|
|
@@ -34,13 +34,13 @@ type SwapErrorDetails = {
|
|
|
34
34
|
message?: string;
|
|
35
35
|
};
|
|
36
36
|
export type SwapErrorReason = 'rejected_by_user' | 'swap_failed';
|
|
37
|
-
export type
|
|
37
|
+
export type SwapTokenResult = {
|
|
38
38
|
success: true;
|
|
39
|
-
swap:
|
|
39
|
+
swap: SwapTokenDetails;
|
|
40
40
|
} | {
|
|
41
41
|
success: false;
|
|
42
42
|
reason: SwapErrorReason;
|
|
43
|
-
error?:
|
|
43
|
+
error?: SwapTokenErrorDetails;
|
|
44
44
|
};
|
|
45
|
-
export type
|
|
45
|
+
export type SwapToken = (options: SwapTokenOptions) => Promise<SwapTokenResult>;
|
|
46
46
|
export {};
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * as AddFrame from './AddFrame';
|
|
|
2
2
|
export * as ComposeCast from './ComposeCast';
|
|
3
3
|
export * as Ready from './Ready';
|
|
4
4
|
export * as SignIn from './SignIn';
|
|
5
|
-
export * as
|
|
5
|
+
export * as SendToken from './SendToken';
|
|
6
|
+
export * as SwapToken from './SwapToken';
|
|
6
7
|
export * as ViewProfile from './ViewProfile';
|
|
7
8
|
export * as ViewToken from './ViewToken';
|
package/dist/actions/index.js
CHANGED
|
@@ -33,11 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.ViewToken = exports.ViewProfile = exports.
|
|
36
|
+
exports.ViewToken = exports.ViewProfile = exports.SwapToken = exports.SendToken = exports.SignIn = exports.Ready = exports.ComposeCast = exports.AddFrame = void 0;
|
|
37
37
|
exports.AddFrame = __importStar(require("./AddFrame"));
|
|
38
38
|
exports.ComposeCast = __importStar(require("./ComposeCast"));
|
|
39
39
|
exports.Ready = __importStar(require("./Ready"));
|
|
40
40
|
exports.SignIn = __importStar(require("./SignIn"));
|
|
41
|
-
exports.
|
|
41
|
+
exports.SendToken = __importStar(require("./SendToken"));
|
|
42
|
+
exports.SwapToken = __importStar(require("./SwapToken"));
|
|
42
43
|
exports.ViewProfile = __importStar(require("./ViewProfile"));
|
|
43
44
|
exports.ViewToken = __importStar(require("./ViewToken"));
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/solana.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Connection as SolanaConnection, SendOptions as SolanaSendOptions, Transaction as SolanaTransaction, VersionedTransaction as SolanaVersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
export type { SolanaConnection };
|
|
3
|
+
export type SolanaCombinedTransaction = SolanaTransaction | SolanaVersionedTransaction;
|
|
4
|
+
export type SolanaConnectRequestArguments = {
|
|
5
|
+
method: 'connect';
|
|
6
|
+
};
|
|
7
|
+
export type SolanaSignMessageRequestArguments = {
|
|
8
|
+
method: 'signMessage';
|
|
9
|
+
params: {
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type SolanaSignAndSendTransactionRequestArguments = {
|
|
14
|
+
method: 'signAndSendTransaction';
|
|
15
|
+
params: {
|
|
16
|
+
transaction: SolanaCombinedTransaction;
|
|
17
|
+
connection: SolanaConnection;
|
|
18
|
+
options?: SolanaSendOptions;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type SolanaSignTransactionRequestArguments<T extends SolanaCombinedTransaction = SolanaTransaction> = {
|
|
22
|
+
method: 'signTransaction';
|
|
23
|
+
params: {
|
|
24
|
+
transaction: T;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type SolanaRequestFn = ((request: SolanaConnectRequestArguments) => Promise<{
|
|
28
|
+
publicKey: string;
|
|
29
|
+
}>) & ((request: SolanaSignMessageRequestArguments) => Promise<{
|
|
30
|
+
signature: string;
|
|
31
|
+
}>) & ((request: SolanaSignAndSendTransactionRequestArguments) => Promise<{
|
|
32
|
+
signature: string;
|
|
33
|
+
}>) & (<T extends SolanaCombinedTransaction>(request: SolanaSignTransactionRequestArguments<T>) => Promise<{
|
|
34
|
+
signedTransaction: T;
|
|
35
|
+
}>);
|
|
36
|
+
export interface SolanaWalletProvider {
|
|
37
|
+
request: SolanaRequestFn;
|
|
38
|
+
signMessage(message: string): Promise<{
|
|
39
|
+
signature: string;
|
|
40
|
+
}>;
|
|
41
|
+
signTransaction<T extends SolanaCombinedTransaction>(transaction: T): Promise<{
|
|
42
|
+
signedTransaction: T;
|
|
43
|
+
}>;
|
|
44
|
+
signAndSendTransaction(input: {
|
|
45
|
+
transaction: SolanaCombinedTransaction;
|
|
46
|
+
connection: SolanaConnection;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
signature: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
export declare const createSolanaWalletProvider: (request: SolanaRequestFn) => SolanaWalletProvider;
|
package/dist/solana.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSolanaWalletProvider = void 0;
|
|
4
|
+
const createSolanaWalletProvider = (request) => ({
|
|
5
|
+
request,
|
|
6
|
+
signMessage: (msg) => request({ method: 'signMessage', params: { message: msg } }),
|
|
7
|
+
signTransaction: (transaction) => request({ method: 'signTransaction', params: { transaction } }),
|
|
8
|
+
signAndSendTransaction: (input) => request({
|
|
9
|
+
method: 'signAndSendTransaction',
|
|
10
|
+
params: input,
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
exports.createSolanaWalletProvider = createSolanaWalletProvider;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AddFrame, ComposeCast, Ready, SignIn,
|
|
1
|
+
import type { AddFrame, ComposeCast, Ready, SendToken, SignIn, SwapToken, ViewProfile, ViewToken } from './actions';
|
|
2
2
|
import type { FrameContext } from './context';
|
|
3
3
|
import type { EventFrameAdded, EventFrameRemoved, EventNotificationsDisabled, EventNotificationsEnabled } from './schemas';
|
|
4
|
+
import type { SolanaRequestFn } from './solana';
|
|
4
5
|
import type { Ethereum } from './wallet';
|
|
5
6
|
export type SetPrimaryButtonOptions = {
|
|
6
7
|
text: string;
|
|
@@ -22,10 +23,12 @@ export type WireFrameHost = {
|
|
|
22
23
|
ethProviderRequest: Ethereum.EthProvideRequest;
|
|
23
24
|
ethProviderRequestV2: Ethereum.RpcTransport;
|
|
24
25
|
eip6963RequestProvider: () => void;
|
|
26
|
+
solanaProviderRequest?: SolanaRequestFn;
|
|
25
27
|
addFrame: AddFrame.WireAddFrame;
|
|
26
28
|
viewProfile: ViewProfile.ViewProfile;
|
|
27
29
|
viewToken: ViewToken.ViewToken;
|
|
28
|
-
|
|
30
|
+
sendToken: SendToken.SendToken;
|
|
31
|
+
swapToken: SwapToken.SwapToken;
|
|
29
32
|
composeCast: <close extends boolean | undefined = undefined>(options: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
|
|
30
33
|
};
|
|
31
34
|
export type FrameHost = {
|
|
@@ -42,10 +45,12 @@ export type FrameHost = {
|
|
|
42
45
|
* Hosts must emit an EventEip6963AnnounceProvider in response.
|
|
43
46
|
*/
|
|
44
47
|
eip6963RequestProvider: () => void;
|
|
48
|
+
solanaProviderRequest?: SolanaRequestFn;
|
|
45
49
|
addFrame: AddFrame.AddFrame;
|
|
46
50
|
viewProfile: ViewProfile.ViewProfile;
|
|
47
51
|
viewToken: ViewToken.ViewToken;
|
|
48
|
-
|
|
52
|
+
sendToken: SendToken.SendToken;
|
|
53
|
+
swapToken: SwapToken.SwapToken;
|
|
49
54
|
composeCast: <close extends boolean | undefined = undefined>(options: ComposeCast.Options<close>) => Promise<ComposeCast.Result<close>>;
|
|
50
55
|
};
|
|
51
56
|
export type EventFrameAddRejected = {
|
|
@@ -2,7 +2,7 @@ export type Options<close extends boolean | undefined = undefined> = {
|
|
|
2
2
|
/**
|
|
3
3
|
* Suggested text for the body of the cast.
|
|
4
4
|
*
|
|
5
|
-
* Mentions can be included using the human-
|
|
5
|
+
* Mentions can be included using the human-writable form (e.g. @farcaster).
|
|
6
6
|
**/
|
|
7
7
|
text?: string;
|
|
8
8
|
/** Suggested embeds. Max two. */
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type SendTokenOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* CAIP-19 asset ID
|
|
4
|
+
* For example, Base USDC:
|
|
5
|
+
* eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
6
|
+
*/
|
|
7
|
+
token?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Token amount, as numeric string.
|
|
10
|
+
* For example, 10 USDC: 1000000
|
|
11
|
+
*/
|
|
12
|
+
amount?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Recipient address.
|
|
15
|
+
*/
|
|
16
|
+
recipientAddress?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Recipient fid.
|
|
19
|
+
*/
|
|
20
|
+
recipientFid?: number;
|
|
21
|
+
};
|
|
22
|
+
type SendTokenDetails = {
|
|
23
|
+
/**
|
|
24
|
+
* Tx identifier.
|
|
25
|
+
*/
|
|
26
|
+
transaction: `0x${string}`;
|
|
27
|
+
};
|
|
28
|
+
type SendTokenErrorDetails = {
|
|
29
|
+
/**
|
|
30
|
+
* Error code.
|
|
31
|
+
*/
|
|
32
|
+
error: string;
|
|
33
|
+
/**
|
|
34
|
+
* Error message.
|
|
35
|
+
*/
|
|
36
|
+
message?: string;
|
|
37
|
+
};
|
|
38
|
+
export type SendTokenErrorReason = 'rejected_by_user' | 'send_failed';
|
|
39
|
+
export type SendTokenResult = {
|
|
40
|
+
success: true;
|
|
41
|
+
send: SendTokenDetails;
|
|
42
|
+
} | {
|
|
43
|
+
success: false;
|
|
44
|
+
reason: SendTokenErrorReason;
|
|
45
|
+
error?: SendTokenErrorDetails;
|
|
46
|
+
};
|
|
47
|
+
export type SendToken = (options: SendTokenOptions) => Promise<SendTokenResult>;
|
|
48
|
+
export {};
|
package/esm/actions/SignIn.d.ts
CHANGED
|
@@ -15,10 +15,24 @@ export type SignInOptions = {
|
|
|
15
15
|
* ISO 8601 datetime.
|
|
16
16
|
*/
|
|
17
17
|
expirationTime?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether an [Auth
|
|
20
|
+
* Address](https://github.com/farcasterxyz/protocol/discussions/225) signed
|
|
21
|
+
* message is acceptable. Defaults to `false` to maintain backwards
|
|
22
|
+
* compatibility, though applications should set this to `true` for the best
|
|
23
|
+
* user experience assuming their verification method supports it.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
acceptAuthAddress?: boolean;
|
|
18
28
|
};
|
|
19
29
|
export type SignInResult = {
|
|
20
30
|
signature: string;
|
|
21
31
|
message: string;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates if the signature was produced by a custody or auth address.
|
|
34
|
+
*/
|
|
35
|
+
authMethod: 'custody' | 'authAddress';
|
|
22
36
|
};
|
|
23
37
|
export type SignIn = (options: SignInOptions) => Promise<SignInResult>;
|
|
24
38
|
type RejectedByUserJsonError = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type SwapTokenOptions = {
|
|
2
2
|
/**
|
|
3
3
|
* CAIP-19 asset ID
|
|
4
4
|
* For example, Base USDC:
|
|
@@ -12,18 +12,18 @@ export type SwapOptions = {
|
|
|
12
12
|
buyToken?: string;
|
|
13
13
|
/**
|
|
14
14
|
* Sell token amount, as numeric string.
|
|
15
|
-
* For example,
|
|
15
|
+
* For example, 1 USDC: 1000000
|
|
16
16
|
*/
|
|
17
17
|
sellAmount?: string;
|
|
18
18
|
};
|
|
19
|
-
type
|
|
19
|
+
type SwapTokenDetails = {
|
|
20
20
|
/**
|
|
21
21
|
* Array of tx identifiers in order of execution.
|
|
22
22
|
* Some swaps will have both an approval and swap tx.
|
|
23
23
|
*/
|
|
24
24
|
transactions: `0x${string}`[];
|
|
25
25
|
};
|
|
26
|
-
type
|
|
26
|
+
type SwapTokenErrorDetails = {
|
|
27
27
|
/**
|
|
28
28
|
* Error code.
|
|
29
29
|
*/
|
|
@@ -34,13 +34,13 @@ type SwapErrorDetails = {
|
|
|
34
34
|
message?: string;
|
|
35
35
|
};
|
|
36
36
|
export type SwapErrorReason = 'rejected_by_user' | 'swap_failed';
|
|
37
|
-
export type
|
|
37
|
+
export type SwapTokenResult = {
|
|
38
38
|
success: true;
|
|
39
|
-
swap:
|
|
39
|
+
swap: SwapTokenDetails;
|
|
40
40
|
} | {
|
|
41
41
|
success: false;
|
|
42
42
|
reason: SwapErrorReason;
|
|
43
|
-
error?:
|
|
43
|
+
error?: SwapTokenErrorDetails;
|
|
44
44
|
};
|
|
45
|
-
export type
|
|
45
|
+
export type SwapToken = (options: SwapTokenOptions) => Promise<SwapTokenResult>;
|
|
46
46
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/actions/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * as AddFrame from './AddFrame';
|
|
|
2
2
|
export * as ComposeCast from './ComposeCast';
|
|
3
3
|
export * as Ready from './Ready';
|
|
4
4
|
export * as SignIn from './SignIn';
|
|
5
|
-
export * as
|
|
5
|
+
export * as SendToken from './SendToken';
|
|
6
|
+
export * as SwapToken from './SwapToken';
|
|
6
7
|
export * as ViewProfile from './ViewProfile';
|
|
7
8
|
export * as ViewToken from './ViewToken';
|
package/esm/actions/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * as AddFrame from './AddFrame';
|
|
|
2
2
|
export * as ComposeCast from './ComposeCast';
|
|
3
3
|
export * as Ready from './Ready';
|
|
4
4
|
export * as SignIn from './SignIn';
|
|
5
|
-
export * as
|
|
5
|
+
export * as SendToken from './SendToken';
|
|
6
|
+
export * as SwapToken from './SwapToken';
|
|
6
7
|
export * as ViewProfile from './ViewProfile';
|
|
7
8
|
export * as ViewToken from './ViewToken';
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
package/esm/solana.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Connection as SolanaConnection, SendOptions as SolanaSendOptions, Transaction as SolanaTransaction, VersionedTransaction as SolanaVersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
export type { SolanaConnection };
|
|
3
|
+
export type SolanaCombinedTransaction = SolanaTransaction | SolanaVersionedTransaction;
|
|
4
|
+
export type SolanaConnectRequestArguments = {
|
|
5
|
+
method: 'connect';
|
|
6
|
+
};
|
|
7
|
+
export type SolanaSignMessageRequestArguments = {
|
|
8
|
+
method: 'signMessage';
|
|
9
|
+
params: {
|
|
10
|
+
message: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type SolanaSignAndSendTransactionRequestArguments = {
|
|
14
|
+
method: 'signAndSendTransaction';
|
|
15
|
+
params: {
|
|
16
|
+
transaction: SolanaCombinedTransaction;
|
|
17
|
+
connection: SolanaConnection;
|
|
18
|
+
options?: SolanaSendOptions;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type SolanaSignTransactionRequestArguments<T extends SolanaCombinedTransaction = SolanaTransaction> = {
|
|
22
|
+
method: 'signTransaction';
|
|
23
|
+
params: {
|
|
24
|
+
transaction: T;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type SolanaRequestFn = ((request: SolanaConnectRequestArguments) => Promise<{
|
|
28
|
+
publicKey: string;
|
|
29
|
+
}>) & ((request: SolanaSignMessageRequestArguments) => Promise<{
|
|
30
|
+
signature: string;
|
|
31
|
+
}>) & ((request: SolanaSignAndSendTransactionRequestArguments) => Promise<{
|
|
32
|
+
signature: string;
|
|
33
|
+
}>) & (<T extends SolanaCombinedTransaction>(request: SolanaSignTransactionRequestArguments<T>) => Promise<{
|
|
34
|
+
signedTransaction: T;
|
|
35
|
+
}>);
|
|
36
|
+
export interface SolanaWalletProvider {
|
|
37
|
+
request: SolanaRequestFn;
|
|
38
|
+
signMessage(message: string): Promise<{
|
|
39
|
+
signature: string;
|
|
40
|
+
}>;
|
|
41
|
+
signTransaction<T extends SolanaCombinedTransaction>(transaction: T): Promise<{
|
|
42
|
+
signedTransaction: T;
|
|
43
|
+
}>;
|
|
44
|
+
signAndSendTransaction(input: {
|
|
45
|
+
transaction: SolanaCombinedTransaction;
|
|
46
|
+
connection: SolanaConnection;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
signature: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
export declare const createSolanaWalletProvider: (request: SolanaRequestFn) => SolanaWalletProvider;
|
package/esm/solana.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const createSolanaWalletProvider = (request) => ({
|
|
2
|
+
request,
|
|
3
|
+
signMessage: (msg) => request({ method: 'signMessage', params: { message: msg } }),
|
|
4
|
+
signTransaction: (transaction) => request({ method: 'signTransaction', params: { transaction } }),
|
|
5
|
+
signAndSendTransaction: (input) => request({
|
|
6
|
+
method: 'signAndSendTransaction',
|
|
7
|
+
params: input,
|
|
8
|
+
}),
|
|
9
|
+
});
|