@solana-mobile/mobile-wallet-adapter-protocol 0.0.1-alpha.5 → 0.0.1-alpha.6
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 +3 -3
- package/lib/cjs/index.browser.js +31 -12
- package/lib/cjs/index.js +31 -12
- package/lib/cjs/index.native.js +31 -11
- package/lib/esm/index.browser.mjs +31 -12
- package/lib/esm/index.mjs +31 -12
- package/lib/types/index.browser.d.mts +53 -39
- package/lib/types/index.browser.d.ts +53 -39
- package/lib/types/index.d.mts +53 -39
- package/lib/types/index.d.ts +53 -39
- package/lib/types/index.native.d.ts +53 -39
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ The callback you provide will be called once a session has been established with
|
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
const signedPayloads = await transact(async (wallet) => {
|
|
23
|
-
const {signed_payloads} = await wallet(
|
|
23
|
+
const {signed_payloads} = await wallet.signMessage({
|
|
24
24
|
auth_token,
|
|
25
25
|
payloads: [/* ... */],
|
|
26
26
|
});
|
|
@@ -38,11 +38,11 @@ You can catch exceptions at any level. See `errors.ts` for a list of exceptions
|
|
|
38
38
|
try {
|
|
39
39
|
await transact(async (wallet) => {
|
|
40
40
|
try {
|
|
41
|
-
await wallet(
|
|
41
|
+
await wallet.signTransaction(/* ... */);
|
|
42
42
|
} catch (e) {
|
|
43
43
|
if (e instanceof SolanaMobileWalletAdapterProtocolReauthorizeError) {
|
|
44
44
|
console.error('The auth token has gone stale');
|
|
45
|
-
await wallet(
|
|
45
|
+
await wallet.reauthorize({auth_token});
|
|
46
46
|
// Retry...
|
|
47
47
|
}
|
|
48
48
|
throw e;
|
package/lib/cjs/index.browser.js
CHANGED
|
@@ -416,20 +416,39 @@ function transact(callback, config) {
|
|
|
416
416
|
case 'hello_req_sent': {
|
|
417
417
|
const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
|
|
418
418
|
state = { __type: 'connected', sharedSecret };
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
419
|
+
const wallet = new Proxy({}, {
|
|
420
|
+
get(target, p) {
|
|
421
|
+
if (target[p] == null) {
|
|
422
|
+
const method = p
|
|
423
|
+
.toString()
|
|
424
|
+
.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
|
|
425
|
+
.toLowerCase();
|
|
426
|
+
target[p] = function (params) {
|
|
427
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
428
|
+
const id = nextJsonRpcMessageId++;
|
|
429
|
+
socket.send(yield encryptJsonRpcMessage({
|
|
430
|
+
id,
|
|
431
|
+
jsonrpc: '2.0',
|
|
432
|
+
method,
|
|
433
|
+
params,
|
|
434
|
+
}, sharedSecret));
|
|
435
|
+
return new Promise((resolve, reject) => {
|
|
436
|
+
jsonRpcResponsePromises[id] = { resolve, reject };
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return target[p];
|
|
442
|
+
},
|
|
443
|
+
defineProperty() {
|
|
444
|
+
return false;
|
|
445
|
+
},
|
|
446
|
+
deleteProperty() {
|
|
447
|
+
return false;
|
|
448
|
+
},
|
|
430
449
|
});
|
|
431
450
|
try {
|
|
432
|
-
resolve(yield callback(
|
|
451
|
+
resolve(yield callback(wallet));
|
|
433
452
|
}
|
|
434
453
|
catch (e) {
|
|
435
454
|
reject(e);
|
package/lib/cjs/index.js
CHANGED
|
@@ -416,20 +416,39 @@ function transact(callback, config) {
|
|
|
416
416
|
case 'hello_req_sent': {
|
|
417
417
|
const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
|
|
418
418
|
state = { __type: 'connected', sharedSecret };
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
419
|
+
const wallet = new Proxy({}, {
|
|
420
|
+
get(target, p) {
|
|
421
|
+
if (target[p] == null) {
|
|
422
|
+
const method = p
|
|
423
|
+
.toString()
|
|
424
|
+
.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
|
|
425
|
+
.toLowerCase();
|
|
426
|
+
target[p] = function (params) {
|
|
427
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
428
|
+
const id = nextJsonRpcMessageId++;
|
|
429
|
+
socket.send(yield encryptJsonRpcMessage({
|
|
430
|
+
id,
|
|
431
|
+
jsonrpc: '2.0',
|
|
432
|
+
method,
|
|
433
|
+
params,
|
|
434
|
+
}, sharedSecret));
|
|
435
|
+
return new Promise((resolve, reject) => {
|
|
436
|
+
jsonRpcResponsePromises[id] = { resolve, reject };
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return target[p];
|
|
442
|
+
},
|
|
443
|
+
defineProperty() {
|
|
444
|
+
return false;
|
|
445
|
+
},
|
|
446
|
+
deleteProperty() {
|
|
447
|
+
return false;
|
|
448
|
+
},
|
|
430
449
|
});
|
|
431
450
|
try {
|
|
432
|
-
resolve(yield callback(
|
|
451
|
+
resolve(yield callback(wallet));
|
|
433
452
|
}
|
|
434
453
|
catch (e) {
|
|
435
454
|
reject(e);
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -110,18 +110,38 @@ function transact(callback, config) {
|
|
|
110
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
try {
|
|
112
112
|
yield SolanaMobileWalletAdapter.startSession(config);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
const wallet = new Proxy({}, {
|
|
114
|
+
get(target, p) {
|
|
115
|
+
if (target[p] == null) {
|
|
116
|
+
const method = p
|
|
117
|
+
.toString()
|
|
118
|
+
.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
|
|
119
|
+
.toLowerCase();
|
|
120
|
+
target[p] = function (params) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
try {
|
|
123
|
+
return yield SolanaMobileWalletAdapter.invoke(method, params);
|
|
124
|
+
}
|
|
125
|
+
catch (e) {
|
|
126
|
+
if (e instanceof Error && e.code === 'JSON_RPC_ERROR') {
|
|
127
|
+
const details = e.userInfo;
|
|
128
|
+
throw new SolanaMobileWalletAdapterProtocolJsonRpcError(0 /* jsonRpcMessageId */, details.jsonRpcErrorCode, e.message);
|
|
129
|
+
}
|
|
130
|
+
throw e;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
};
|
|
121
134
|
}
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
135
|
+
return target[p];
|
|
136
|
+
},
|
|
137
|
+
defineProperty() {
|
|
138
|
+
return false;
|
|
139
|
+
},
|
|
140
|
+
deleteProperty() {
|
|
141
|
+
return false;
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
return yield callback(wallet);
|
|
125
145
|
}
|
|
126
146
|
finally {
|
|
127
147
|
yield SolanaMobileWalletAdapter.endSession();
|
|
@@ -412,20 +412,39 @@ function transact(callback, config) {
|
|
|
412
412
|
case 'hello_req_sent': {
|
|
413
413
|
const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
|
|
414
414
|
state = { __type: 'connected', sharedSecret };
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
415
|
+
const wallet = new Proxy({}, {
|
|
416
|
+
get(target, p) {
|
|
417
|
+
if (target[p] == null) {
|
|
418
|
+
const method = p
|
|
419
|
+
.toString()
|
|
420
|
+
.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
|
|
421
|
+
.toLowerCase();
|
|
422
|
+
target[p] = function (params) {
|
|
423
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
const id = nextJsonRpcMessageId++;
|
|
425
|
+
socket.send(yield encryptJsonRpcMessage({
|
|
426
|
+
id,
|
|
427
|
+
jsonrpc: '2.0',
|
|
428
|
+
method,
|
|
429
|
+
params,
|
|
430
|
+
}, sharedSecret));
|
|
431
|
+
return new Promise((resolve, reject) => {
|
|
432
|
+
jsonRpcResponsePromises[id] = { resolve, reject };
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
return target[p];
|
|
438
|
+
},
|
|
439
|
+
defineProperty() {
|
|
440
|
+
return false;
|
|
441
|
+
},
|
|
442
|
+
deleteProperty() {
|
|
443
|
+
return false;
|
|
444
|
+
},
|
|
426
445
|
});
|
|
427
446
|
try {
|
|
428
|
-
resolve(yield callback(
|
|
447
|
+
resolve(yield callback(wallet));
|
|
429
448
|
}
|
|
430
449
|
catch (e) {
|
|
431
450
|
reject(e);
|
package/lib/esm/index.mjs
CHANGED
|
@@ -412,20 +412,39 @@ function transact(callback, config) {
|
|
|
412
412
|
case 'hello_req_sent': {
|
|
413
413
|
const sharedSecret = yield parseHelloRsp(responseBuffer, state.associationPublicKey, state.ecdhPrivateKey);
|
|
414
414
|
state = { __type: 'connected', sharedSecret };
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
415
|
+
const wallet = new Proxy({}, {
|
|
416
|
+
get(target, p) {
|
|
417
|
+
if (target[p] == null) {
|
|
418
|
+
const method = p
|
|
419
|
+
.toString()
|
|
420
|
+
.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`)
|
|
421
|
+
.toLowerCase();
|
|
422
|
+
target[p] = function (params) {
|
|
423
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
const id = nextJsonRpcMessageId++;
|
|
425
|
+
socket.send(yield encryptJsonRpcMessage({
|
|
426
|
+
id,
|
|
427
|
+
jsonrpc: '2.0',
|
|
428
|
+
method,
|
|
429
|
+
params,
|
|
430
|
+
}, sharedSecret));
|
|
431
|
+
return new Promise((resolve, reject) => {
|
|
432
|
+
jsonRpcResponsePromises[id] = { resolve, reject };
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
return target[p];
|
|
438
|
+
},
|
|
439
|
+
defineProperty() {
|
|
440
|
+
return false;
|
|
441
|
+
},
|
|
442
|
+
deleteProperty() {
|
|
443
|
+
return false;
|
|
444
|
+
},
|
|
426
445
|
});
|
|
427
446
|
try {
|
|
428
|
-
resolve(yield callback(
|
|
447
|
+
resolve(yield callback(wallet));
|
|
429
448
|
}
|
|
430
449
|
catch (e) {
|
|
431
450
|
reject(e);
|
|
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
|
|
|
87
87
|
type WalletAssociationConfig = Readonly<{
|
|
88
88
|
baseUri?: string;
|
|
89
89
|
}>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
interface AuthorizeAPI {
|
|
91
|
+
authorize(params: {
|
|
92
|
+
identity: AppIdentity;
|
|
93
|
+
}): Promise<AuthorizationResult>;
|
|
94
|
+
}
|
|
95
|
+
interface CloneAuthorizationAPI {
|
|
96
|
+
cloneAuthorization(params: {
|
|
97
|
+
auth_token: AuthToken;
|
|
98
|
+
}): Promise<Readonly<{
|
|
99
|
+
auth_token: AuthToken;
|
|
100
|
+
}>>;
|
|
101
|
+
}
|
|
102
|
+
interface DeauthorizeAPI {
|
|
103
|
+
deauthorize(params: {
|
|
104
|
+
auth_token: AuthToken;
|
|
105
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
106
|
+
}
|
|
107
|
+
interface ReauthorizeAPI {
|
|
108
|
+
reauthorize(params: {
|
|
109
|
+
auth_token: AuthToken;
|
|
110
|
+
}): Promise<Readonly<{
|
|
111
|
+
auth_token: AuthToken;
|
|
112
|
+
}>>;
|
|
113
|
+
}
|
|
114
|
+
interface SignMessageAPI {
|
|
115
|
+
signMessage(params: {
|
|
116
|
+
auth_token: AuthToken;
|
|
117
|
+
payloads: Base64EncodedMessage[];
|
|
118
|
+
}): Promise<Readonly<{
|
|
119
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
120
|
+
}>>;
|
|
121
|
+
}
|
|
122
|
+
interface SignTransactionAPI {
|
|
123
|
+
signTransaction(params: {
|
|
124
|
+
auth_token: AuthToken;
|
|
125
|
+
payloads: Base64EncodedTransaction[];
|
|
126
|
+
}): Promise<Readonly<{
|
|
127
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
128
|
+
}>>;
|
|
129
|
+
}
|
|
130
|
+
interface SignAndSendTransactionAPI {
|
|
131
|
+
signAndSendTransaction(params: {
|
|
132
|
+
auth_token: AuthToken;
|
|
133
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
134
|
+
payloads: Base64EncodedTransaction[];
|
|
135
|
+
}): Promise<Readonly<{
|
|
136
|
+
signatures: Base58EncodedSignature[];
|
|
137
|
+
}>>;
|
|
138
|
+
}
|
|
139
|
+
interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
|
|
140
|
+
}
|
|
141
|
+
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
142
|
+
export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
|
|
129
143
|
//# sourceMappingURL=index.browser.d.mts.map
|
|
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
|
|
|
87
87
|
type WalletAssociationConfig = Readonly<{
|
|
88
88
|
baseUri?: string;
|
|
89
89
|
}>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
interface AuthorizeAPI {
|
|
91
|
+
authorize(params: {
|
|
92
|
+
identity: AppIdentity;
|
|
93
|
+
}): Promise<AuthorizationResult>;
|
|
94
|
+
}
|
|
95
|
+
interface CloneAuthorizationAPI {
|
|
96
|
+
cloneAuthorization(params: {
|
|
97
|
+
auth_token: AuthToken;
|
|
98
|
+
}): Promise<Readonly<{
|
|
99
|
+
auth_token: AuthToken;
|
|
100
|
+
}>>;
|
|
101
|
+
}
|
|
102
|
+
interface DeauthorizeAPI {
|
|
103
|
+
deauthorize(params: {
|
|
104
|
+
auth_token: AuthToken;
|
|
105
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
106
|
+
}
|
|
107
|
+
interface ReauthorizeAPI {
|
|
108
|
+
reauthorize(params: {
|
|
109
|
+
auth_token: AuthToken;
|
|
110
|
+
}): Promise<Readonly<{
|
|
111
|
+
auth_token: AuthToken;
|
|
112
|
+
}>>;
|
|
113
|
+
}
|
|
114
|
+
interface SignMessageAPI {
|
|
115
|
+
signMessage(params: {
|
|
116
|
+
auth_token: AuthToken;
|
|
117
|
+
payloads: Base64EncodedMessage[];
|
|
118
|
+
}): Promise<Readonly<{
|
|
119
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
120
|
+
}>>;
|
|
121
|
+
}
|
|
122
|
+
interface SignTransactionAPI {
|
|
123
|
+
signTransaction(params: {
|
|
124
|
+
auth_token: AuthToken;
|
|
125
|
+
payloads: Base64EncodedTransaction[];
|
|
126
|
+
}): Promise<Readonly<{
|
|
127
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
128
|
+
}>>;
|
|
129
|
+
}
|
|
130
|
+
interface SignAndSendTransactionAPI {
|
|
131
|
+
signAndSendTransaction(params: {
|
|
132
|
+
auth_token: AuthToken;
|
|
133
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
134
|
+
payloads: Base64EncodedTransaction[];
|
|
135
|
+
}): Promise<Readonly<{
|
|
136
|
+
signatures: Base58EncodedSignature[];
|
|
137
|
+
}>>;
|
|
138
|
+
}
|
|
139
|
+
interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
|
|
140
|
+
}
|
|
141
|
+
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
142
|
+
export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
|
|
129
143
|
//# sourceMappingURL=index.browser.d.ts.map
|
package/lib/types/index.d.mts
CHANGED
|
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
|
|
|
87
87
|
type WalletAssociationConfig = Readonly<{
|
|
88
88
|
baseUri?: string;
|
|
89
89
|
}>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
interface AuthorizeAPI {
|
|
91
|
+
authorize(params: {
|
|
92
|
+
identity: AppIdentity;
|
|
93
|
+
}): Promise<AuthorizationResult>;
|
|
94
|
+
}
|
|
95
|
+
interface CloneAuthorizationAPI {
|
|
96
|
+
cloneAuthorization(params: {
|
|
97
|
+
auth_token: AuthToken;
|
|
98
|
+
}): Promise<Readonly<{
|
|
99
|
+
auth_token: AuthToken;
|
|
100
|
+
}>>;
|
|
101
|
+
}
|
|
102
|
+
interface DeauthorizeAPI {
|
|
103
|
+
deauthorize(params: {
|
|
104
|
+
auth_token: AuthToken;
|
|
105
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
106
|
+
}
|
|
107
|
+
interface ReauthorizeAPI {
|
|
108
|
+
reauthorize(params: {
|
|
109
|
+
auth_token: AuthToken;
|
|
110
|
+
}): Promise<Readonly<{
|
|
111
|
+
auth_token: AuthToken;
|
|
112
|
+
}>>;
|
|
113
|
+
}
|
|
114
|
+
interface SignMessageAPI {
|
|
115
|
+
signMessage(params: {
|
|
116
|
+
auth_token: AuthToken;
|
|
117
|
+
payloads: Base64EncodedMessage[];
|
|
118
|
+
}): Promise<Readonly<{
|
|
119
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
120
|
+
}>>;
|
|
121
|
+
}
|
|
122
|
+
interface SignTransactionAPI {
|
|
123
|
+
signTransaction(params: {
|
|
124
|
+
auth_token: AuthToken;
|
|
125
|
+
payloads: Base64EncodedTransaction[];
|
|
126
|
+
}): Promise<Readonly<{
|
|
127
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
128
|
+
}>>;
|
|
129
|
+
}
|
|
130
|
+
interface SignAndSendTransactionAPI {
|
|
131
|
+
signAndSendTransaction(params: {
|
|
132
|
+
auth_token: AuthToken;
|
|
133
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
134
|
+
payloads: Base64EncodedTransaction[];
|
|
135
|
+
}): Promise<Readonly<{
|
|
136
|
+
signatures: Base58EncodedSignature[];
|
|
137
|
+
}>>;
|
|
138
|
+
}
|
|
139
|
+
interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
|
|
140
|
+
}
|
|
141
|
+
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
142
|
+
export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
|
|
129
143
|
//# sourceMappingURL=index.d.mts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
|
|
|
87
87
|
type WalletAssociationConfig = Readonly<{
|
|
88
88
|
baseUri?: string;
|
|
89
89
|
}>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
interface AuthorizeAPI {
|
|
91
|
+
authorize(params: {
|
|
92
|
+
identity: AppIdentity;
|
|
93
|
+
}): Promise<AuthorizationResult>;
|
|
94
|
+
}
|
|
95
|
+
interface CloneAuthorizationAPI {
|
|
96
|
+
cloneAuthorization(params: {
|
|
97
|
+
auth_token: AuthToken;
|
|
98
|
+
}): Promise<Readonly<{
|
|
99
|
+
auth_token: AuthToken;
|
|
100
|
+
}>>;
|
|
101
|
+
}
|
|
102
|
+
interface DeauthorizeAPI {
|
|
103
|
+
deauthorize(params: {
|
|
104
|
+
auth_token: AuthToken;
|
|
105
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
106
|
+
}
|
|
107
|
+
interface ReauthorizeAPI {
|
|
108
|
+
reauthorize(params: {
|
|
109
|
+
auth_token: AuthToken;
|
|
110
|
+
}): Promise<Readonly<{
|
|
111
|
+
auth_token: AuthToken;
|
|
112
|
+
}>>;
|
|
113
|
+
}
|
|
114
|
+
interface SignMessageAPI {
|
|
115
|
+
signMessage(params: {
|
|
116
|
+
auth_token: AuthToken;
|
|
117
|
+
payloads: Base64EncodedMessage[];
|
|
118
|
+
}): Promise<Readonly<{
|
|
119
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
120
|
+
}>>;
|
|
121
|
+
}
|
|
122
|
+
interface SignTransactionAPI {
|
|
123
|
+
signTransaction(params: {
|
|
124
|
+
auth_token: AuthToken;
|
|
125
|
+
payloads: Base64EncodedTransaction[];
|
|
126
|
+
}): Promise<Readonly<{
|
|
127
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
128
|
+
}>>;
|
|
129
|
+
}
|
|
130
|
+
interface SignAndSendTransactionAPI {
|
|
131
|
+
signAndSendTransaction(params: {
|
|
132
|
+
auth_token: AuthToken;
|
|
133
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
134
|
+
payloads: Base64EncodedTransaction[];
|
|
135
|
+
}): Promise<Readonly<{
|
|
136
|
+
signatures: Base58EncodedSignature[];
|
|
137
|
+
}>>;
|
|
138
|
+
}
|
|
139
|
+
interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
|
|
140
|
+
}
|
|
141
|
+
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
142
|
+
export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
|
|
129
143
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -87,43 +87,57 @@ type Base64EncodedTransaction = string;
|
|
|
87
87
|
type WalletAssociationConfig = Readonly<{
|
|
88
88
|
baseUri?: string;
|
|
89
89
|
}>;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
interface AuthorizeAPI {
|
|
91
|
+
authorize(params: {
|
|
92
|
+
identity: AppIdentity;
|
|
93
|
+
}): Promise<AuthorizationResult>;
|
|
94
|
+
}
|
|
95
|
+
interface CloneAuthorizationAPI {
|
|
96
|
+
cloneAuthorization(params: {
|
|
97
|
+
auth_token: AuthToken;
|
|
98
|
+
}): Promise<Readonly<{
|
|
99
|
+
auth_token: AuthToken;
|
|
100
|
+
}>>;
|
|
101
|
+
}
|
|
102
|
+
interface DeauthorizeAPI {
|
|
103
|
+
deauthorize(params: {
|
|
104
|
+
auth_token: AuthToken;
|
|
105
|
+
}): Promise<Readonly<Record<string, never>>>;
|
|
106
|
+
}
|
|
107
|
+
interface ReauthorizeAPI {
|
|
108
|
+
reauthorize(params: {
|
|
109
|
+
auth_token: AuthToken;
|
|
110
|
+
}): Promise<Readonly<{
|
|
111
|
+
auth_token: AuthToken;
|
|
112
|
+
}>>;
|
|
113
|
+
}
|
|
114
|
+
interface SignMessageAPI {
|
|
115
|
+
signMessage(params: {
|
|
116
|
+
auth_token: AuthToken;
|
|
117
|
+
payloads: Base64EncodedMessage[];
|
|
118
|
+
}): Promise<Readonly<{
|
|
119
|
+
signed_payloads: Base64EncodedSignedMessage[];
|
|
120
|
+
}>>;
|
|
121
|
+
}
|
|
122
|
+
interface SignTransactionAPI {
|
|
123
|
+
signTransaction(params: {
|
|
124
|
+
auth_token: AuthToken;
|
|
125
|
+
payloads: Base64EncodedTransaction[];
|
|
126
|
+
}): Promise<Readonly<{
|
|
127
|
+
signed_payloads: Base64EncodedSignedTransaction[];
|
|
128
|
+
}>>;
|
|
129
|
+
}
|
|
130
|
+
interface SignAndSendTransactionAPI {
|
|
131
|
+
signAndSendTransaction(params: {
|
|
132
|
+
auth_token: AuthToken;
|
|
133
|
+
commitment: "confirmed" | "finalized" | "processed";
|
|
134
|
+
payloads: Base64EncodedTransaction[];
|
|
135
|
+
}): Promise<Readonly<{
|
|
136
|
+
signatures: Base58EncodedSignature[];
|
|
137
|
+
}>>;
|
|
138
|
+
}
|
|
139
|
+
interface MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI {
|
|
140
|
+
}
|
|
141
|
+
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
142
|
+
export { SolanaMobileWalletAdapterSecureContextRequiredError, SolanaMobileWalletAdapterForbiddenWalletBaseURLError, SolanaMobileWalletAdapterWalletNotInstalledError, SolanaMobileWalletAdapterProtocolSessionEstablishmentError, SolanaMobileWalletAdapterProtocolAssociationPortOutOfRangeError, SolanaMobileWalletAdapterProtocolSessionClosedError, SolanaMobileWalletAdapterProtocolReauthorizeError, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolJsonRpcError, transact, AppIdentity, AssociationKeypair, AuthorizationResult, AuthToken, WalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, SignMessageAPI, SignTransactionAPI, SignAndSendTransactionAPI, MobileWallet };
|
|
129
143
|
//# sourceMappingURL=index.native.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/mobile-wallet-adapter-protocol",
|
|
3
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.
|
|
4
|
+
"version": "0.0.1-alpha.6",
|
|
5
5
|
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
6
|
"repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"@types/react-native": "^0.69.3",
|
|
46
46
|
"agadoo": "^2.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "8cef0e0dd72e01cd522b16b6e486a26abe1e032b"
|
|
49
49
|
}
|