@solana-mobile/mobile-wallet-adapter-protocol-web3js 2.1.5 → 2.1.8
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/lib/cjs/index.browser.js +75 -63
- package/lib/cjs/index.js +75 -63
- package/lib/cjs/index.native.js +75 -63
- package/lib/esm/index.browser.js +76 -65
- package/lib/esm/index.js +76 -65
- package/lib/types/index.browser.d.ts +9 -1
- package/lib/types/index.d.ts +9 -1
- package/lib/types/index.native.d.ts +9 -1
- package/package.json +2 -2
package/lib/cjs/index.browser.js
CHANGED
|
@@ -81,69 +81,7 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
81
81
|
function transact(callback, config) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
const augmentedCallback = (wallet) => {
|
|
84
|
-
|
|
85
|
-
get(target, p) {
|
|
86
|
-
if (target[p] == null) {
|
|
87
|
-
switch (p) {
|
|
88
|
-
case 'signAndSendTransactions':
|
|
89
|
-
target[p] = function (_a) {
|
|
90
|
-
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
93
|
-
const options = {
|
|
94
|
-
min_context_slot: minContextSlot,
|
|
95
|
-
commitment: commitment,
|
|
96
|
-
skip_preflight: skipPreflight,
|
|
97
|
-
max_retries: maxRetries,
|
|
98
|
-
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
99
|
-
};
|
|
100
|
-
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
101
|
-
? { options: options }
|
|
102
|
-
: null)), { payloads }));
|
|
103
|
-
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58__default["default"].encode);
|
|
104
|
-
return signatures;
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
break;
|
|
108
|
-
case 'signMessages':
|
|
109
|
-
target[p] = function (_a) {
|
|
110
|
-
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
113
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
114
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
115
|
-
return signedMessages;
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
break;
|
|
119
|
-
case 'signTransactions':
|
|
120
|
-
target[p] = function (_a) {
|
|
121
|
-
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
124
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
125
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
126
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
127
|
-
return signedTransactions;
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
break;
|
|
131
|
-
default: {
|
|
132
|
-
target[p] = wallet[p];
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return target[p];
|
|
138
|
-
},
|
|
139
|
-
defineProperty() {
|
|
140
|
-
return false;
|
|
141
|
-
},
|
|
142
|
-
deleteProperty() {
|
|
143
|
-
return false;
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
return callback(augmentedAPI);
|
|
84
|
+
return callback(augmentWalletAPI(wallet));
|
|
147
85
|
};
|
|
148
86
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
149
87
|
});
|
|
@@ -218,6 +156,80 @@ function transactRemote(callback, config) {
|
|
|
218
156
|
return yield mobileWalletAdapterProtocol.transactRemote(augmentedCallback, config);
|
|
219
157
|
});
|
|
220
158
|
}
|
|
159
|
+
function startRemoteScenario(config) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const { wallet, close, associationUrl } = yield mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
162
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
163
|
+
return augmentWalletAPI(wallet);
|
|
164
|
+
});
|
|
165
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function augmentWalletAPI(wallet) {
|
|
169
|
+
return new Proxy({}, {
|
|
170
|
+
get(target, p) {
|
|
171
|
+
if (target[p] == null) {
|
|
172
|
+
switch (p) {
|
|
173
|
+
case 'signAndSendTransactions':
|
|
174
|
+
target[p] = function (_a) {
|
|
175
|
+
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
178
|
+
const options = {
|
|
179
|
+
min_context_slot: minContextSlot,
|
|
180
|
+
commitment: commitment,
|
|
181
|
+
skip_preflight: skipPreflight,
|
|
182
|
+
max_retries: maxRetries,
|
|
183
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
184
|
+
};
|
|
185
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
186
|
+
? { options: options }
|
|
187
|
+
: null)), { payloads }));
|
|
188
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58__default["default"].encode);
|
|
189
|
+
return signatures;
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
break;
|
|
193
|
+
case 'signMessages':
|
|
194
|
+
target[p] = function (_a) {
|
|
195
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
198
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
199
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
200
|
+
return signedMessages;
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
break;
|
|
204
|
+
case 'signTransactions':
|
|
205
|
+
target[p] = function (_a) {
|
|
206
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
209
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
210
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
211
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
212
|
+
return signedTransactions;
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
break;
|
|
216
|
+
default: {
|
|
217
|
+
target[p] = wallet[p];
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return target[p];
|
|
223
|
+
},
|
|
224
|
+
defineProperty() {
|
|
225
|
+
return false;
|
|
226
|
+
},
|
|
227
|
+
deleteProperty() {
|
|
228
|
+
return false;
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
221
232
|
|
|
233
|
+
exports.startRemoteScenario = startRemoteScenario;
|
|
222
234
|
exports.transact = transact;
|
|
223
235
|
exports.transactRemote = transactRemote;
|
package/lib/cjs/index.js
CHANGED
|
@@ -81,69 +81,7 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
81
81
|
function transact(callback, config) {
|
|
82
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
const augmentedCallback = (wallet) => {
|
|
84
|
-
|
|
85
|
-
get(target, p) {
|
|
86
|
-
if (target[p] == null) {
|
|
87
|
-
switch (p) {
|
|
88
|
-
case 'signAndSendTransactions':
|
|
89
|
-
target[p] = function (_a) {
|
|
90
|
-
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
93
|
-
const options = {
|
|
94
|
-
min_context_slot: minContextSlot,
|
|
95
|
-
commitment: commitment,
|
|
96
|
-
skip_preflight: skipPreflight,
|
|
97
|
-
max_retries: maxRetries,
|
|
98
|
-
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
99
|
-
};
|
|
100
|
-
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
101
|
-
? { options: options }
|
|
102
|
-
: null)), { payloads }));
|
|
103
|
-
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58__default["default"].encode);
|
|
104
|
-
return signatures;
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
break;
|
|
108
|
-
case 'signMessages':
|
|
109
|
-
target[p] = function (_a) {
|
|
110
|
-
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
111
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
113
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
114
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
115
|
-
return signedMessages;
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
break;
|
|
119
|
-
case 'signTransactions':
|
|
120
|
-
target[p] = function (_a) {
|
|
121
|
-
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
124
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
125
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
126
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
127
|
-
return signedTransactions;
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
break;
|
|
131
|
-
default: {
|
|
132
|
-
target[p] = wallet[p];
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return target[p];
|
|
138
|
-
},
|
|
139
|
-
defineProperty() {
|
|
140
|
-
return false;
|
|
141
|
-
},
|
|
142
|
-
deleteProperty() {
|
|
143
|
-
return false;
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
return callback(augmentedAPI);
|
|
84
|
+
return callback(augmentWalletAPI(wallet));
|
|
147
85
|
};
|
|
148
86
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
149
87
|
});
|
|
@@ -218,6 +156,80 @@ function transactRemote(callback, config) {
|
|
|
218
156
|
return yield mobileWalletAdapterProtocol.transactRemote(augmentedCallback, config);
|
|
219
157
|
});
|
|
220
158
|
}
|
|
159
|
+
function startRemoteScenario(config) {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const { wallet, close, associationUrl } = yield mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
162
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
163
|
+
return augmentWalletAPI(wallet);
|
|
164
|
+
});
|
|
165
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function augmentWalletAPI(wallet) {
|
|
169
|
+
return new Proxy({}, {
|
|
170
|
+
get(target, p) {
|
|
171
|
+
if (target[p] == null) {
|
|
172
|
+
switch (p) {
|
|
173
|
+
case 'signAndSendTransactions':
|
|
174
|
+
target[p] = function (_a) {
|
|
175
|
+
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
176
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
177
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
178
|
+
const options = {
|
|
179
|
+
min_context_slot: minContextSlot,
|
|
180
|
+
commitment: commitment,
|
|
181
|
+
skip_preflight: skipPreflight,
|
|
182
|
+
max_retries: maxRetries,
|
|
183
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
184
|
+
};
|
|
185
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
186
|
+
? { options: options }
|
|
187
|
+
: null)), { payloads }));
|
|
188
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58__default["default"].encode);
|
|
189
|
+
return signatures;
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
break;
|
|
193
|
+
case 'signMessages':
|
|
194
|
+
target[p] = function (_a) {
|
|
195
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
198
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
199
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
200
|
+
return signedMessages;
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
break;
|
|
204
|
+
case 'signTransactions':
|
|
205
|
+
target[p] = function (_a) {
|
|
206
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
209
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
210
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
211
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
212
|
+
return signedTransactions;
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
break;
|
|
216
|
+
default: {
|
|
217
|
+
target[p] = wallet[p];
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return target[p];
|
|
223
|
+
},
|
|
224
|
+
defineProperty() {
|
|
225
|
+
return false;
|
|
226
|
+
},
|
|
227
|
+
deleteProperty() {
|
|
228
|
+
return false;
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
221
232
|
|
|
233
|
+
exports.startRemoteScenario = startRemoteScenario;
|
|
222
234
|
exports.transact = transact;
|
|
223
235
|
exports.transactRemote = transactRemote;
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -72,69 +72,7 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
72
72
|
function transact(callback, config) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
const augmentedCallback = (wallet) => {
|
|
75
|
-
|
|
76
|
-
get(target, p) {
|
|
77
|
-
if (target[p] == null) {
|
|
78
|
-
switch (p) {
|
|
79
|
-
case 'signAndSendTransactions':
|
|
80
|
-
target[p] = function (_a) {
|
|
81
|
-
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
82
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
84
|
-
const options = {
|
|
85
|
-
min_context_slot: minContextSlot,
|
|
86
|
-
commitment: commitment,
|
|
87
|
-
skip_preflight: skipPreflight,
|
|
88
|
-
max_retries: maxRetries,
|
|
89
|
-
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
90
|
-
};
|
|
91
|
-
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
92
|
-
? { options: options }
|
|
93
|
-
: null)), { payloads }));
|
|
94
|
-
const signatures = base64EncodedSignatures.map(jsBase64.toUint8Array).map(bs58__default["default"].encode);
|
|
95
|
-
return signatures;
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
break;
|
|
99
|
-
case 'signMessages':
|
|
100
|
-
target[p] = function (_a) {
|
|
101
|
-
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const base64EncodedPayloads = payloads.map(jsBase64.fromUint8Array);
|
|
104
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
105
|
-
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
106
|
-
return signedMessages;
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
break;
|
|
110
|
-
case 'signTransactions':
|
|
111
|
-
target[p] = function (_a) {
|
|
112
|
-
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
115
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
116
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
117
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
118
|
-
return signedTransactions;
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
break;
|
|
122
|
-
default: {
|
|
123
|
-
target[p] = wallet[p];
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return target[p];
|
|
129
|
-
},
|
|
130
|
-
defineProperty() {
|
|
131
|
-
return false;
|
|
132
|
-
},
|
|
133
|
-
deleteProperty() {
|
|
134
|
-
return false;
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
return callback(augmentedAPI);
|
|
75
|
+
return callback(augmentWalletAPI(wallet));
|
|
138
76
|
};
|
|
139
77
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
140
78
|
});
|
|
@@ -209,6 +147,80 @@ function transactRemote(callback, config) {
|
|
|
209
147
|
return yield mobileWalletAdapterProtocol.transactRemote(augmentedCallback, config);
|
|
210
148
|
});
|
|
211
149
|
}
|
|
150
|
+
function startRemoteScenario(config) {
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const { wallet, close, associationUrl } = yield mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
153
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
154
|
+
return augmentWalletAPI(wallet);
|
|
155
|
+
});
|
|
156
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function augmentWalletAPI(wallet) {
|
|
160
|
+
return new Proxy({}, {
|
|
161
|
+
get(target, p) {
|
|
162
|
+
if (target[p] == null) {
|
|
163
|
+
switch (p) {
|
|
164
|
+
case 'signAndSendTransactions':
|
|
165
|
+
target[p] = function (_a) {
|
|
166
|
+
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
169
|
+
const options = {
|
|
170
|
+
min_context_slot: minContextSlot,
|
|
171
|
+
commitment: commitment,
|
|
172
|
+
skip_preflight: skipPreflight,
|
|
173
|
+
max_retries: maxRetries,
|
|
174
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
175
|
+
};
|
|
176
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
177
|
+
? { options: options }
|
|
178
|
+
: null)), { payloads }));
|
|
179
|
+
const signatures = base64EncodedSignatures.map(jsBase64.toUint8Array).map(bs58__default["default"].encode);
|
|
180
|
+
return signatures;
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
break;
|
|
184
|
+
case 'signMessages':
|
|
185
|
+
target[p] = function (_a) {
|
|
186
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
const base64EncodedPayloads = payloads.map(jsBase64.fromUint8Array);
|
|
189
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
190
|
+
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
191
|
+
return signedMessages;
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
break;
|
|
195
|
+
case 'signTransactions':
|
|
196
|
+
target[p] = function (_a) {
|
|
197
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
200
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
201
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
202
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
203
|
+
return signedTransactions;
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
break;
|
|
207
|
+
default: {
|
|
208
|
+
target[p] = wallet[p];
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return target[p];
|
|
214
|
+
},
|
|
215
|
+
defineProperty() {
|
|
216
|
+
return false;
|
|
217
|
+
},
|
|
218
|
+
deleteProperty() {
|
|
219
|
+
return false;
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
212
223
|
|
|
224
|
+
exports.startRemoteScenario = startRemoteScenario;
|
|
213
225
|
exports.transact = transact;
|
|
214
226
|
exports.transactRemote = transactRemote;
|
package/lib/esm/index.browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VersionedMessage, Transaction, VersionedTransaction, SIGNATURE_LENGTH_IN_BYTES } from '@solana/web3.js';
|
|
2
|
-
import { transact as transact$1, transactRemote as transactRemote$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
2
|
+
import { transact as transact$1, transactRemote as transactRemote$1, startRemoteScenario as startRemoteScenario$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
3
3
|
import bs58 from 'bs58';
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
@@ -73,69 +73,7 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
73
73
|
function transact(callback, config) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
const augmentedCallback = (wallet) => {
|
|
76
|
-
|
|
77
|
-
get(target, p) {
|
|
78
|
-
if (target[p] == null) {
|
|
79
|
-
switch (p) {
|
|
80
|
-
case 'signAndSendTransactions':
|
|
81
|
-
target[p] = function (_a) {
|
|
82
|
-
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
85
|
-
const options = {
|
|
86
|
-
min_context_slot: minContextSlot,
|
|
87
|
-
commitment: commitment,
|
|
88
|
-
skip_preflight: skipPreflight,
|
|
89
|
-
max_retries: maxRetries,
|
|
90
|
-
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
91
|
-
};
|
|
92
|
-
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
93
|
-
? { options: options }
|
|
94
|
-
: null)), { payloads }));
|
|
95
|
-
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
96
|
-
return signatures;
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
break;
|
|
100
|
-
case 'signMessages':
|
|
101
|
-
target[p] = function (_a) {
|
|
102
|
-
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
105
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
106
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
107
|
-
return signedMessages;
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
break;
|
|
111
|
-
case 'signTransactions':
|
|
112
|
-
target[p] = function (_a) {
|
|
113
|
-
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
116
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
117
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
118
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
119
|
-
return signedTransactions;
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
break;
|
|
123
|
-
default: {
|
|
124
|
-
target[p] = wallet[p];
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return target[p];
|
|
130
|
-
},
|
|
131
|
-
defineProperty() {
|
|
132
|
-
return false;
|
|
133
|
-
},
|
|
134
|
-
deleteProperty() {
|
|
135
|
-
return false;
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
return callback(augmentedAPI);
|
|
76
|
+
return callback(augmentWalletAPI(wallet));
|
|
139
77
|
};
|
|
140
78
|
return yield transact$1(augmentedCallback, config);
|
|
141
79
|
});
|
|
@@ -210,5 +148,78 @@ function transactRemote(callback, config) {
|
|
|
210
148
|
return yield transactRemote$1(augmentedCallback, config);
|
|
211
149
|
});
|
|
212
150
|
}
|
|
151
|
+
function startRemoteScenario(config) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const { wallet, close, associationUrl } = yield startRemoteScenario$1(config);
|
|
154
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
155
|
+
return augmentWalletAPI(wallet);
|
|
156
|
+
});
|
|
157
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function augmentWalletAPI(wallet) {
|
|
161
|
+
return new Proxy({}, {
|
|
162
|
+
get(target, p) {
|
|
163
|
+
if (target[p] == null) {
|
|
164
|
+
switch (p) {
|
|
165
|
+
case 'signAndSendTransactions':
|
|
166
|
+
target[p] = function (_a) {
|
|
167
|
+
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
170
|
+
const options = {
|
|
171
|
+
min_context_slot: minContextSlot,
|
|
172
|
+
commitment: commitment,
|
|
173
|
+
skip_preflight: skipPreflight,
|
|
174
|
+
max_retries: maxRetries,
|
|
175
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
176
|
+
};
|
|
177
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
178
|
+
? { options: options }
|
|
179
|
+
: null)), { payloads }));
|
|
180
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
181
|
+
return signatures;
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
break;
|
|
185
|
+
case 'signMessages':
|
|
186
|
+
target[p] = function (_a) {
|
|
187
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
190
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
191
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
192
|
+
return signedMessages;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
break;
|
|
196
|
+
case 'signTransactions':
|
|
197
|
+
target[p] = function (_a) {
|
|
198
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
201
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
202
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
203
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
204
|
+
return signedTransactions;
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
break;
|
|
208
|
+
default: {
|
|
209
|
+
target[p] = wallet[p];
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return target[p];
|
|
215
|
+
},
|
|
216
|
+
defineProperty() {
|
|
217
|
+
return false;
|
|
218
|
+
},
|
|
219
|
+
deleteProperty() {
|
|
220
|
+
return false;
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
213
224
|
|
|
214
|
-
export { transact, transactRemote };
|
|
225
|
+
export { startRemoteScenario, transact, transactRemote };
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VersionedMessage, Transaction, VersionedTransaction, SIGNATURE_LENGTH_IN_BYTES } from '@solana/web3.js';
|
|
2
|
-
import { transact as transact$1, transactRemote as transactRemote$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
2
|
+
import { transact as transact$1, transactRemote as transactRemote$1, startRemoteScenario as startRemoteScenario$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
3
3
|
import bs58 from 'bs58';
|
|
4
4
|
|
|
5
5
|
/******************************************************************************
|
|
@@ -73,69 +73,7 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
73
73
|
function transact(callback, config) {
|
|
74
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
const augmentedCallback = (wallet) => {
|
|
76
|
-
|
|
77
|
-
get(target, p) {
|
|
78
|
-
if (target[p] == null) {
|
|
79
|
-
switch (p) {
|
|
80
|
-
case 'signAndSendTransactions':
|
|
81
|
-
target[p] = function (_a) {
|
|
82
|
-
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
85
|
-
const options = {
|
|
86
|
-
min_context_slot: minContextSlot,
|
|
87
|
-
commitment: commitment,
|
|
88
|
-
skip_preflight: skipPreflight,
|
|
89
|
-
max_retries: maxRetries,
|
|
90
|
-
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
91
|
-
};
|
|
92
|
-
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
93
|
-
? { options: options }
|
|
94
|
-
: null)), { payloads }));
|
|
95
|
-
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
96
|
-
return signatures;
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
break;
|
|
100
|
-
case 'signMessages':
|
|
101
|
-
target[p] = function (_a) {
|
|
102
|
-
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
105
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
106
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
107
|
-
return signedMessages;
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
break;
|
|
111
|
-
case 'signTransactions':
|
|
112
|
-
target[p] = function (_a) {
|
|
113
|
-
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const payloads = transactions.map(getPayloadFromTransaction);
|
|
116
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
117
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
118
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
119
|
-
return signedTransactions;
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
break;
|
|
123
|
-
default: {
|
|
124
|
-
target[p] = wallet[p];
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return target[p];
|
|
130
|
-
},
|
|
131
|
-
defineProperty() {
|
|
132
|
-
return false;
|
|
133
|
-
},
|
|
134
|
-
deleteProperty() {
|
|
135
|
-
return false;
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
return callback(augmentedAPI);
|
|
76
|
+
return callback(augmentWalletAPI(wallet));
|
|
139
77
|
};
|
|
140
78
|
return yield transact$1(augmentedCallback, config);
|
|
141
79
|
});
|
|
@@ -210,5 +148,78 @@ function transactRemote(callback, config) {
|
|
|
210
148
|
return yield transactRemote$1(augmentedCallback, config);
|
|
211
149
|
});
|
|
212
150
|
}
|
|
151
|
+
function startRemoteScenario(config) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const { wallet, close, associationUrl } = yield startRemoteScenario$1(config);
|
|
154
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
155
|
+
return augmentWalletAPI(wallet);
|
|
156
|
+
});
|
|
157
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function augmentWalletAPI(wallet) {
|
|
161
|
+
return new Proxy({}, {
|
|
162
|
+
get(target, p) {
|
|
163
|
+
if (target[p] == null) {
|
|
164
|
+
switch (p) {
|
|
165
|
+
case 'signAndSendTransactions':
|
|
166
|
+
target[p] = function (_a) {
|
|
167
|
+
var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
170
|
+
const options = {
|
|
171
|
+
min_context_slot: minContextSlot,
|
|
172
|
+
commitment: commitment,
|
|
173
|
+
skip_preflight: skipPreflight,
|
|
174
|
+
max_retries: maxRetries,
|
|
175
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
176
|
+
};
|
|
177
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
|
|
178
|
+
? { options: options }
|
|
179
|
+
: null)), { payloads }));
|
|
180
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
181
|
+
return signatures;
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
break;
|
|
185
|
+
case 'signMessages':
|
|
186
|
+
target[p] = function (_a) {
|
|
187
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
190
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
191
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
192
|
+
return signedMessages;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
break;
|
|
196
|
+
case 'signTransactions':
|
|
197
|
+
target[p] = function (_a) {
|
|
198
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
201
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
202
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
203
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
204
|
+
return signedTransactions;
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
break;
|
|
208
|
+
default: {
|
|
209
|
+
target[p] = wallet[p];
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return target[p];
|
|
215
|
+
},
|
|
216
|
+
defineProperty() {
|
|
217
|
+
return false;
|
|
218
|
+
},
|
|
219
|
+
deleteProperty() {
|
|
220
|
+
return false;
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
213
224
|
|
|
214
|
-
export { transact, transactRemote };
|
|
225
|
+
export { startRemoteScenario, transact, transactRemote };
|
|
@@ -26,10 +26,18 @@ interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, Deauthor
|
|
|
26
26
|
}
|
|
27
27
|
interface Web3RemoteMobileWallet extends Web3MobileWallet, TerminateSessionAPI {
|
|
28
28
|
}
|
|
29
|
+
type Web3Scenario = Readonly<{
|
|
30
|
+
wallet: Promise<Web3MobileWallet>;
|
|
31
|
+
close: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
type Web3RemoteScenario = Web3Scenario & Readonly<{
|
|
34
|
+
associationUrl: URL;
|
|
35
|
+
}>;
|
|
29
36
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
30
37
|
declare function transactRemote<TReturn>(callback: (wallet: Web3RemoteMobileWallet) => TReturn, config: RemoteWalletAssociationConfig): Promise<{
|
|
31
38
|
associationUrl: URL;
|
|
32
39
|
result: Promise<TReturn>;
|
|
33
40
|
}>;
|
|
34
|
-
|
|
41
|
+
declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<Web3RemoteScenario>;
|
|
42
|
+
export { Web3MobileWallet, Web3RemoteMobileWallet, Web3Scenario, Web3RemoteScenario, transact, transactRemote, startRemoteScenario };
|
|
35
43
|
//# sourceMappingURL=index.browser.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,10 +26,18 @@ interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, Deauthor
|
|
|
26
26
|
}
|
|
27
27
|
interface Web3RemoteMobileWallet extends Web3MobileWallet, TerminateSessionAPI {
|
|
28
28
|
}
|
|
29
|
+
type Web3Scenario = Readonly<{
|
|
30
|
+
wallet: Promise<Web3MobileWallet>;
|
|
31
|
+
close: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
type Web3RemoteScenario = Web3Scenario & Readonly<{
|
|
34
|
+
associationUrl: URL;
|
|
35
|
+
}>;
|
|
29
36
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
30
37
|
declare function transactRemote<TReturn>(callback: (wallet: Web3RemoteMobileWallet) => TReturn, config: RemoteWalletAssociationConfig): Promise<{
|
|
31
38
|
associationUrl: URL;
|
|
32
39
|
result: Promise<TReturn>;
|
|
33
40
|
}>;
|
|
34
|
-
|
|
41
|
+
declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<Web3RemoteScenario>;
|
|
42
|
+
export { Web3MobileWallet, Web3RemoteMobileWallet, Web3Scenario, Web3RemoteScenario, transact, transactRemote, startRemoteScenario };
|
|
35
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -26,10 +26,18 @@ interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, Deauthor
|
|
|
26
26
|
}
|
|
27
27
|
interface Web3RemoteMobileWallet extends Web3MobileWallet, TerminateSessionAPI {
|
|
28
28
|
}
|
|
29
|
+
type Web3Scenario = Readonly<{
|
|
30
|
+
wallet: Promise<Web3MobileWallet>;
|
|
31
|
+
close: () => void;
|
|
32
|
+
}>;
|
|
33
|
+
type Web3RemoteScenario = Web3Scenario & Readonly<{
|
|
34
|
+
associationUrl: URL;
|
|
35
|
+
}>;
|
|
29
36
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
30
37
|
declare function transactRemote<TReturn>(callback: (wallet: Web3RemoteMobileWallet) => TReturn, config: RemoteWalletAssociationConfig): Promise<{
|
|
31
38
|
associationUrl: URL;
|
|
32
39
|
result: Promise<TReturn>;
|
|
33
40
|
}>;
|
|
34
|
-
|
|
41
|
+
declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<Web3RemoteScenario>;
|
|
42
|
+
export { Web3MobileWallet, Web3RemoteMobileWallet, Web3Scenario, Web3RemoteScenario, transact, transactRemote, startRemoteScenario };
|
|
35
43
|
//# 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-web3js",
|
|
3
3
|
"description": "A convenience wrapper that enables you to call Solana Mobile Stack protocol methods using objects from @solana/web3.js",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.8",
|
|
5
5
|
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@solana/web3.js": "^1.58.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@solana-mobile/mobile-wallet-adapter-protocol": "^2.1.
|
|
47
|
+
"@solana-mobile/mobile-wallet-adapter-protocol": "^2.1.8",
|
|
48
48
|
"bs58": "^5.0.0",
|
|
49
49
|
"js-base64": "^3.7.5"
|
|
50
50
|
},
|