@solana-mobile/mobile-wallet-adapter-protocol 0.0.1-alpha.0
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/LICENSE +13 -0
- package/lib/cjs/index.browser.js +479 -0
- package/lib/cjs/index.js +479 -0
- package/lib/cjs/package.json +3 -0
- package/lib/esm/index.browser.mjs +466 -0
- package/lib/esm/index.mjs +466 -0
- package/lib/esm/package.json +3 -0
- package/lib/types/index.browser.d.mts +133 -0
- package/lib/types/index.browser.d.mts.map +1 -0
- package/lib/types/index.browser.d.ts +133 -0
- package/lib/types/index.browser.d.ts.map +1 -0
- package/lib/types/index.d.mts +133 -0
- package/lib/types/index.d.mts.map +1 -0
- package/lib/types/index.d.ts +133 -0
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties that wallets may present to users when an app
|
|
3
|
+
* asks for authorization to execute privileged methods (see
|
|
4
|
+
* {@link PrivilegedMethods}).
|
|
5
|
+
*/
|
|
6
|
+
type AppIdentity = Readonly<{
|
|
7
|
+
uri?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* An ephemeral elliptic-curve keypair on the P-256 curve.
|
|
13
|
+
* This public key is used to create the association token.
|
|
14
|
+
* The private key is used during session establishment.
|
|
15
|
+
*/
|
|
16
|
+
type AssociationKeypair = CryptoKeyPair;
|
|
17
|
+
/**
|
|
18
|
+
* The context returned from a wallet after having authorized a given
|
|
19
|
+
* account for use with a given application. You can cache this and
|
|
20
|
+
* use it later to invoke privileged methods.
|
|
21
|
+
*/
|
|
22
|
+
type AuthorizationResult = Readonly<{
|
|
23
|
+
authToken: string;
|
|
24
|
+
publicKey: string;
|
|
25
|
+
walletUriBase: string;
|
|
26
|
+
}>;
|
|
27
|
+
type AuthToken = string;
|
|
28
|
+
type Base58EncodedSignature = string;
|
|
29
|
+
type Base64EncodedMessage = string;
|
|
30
|
+
type Base64EncodedSignedMessage = string;
|
|
31
|
+
type Base64EncodedSignedTransaction = string;
|
|
32
|
+
type Base64EncodedTransaction = string;
|
|
33
|
+
interface MobileWallet {
|
|
34
|
+
(method: "authorize", params: {
|
|
35
|
+
identity: AppIdentity;
|
|
36
|
+
}): Promise<Readonly<{
|
|
37
|
+
auth_token: AuthToken;
|
|
38
|
+
pub_key: string;
|
|
39
|
+
wallet_uri_base: string;
|
|
40
|
+
}>>;
|
|
41
|
+
(method: "clone_authorization", params: {
|
|
42
|
+
auth_token: AuthToken;
|
|
43
|
+
}): Promise<Readonly<{
|
|
44
|
+
auth_token: AuthToken;
|
|
45
|
+
}>>;
|
|
46
|
+
(method: "deauthorize", params: {
|
|
47
|
+
auth_token: AuthToken;
|
|
48
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
49
|
+
(method: "reauthorize", params: {
|
|
50
|
+
auth_token: AuthToken;
|
|
51
|
+
}): Promise<Readonly<{
|
|
52
|
+
auth_token: AuthToken;
|
|
53
|
+
}>>;
|
|
54
|
+
(method: "sign_message", params: {
|
|
55
|
+
auth_token: AuthToken;
|
|
56
|
+
payloads: Base64EncodedMessage[];
|
|
57
|
+
}): Promise<Readonly<{
|
|
58
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
59
|
+
}>>;
|
|
60
|
+
(method: "sign_transaction", params: {
|
|
61
|
+
auth_token: AuthToken;
|
|
62
|
+
payloads: Base64EncodedTransaction[];
|
|
63
|
+
}): Promise<Readonly<{
|
|
64
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
65
|
+
}>>;
|
|
66
|
+
(method: "sign_and_send_transaction", params: {
|
|
67
|
+
auth_token: AuthToken;
|
|
68
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
69
|
+
payloads: Base64EncodedTransaction[];
|
|
70
|
+
}): Promise<Readonly<{
|
|
71
|
+
signatures: Base58EncodedSignature[];
|
|
72
|
+
}>>;
|
|
73
|
+
}
|
|
74
|
+
type Config = Readonly<{
|
|
75
|
+
baseUri?: string;
|
|
76
|
+
}>;
|
|
77
|
+
declare function withLocalWallet<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: Config): Promise<TReturn>;
|
|
78
|
+
declare class SolanaMobileWalletAdapterSecureContextRequiredError extends Error {
|
|
79
|
+
constructor();
|
|
80
|
+
}
|
|
81
|
+
declare class SolanaMobileWalletAdapterForbiddenWalletBaseURLError extends Error {
|
|
82
|
+
constructor();
|
|
83
|
+
}
|
|
84
|
+
declare class SolanaMobileWalletAdapterWalletNotInstalledError extends Error {
|
|
85
|
+
constructor();
|
|
86
|
+
}
|
|
87
|
+
declare class SolanaMobileWalletAdapterProtocolSessionEstablishmentError extends Error {
|
|
88
|
+
constructor(port: number);
|
|
89
|
+
}
|
|
90
|
+
declare class SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError extends Error {
|
|
91
|
+
constructor(port: number);
|
|
92
|
+
}
|
|
93
|
+
declare class SolanaMobileWalletAdapterProtocolSessionClosedError extends Error {
|
|
94
|
+
constructor(code: number, reason: string);
|
|
95
|
+
}
|
|
96
|
+
declare class SolanaMobileWalletAdapterProtocolReauthorizeError extends Error {
|
|
97
|
+
constructor();
|
|
98
|
+
}
|
|
99
|
+
type JSONRPCErrorCode = number;
|
|
100
|
+
// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
|
|
101
|
+
declare const SolanaMobileWalletAdapterProtocolError: {
|
|
102
|
+
readonly ERROR_REAUTHORIZE: -1;
|
|
103
|
+
readonly ERROR_AUTHORIZATION_FAILED: -2;
|
|
104
|
+
readonly ERROR_INVALID_PAYLOAD: -3;
|
|
105
|
+
readonly ERROR_NOT_SIGNED: -4;
|
|
106
|
+
readonly ERROR_NOT_COMMITTED: -5;
|
|
107
|
+
readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
|
|
108
|
+
};
|
|
109
|
+
type SolanaMobileWalletAdapterProtocolErrorEnum = (typeof SolanaMobileWalletAdapterProtocolError)[keyof typeof SolanaMobileWalletAdapterProtocolError];
|
|
110
|
+
type ErrorDataTypeMap = {
|
|
111
|
+
[SolanaMobileWalletAdapterProtocolError.ERROR_ATTEST_ORIGIN_ANDROID]: {
|
|
112
|
+
attest_origin_uri: string;
|
|
113
|
+
challenge: string;
|
|
114
|
+
context: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
declare class SolanaMobileWalletAdapterProtocolJsonRpcError<TErrorCode extends keyof ErrorDataTypeMap> extends Error {
|
|
118
|
+
data: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? ErrorDataTypeMap[TErrorCode] : undefined;
|
|
119
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode;
|
|
120
|
+
jsonRpcMessageId: number;
|
|
121
|
+
constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
|
|
122
|
+
jsonRpcMessageId: number,
|
|
123
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode,
|
|
124
|
+
message: string,
|
|
125
|
+
data: ErrorDataTypeMap[TErrorCode]
|
|
126
|
+
] : [
|
|
127
|
+
jsonRpcMessageId: number,
|
|
128
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode,
|
|
129
|
+
message: string
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
export { withLocalWallet, SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, MobileWallet };
|
|
133
|
+
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/createHelloReq.ts","../../src/errors.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/parseHelloRsp.ts","../../src/jsonRpcMessage.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/types.ts","../../src/withLocalWallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,2jBAA8B,CAA0B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties that wallets may present to users when an app
|
|
3
|
+
* asks for authorization to execute privileged methods (see
|
|
4
|
+
* {@link PrivilegedMethods}).
|
|
5
|
+
*/
|
|
6
|
+
type AppIdentity = Readonly<{
|
|
7
|
+
uri?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* An ephemeral elliptic-curve keypair on the P-256 curve.
|
|
13
|
+
* This public key is used to create the association token.
|
|
14
|
+
* The private key is used during session establishment.
|
|
15
|
+
*/
|
|
16
|
+
type AssociationKeypair = CryptoKeyPair;
|
|
17
|
+
/**
|
|
18
|
+
* The context returned from a wallet after having authorized a given
|
|
19
|
+
* account for use with a given application. You can cache this and
|
|
20
|
+
* use it later to invoke privileged methods.
|
|
21
|
+
*/
|
|
22
|
+
type AuthorizationResult = Readonly<{
|
|
23
|
+
authToken: string;
|
|
24
|
+
publicKey: string;
|
|
25
|
+
walletUriBase: string;
|
|
26
|
+
}>;
|
|
27
|
+
type AuthToken = string;
|
|
28
|
+
type Base58EncodedSignature = string;
|
|
29
|
+
type Base64EncodedMessage = string;
|
|
30
|
+
type Base64EncodedSignedMessage = string;
|
|
31
|
+
type Base64EncodedSignedTransaction = string;
|
|
32
|
+
type Base64EncodedTransaction = string;
|
|
33
|
+
interface MobileWallet {
|
|
34
|
+
(method: "authorize", params: {
|
|
35
|
+
identity: AppIdentity;
|
|
36
|
+
}): Promise<Readonly<{
|
|
37
|
+
auth_token: AuthToken;
|
|
38
|
+
pub_key: string;
|
|
39
|
+
wallet_uri_base: string;
|
|
40
|
+
}>>;
|
|
41
|
+
(method: "clone_authorization", params: {
|
|
42
|
+
auth_token: AuthToken;
|
|
43
|
+
}): Promise<Readonly<{
|
|
44
|
+
auth_token: AuthToken;
|
|
45
|
+
}>>;
|
|
46
|
+
(method: "deauthorize", params: {
|
|
47
|
+
auth_token: AuthToken;
|
|
48
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
49
|
+
(method: "reauthorize", params: {
|
|
50
|
+
auth_token: AuthToken;
|
|
51
|
+
}): Promise<Readonly<{
|
|
52
|
+
auth_token: AuthToken;
|
|
53
|
+
}>>;
|
|
54
|
+
(method: "sign_message", params: {
|
|
55
|
+
auth_token: AuthToken;
|
|
56
|
+
payloads: Base64EncodedMessage[];
|
|
57
|
+
}): Promise<Readonly<{
|
|
58
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
59
|
+
}>>;
|
|
60
|
+
(method: "sign_transaction", params: {
|
|
61
|
+
auth_token: AuthToken;
|
|
62
|
+
payloads: Base64EncodedTransaction[];
|
|
63
|
+
}): Promise<Readonly<{
|
|
64
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
65
|
+
}>>;
|
|
66
|
+
(method: "sign_and_send_transaction", params: {
|
|
67
|
+
auth_token: AuthToken;
|
|
68
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
69
|
+
payloads: Base64EncodedTransaction[];
|
|
70
|
+
}): Promise<Readonly<{
|
|
71
|
+
signatures: Base58EncodedSignature[];
|
|
72
|
+
}>>;
|
|
73
|
+
}
|
|
74
|
+
type Config = Readonly<{
|
|
75
|
+
baseUri?: string;
|
|
76
|
+
}>;
|
|
77
|
+
declare function withLocalWallet<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: Config): Promise<TReturn>;
|
|
78
|
+
declare class SolanaMobileWalletAdapterSecureContextRequiredError extends Error {
|
|
79
|
+
constructor();
|
|
80
|
+
}
|
|
81
|
+
declare class SolanaMobileWalletAdapterForbiddenWalletBaseURLError extends Error {
|
|
82
|
+
constructor();
|
|
83
|
+
}
|
|
84
|
+
declare class SolanaMobileWalletAdapterWalletNotInstalledError extends Error {
|
|
85
|
+
constructor();
|
|
86
|
+
}
|
|
87
|
+
declare class SolanaMobileWalletAdapterProtocolSessionEstablishmentError extends Error {
|
|
88
|
+
constructor(port: number);
|
|
89
|
+
}
|
|
90
|
+
declare class SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError extends Error {
|
|
91
|
+
constructor(port: number);
|
|
92
|
+
}
|
|
93
|
+
declare class SolanaMobileWalletAdapterProtocolSessionClosedError extends Error {
|
|
94
|
+
constructor(code: number, reason: string);
|
|
95
|
+
}
|
|
96
|
+
declare class SolanaMobileWalletAdapterProtocolReauthorizeError extends Error {
|
|
97
|
+
constructor();
|
|
98
|
+
}
|
|
99
|
+
type JSONRPCErrorCode = number;
|
|
100
|
+
// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
|
|
101
|
+
declare const SolanaMobileWalletAdapterProtocolError: {
|
|
102
|
+
readonly ERROR_REAUTHORIZE: -1;
|
|
103
|
+
readonly ERROR_AUTHORIZATION_FAILED: -2;
|
|
104
|
+
readonly ERROR_INVALID_PAYLOAD: -3;
|
|
105
|
+
readonly ERROR_NOT_SIGNED: -4;
|
|
106
|
+
readonly ERROR_NOT_COMMITTED: -5;
|
|
107
|
+
readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
|
|
108
|
+
};
|
|
109
|
+
type SolanaMobileWalletAdapterProtocolErrorEnum = (typeof SolanaMobileWalletAdapterProtocolError)[keyof typeof SolanaMobileWalletAdapterProtocolError];
|
|
110
|
+
type ErrorDataTypeMap = {
|
|
111
|
+
[SolanaMobileWalletAdapterProtocolError.ERROR_ATTEST_ORIGIN_ANDROID]: {
|
|
112
|
+
attest_origin_uri: string;
|
|
113
|
+
challenge: string;
|
|
114
|
+
context: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
declare class SolanaMobileWalletAdapterProtocolJsonRpcError<TErrorCode extends keyof ErrorDataTypeMap> extends Error {
|
|
118
|
+
data: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? ErrorDataTypeMap[TErrorCode] : undefined;
|
|
119
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode;
|
|
120
|
+
jsonRpcMessageId: number;
|
|
121
|
+
constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
|
|
122
|
+
jsonRpcMessageId: number,
|
|
123
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode,
|
|
124
|
+
message: string,
|
|
125
|
+
data: ErrorDataTypeMap[TErrorCode]
|
|
126
|
+
] : [
|
|
127
|
+
jsonRpcMessageId: number,
|
|
128
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode,
|
|
129
|
+
message: string
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
export { withLocalWallet, SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, MobileWallet };
|
|
133
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/createHelloReq.ts","../../src/errors.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/parseHelloRsp.ts","../../src/jsonRpcMessage.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/types.ts","../../src/withLocalWallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,2jBAA8B,CAA0B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties that wallets may present to users when an app
|
|
3
|
+
* asks for authorization to execute privileged methods (see
|
|
4
|
+
* {@link PrivilegedMethods}).
|
|
5
|
+
*/
|
|
6
|
+
type AppIdentity = Readonly<{
|
|
7
|
+
uri?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* An ephemeral elliptic-curve keypair on the P-256 curve.
|
|
13
|
+
* This public key is used to create the association token.
|
|
14
|
+
* The private key is used during session establishment.
|
|
15
|
+
*/
|
|
16
|
+
type AssociationKeypair = CryptoKeyPair;
|
|
17
|
+
/**
|
|
18
|
+
* The context returned from a wallet after having authorized a given
|
|
19
|
+
* account for use with a given application. You can cache this and
|
|
20
|
+
* use it later to invoke privileged methods.
|
|
21
|
+
*/
|
|
22
|
+
type AuthorizationResult = Readonly<{
|
|
23
|
+
authToken: string;
|
|
24
|
+
publicKey: string;
|
|
25
|
+
walletUriBase: string;
|
|
26
|
+
}>;
|
|
27
|
+
type AuthToken = string;
|
|
28
|
+
type Base58EncodedSignature = string;
|
|
29
|
+
type Base64EncodedMessage = string;
|
|
30
|
+
type Base64EncodedSignedMessage = string;
|
|
31
|
+
type Base64EncodedSignedTransaction = string;
|
|
32
|
+
type Base64EncodedTransaction = string;
|
|
33
|
+
interface MobileWallet {
|
|
34
|
+
(method: "authorize", params: {
|
|
35
|
+
identity: AppIdentity;
|
|
36
|
+
}): Promise<Readonly<{
|
|
37
|
+
auth_token: AuthToken;
|
|
38
|
+
pub_key: string;
|
|
39
|
+
wallet_uri_base: string;
|
|
40
|
+
}>>;
|
|
41
|
+
(method: "clone_authorization", params: {
|
|
42
|
+
auth_token: AuthToken;
|
|
43
|
+
}): Promise<Readonly<{
|
|
44
|
+
auth_token: AuthToken;
|
|
45
|
+
}>>;
|
|
46
|
+
(method: "deauthorize", params: {
|
|
47
|
+
auth_token: AuthToken;
|
|
48
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
49
|
+
(method: "reauthorize", params: {
|
|
50
|
+
auth_token: AuthToken;
|
|
51
|
+
}): Promise<Readonly<{
|
|
52
|
+
auth_token: AuthToken;
|
|
53
|
+
}>>;
|
|
54
|
+
(method: "sign_message", params: {
|
|
55
|
+
auth_token: AuthToken;
|
|
56
|
+
payloads: Base64EncodedMessage[];
|
|
57
|
+
}): Promise<Readonly<{
|
|
58
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
59
|
+
}>>;
|
|
60
|
+
(method: "sign_transaction", params: {
|
|
61
|
+
auth_token: AuthToken;
|
|
62
|
+
payloads: Base64EncodedTransaction[];
|
|
63
|
+
}): Promise<Readonly<{
|
|
64
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
65
|
+
}>>;
|
|
66
|
+
(method: "sign_and_send_transaction", params: {
|
|
67
|
+
auth_token: AuthToken;
|
|
68
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
69
|
+
payloads: Base64EncodedTransaction[];
|
|
70
|
+
}): Promise<Readonly<{
|
|
71
|
+
signatures: Base58EncodedSignature[];
|
|
72
|
+
}>>;
|
|
73
|
+
}
|
|
74
|
+
type Config = Readonly<{
|
|
75
|
+
baseUri?: string;
|
|
76
|
+
}>;
|
|
77
|
+
declare function withLocalWallet<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: Config): Promise<TReturn>;
|
|
78
|
+
declare class SolanaMobileWalletAdapterSecureContextRequiredError extends Error {
|
|
79
|
+
constructor();
|
|
80
|
+
}
|
|
81
|
+
declare class SolanaMobileWalletAdapterForbiddenWalletBaseURLError extends Error {
|
|
82
|
+
constructor();
|
|
83
|
+
}
|
|
84
|
+
declare class SolanaMobileWalletAdapterWalletNotInstalledError extends Error {
|
|
85
|
+
constructor();
|
|
86
|
+
}
|
|
87
|
+
declare class SolanaMobileWalletAdapterProtocolSessionEstablishmentError extends Error {
|
|
88
|
+
constructor(port: number);
|
|
89
|
+
}
|
|
90
|
+
declare class SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError extends Error {
|
|
91
|
+
constructor(port: number);
|
|
92
|
+
}
|
|
93
|
+
declare class SolanaMobileWalletAdapterProtocolSessionClosedError extends Error {
|
|
94
|
+
constructor(code: number, reason: string);
|
|
95
|
+
}
|
|
96
|
+
declare class SolanaMobileWalletAdapterProtocolReauthorizeError extends Error {
|
|
97
|
+
constructor();
|
|
98
|
+
}
|
|
99
|
+
type JSONRPCErrorCode = number;
|
|
100
|
+
// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/
|
|
101
|
+
declare const SolanaMobileWalletAdapterProtocolError: {
|
|
102
|
+
readonly ERROR_REAUTHORIZE: -1;
|
|
103
|
+
readonly ERROR_AUTHORIZATION_FAILED: -2;
|
|
104
|
+
readonly ERROR_INVALID_PAYLOAD: -3;
|
|
105
|
+
readonly ERROR_NOT_SIGNED: -4;
|
|
106
|
+
readonly ERROR_NOT_COMMITTED: -5;
|
|
107
|
+
readonly ERROR_ATTEST_ORIGIN_ANDROID: -100;
|
|
108
|
+
};
|
|
109
|
+
type SolanaMobileWalletAdapterProtocolErrorEnum = (typeof SolanaMobileWalletAdapterProtocolError)[keyof typeof SolanaMobileWalletAdapterProtocolError];
|
|
110
|
+
type ErrorDataTypeMap = {
|
|
111
|
+
[SolanaMobileWalletAdapterProtocolError.ERROR_ATTEST_ORIGIN_ANDROID]: {
|
|
112
|
+
attest_origin_uri: string;
|
|
113
|
+
challenge: string;
|
|
114
|
+
context: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
declare class SolanaMobileWalletAdapterProtocolJsonRpcError<TErrorCode extends keyof ErrorDataTypeMap> extends Error {
|
|
118
|
+
data: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? ErrorDataTypeMap[TErrorCode] : undefined;
|
|
119
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode;
|
|
120
|
+
jsonRpcMessageId: number;
|
|
121
|
+
constructor(...args: ErrorDataTypeMap[TErrorCode] extends Record<string, unknown> ? [
|
|
122
|
+
jsonRpcMessageId: number,
|
|
123
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode,
|
|
124
|
+
message: string,
|
|
125
|
+
data: ErrorDataTypeMap[TErrorCode]
|
|
126
|
+
] : [
|
|
127
|
+
jsonRpcMessageId: number,
|
|
128
|
+
code: SolanaMobileWalletAdapterProtocolErrorEnum | JSONRPCErrorCode,
|
|
129
|
+
message: string
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
export { withLocalWallet, SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, MobileWallet };
|
|
133
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/createHelloReq.ts","../../src/errors.ts","../../src/generateAssociationKeypair.ts","../../src/generateECDHKeypair.ts","../../src/parseHelloRsp.ts","../../src/jsonRpcMessage.ts","../../src/associationPort.ts","../../src/arrayBufferToBase64String.ts","../../src/getStringWithURLUnsafeBase64CharactersReplaced.ts","../../src/getAssociateAndroidIntentURL.ts","../../src/startSession.ts","../../src/types.ts","../../src/withLocalWallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,2jBAA8B,CAA0B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solana-mobile/mobile-wallet-adapter-protocol",
|
|
3
|
+
"description": "An implementation of the Solana Mobile Mobile Wallet Adapter protocol. Use this to open a session with a mobile wallet app, and to issue API calls to it.",
|
|
4
|
+
"version": "0.0.1-alpha.0",
|
|
5
|
+
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
|
+
"repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"main": "lib/cjs/index.js",
|
|
11
|
+
"module": "lib/esm/index.mjs",
|
|
12
|
+
"types": "lib/types/index.d.ts",
|
|
13
|
+
"browser": {
|
|
14
|
+
"./lib/cjs/index.js": "./lib/cjs/index.browser.js",
|
|
15
|
+
"./lib/esm/index.mjs": "./lib/esm/index.browser.mjs"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
"import": "./lib/esm/index.mjs",
|
|
19
|
+
"require": "./lib/cjs/index.js"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"lib",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"clean": "shx rm -rf lib/*",
|
|
30
|
+
"build": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
|
|
31
|
+
"build:watch": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
|
|
32
|
+
"postbuild": "echo '{\"type\":\"commonjs\"}' | npx json > lib/cjs/package.json && echo '{\"type\":\"module\"} ' | npx json > lib/esm/package.json",
|
|
33
|
+
"prepublishOnly": "agadoo"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"agadoo": "^2.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|