@solana-mobile/mobile-wallet-adapter-protocol-web3js 0.0.1-alpha.6 → 0.9.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/lib/cjs/index.browser.js +43 -57
- package/lib/cjs/index.js +43 -57
- package/lib/cjs/index.native.js +41 -64
- package/lib/esm/index.browser.mjs +39 -57
- package/lib/esm/index.mjs +39 -57
- package/lib/types/index.browser.d.mts +11 -14
- package/lib/types/index.browser.d.mts.map +1 -1
- package/lib/types/index.browser.d.ts +11 -14
- package/lib/types/index.browser.d.ts.map +1 -1
- package/lib/types/index.d.mts +11 -14
- package/lib/types/index.d.mts.map +1 -1
- package/lib/types/index.d.ts +11 -14
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.native.d.ts +11 -14
- package/lib/types/index.native.d.ts.map +1 -1
- package/package.json +8 -5
package/lib/cjs/index.browser.js
CHANGED
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var web3_js = require('@solana/web3.js');
|
|
6
6
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
|
+
var bs58 = require('bs58');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
7
12
|
|
|
8
13
|
/******************************************************************************
|
|
9
14
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,6 +25,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
20
25
|
PERFORMANCE OF THIS SOFTWARE.
|
|
21
26
|
***************************************************************************** */
|
|
22
27
|
|
|
28
|
+
function __rest(s, e) {
|
|
29
|
+
var t = {};
|
|
30
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
31
|
+
t[p] = s[p];
|
|
32
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
33
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
34
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
35
|
+
t[p[i]] = s[p[i]];
|
|
36
|
+
}
|
|
37
|
+
return t;
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
24
41
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
42
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -30,15 +47,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
47
|
});
|
|
31
48
|
}
|
|
32
49
|
|
|
33
|
-
function
|
|
50
|
+
function fromUint8Array(byteArray) {
|
|
34
51
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
35
52
|
}
|
|
36
|
-
function
|
|
53
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
37
54
|
return new Uint8Array(window
|
|
38
55
|
.atob(base64EncodedByteArray)
|
|
39
56
|
.split('')
|
|
40
57
|
.map((c) => c.charCodeAt(0)));
|
|
41
58
|
}
|
|
59
|
+
|
|
42
60
|
function transact(callback, config) {
|
|
43
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
62
|
const augmentedCallback = (wallet) => {
|
|
@@ -46,81 +64,49 @@ function transact(callback, config) {
|
|
|
46
64
|
get(target, p) {
|
|
47
65
|
if (target[p] == null) {
|
|
48
66
|
switch (p) {
|
|
49
|
-
case '
|
|
50
|
-
target[p] = function (
|
|
67
|
+
case 'signAndSendTransactions':
|
|
68
|
+
target[p] = function (_a) {
|
|
69
|
+
var { minContextSlot, transactions } = _a, rest = __rest(_a, ["minContextSlot", "transactions"]);
|
|
51
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
if (latestBlockhashPromise == null) {
|
|
56
|
-
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
57
|
-
commitment: connection.commitment,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return yield latestBlockhashPromise;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
if (transaction.feePayer == null) {
|
|
65
|
-
transaction.feePayer = params.fee_payer;
|
|
66
|
-
}
|
|
67
|
-
if (transaction.recentBlockhash == null) {
|
|
68
|
-
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
69
|
-
transaction.recentBlockhash = blockhash;
|
|
70
|
-
}
|
|
71
|
-
const serializedTransaction = transaction.serialize({
|
|
71
|
+
const payloads = yield Promise.all(transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const serializedTransaction = yield transaction.serialize({
|
|
72
73
|
requireAllSignatures: false,
|
|
73
74
|
verifySignatures: false,
|
|
74
75
|
});
|
|
75
76
|
return serializedTransaction.toString('base64');
|
|
76
77
|
})));
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
case 'processed':
|
|
82
|
-
targetCommitment = params.connection.commitment;
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
targetCommitment = 'finalized';
|
|
86
|
-
}
|
|
87
|
-
const { signatures } = yield wallet.signAndSendTransaction({
|
|
88
|
-
auth_token: params.auth_token,
|
|
89
|
-
commitment: targetCommitment,
|
|
90
|
-
payloads,
|
|
91
|
-
});
|
|
78
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (minContextSlot != null
|
|
79
|
+
? { options: { min_context_slot: minContextSlot } }
|
|
80
|
+
: null)), { payloads }));
|
|
81
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58__default["default"].encode);
|
|
92
82
|
return signatures;
|
|
93
83
|
});
|
|
94
84
|
};
|
|
95
85
|
break;
|
|
96
|
-
case '
|
|
97
|
-
target[p] = function (
|
|
86
|
+
case 'signMessages':
|
|
87
|
+
target[p] = function (_a) {
|
|
88
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
98
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const
|
|
100
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.
|
|
101
|
-
|
|
102
|
-
payloads,
|
|
103
|
-
});
|
|
104
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
90
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
91
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
92
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
105
93
|
return signedMessages;
|
|
106
94
|
});
|
|
107
95
|
};
|
|
108
96
|
break;
|
|
109
|
-
case '
|
|
110
|
-
target[p] = function (
|
|
97
|
+
case 'signTransactions':
|
|
98
|
+
target[p] = function (_a) {
|
|
99
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
111
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const serializedTransactions =
|
|
101
|
+
const serializedTransactions = transactions.map((transaction) => transaction.serialize({
|
|
113
102
|
requireAllSignatures: false,
|
|
114
103
|
verifySignatures: false,
|
|
115
104
|
}));
|
|
116
105
|
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
117
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
122
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
|
-
return transactions;
|
|
106
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
107
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
108
|
+
const signedTransactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
109
|
+
return signedTransactions;
|
|
124
110
|
});
|
|
125
111
|
};
|
|
126
112
|
break;
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var web3_js = require('@solana/web3.js');
|
|
6
6
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
|
+
var bs58 = require('bs58');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
7
12
|
|
|
8
13
|
/******************************************************************************
|
|
9
14
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,6 +25,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
20
25
|
PERFORMANCE OF THIS SOFTWARE.
|
|
21
26
|
***************************************************************************** */
|
|
22
27
|
|
|
28
|
+
function __rest(s, e) {
|
|
29
|
+
var t = {};
|
|
30
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
31
|
+
t[p] = s[p];
|
|
32
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
33
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
34
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
35
|
+
t[p[i]] = s[p[i]];
|
|
36
|
+
}
|
|
37
|
+
return t;
|
|
38
|
+
}
|
|
39
|
+
|
|
23
40
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
24
41
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
42
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -30,15 +47,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
47
|
});
|
|
31
48
|
}
|
|
32
49
|
|
|
33
|
-
function
|
|
50
|
+
function fromUint8Array(byteArray) {
|
|
34
51
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
35
52
|
}
|
|
36
|
-
function
|
|
53
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
37
54
|
return new Uint8Array(window
|
|
38
55
|
.atob(base64EncodedByteArray)
|
|
39
56
|
.split('')
|
|
40
57
|
.map((c) => c.charCodeAt(0)));
|
|
41
58
|
}
|
|
59
|
+
|
|
42
60
|
function transact(callback, config) {
|
|
43
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
62
|
const augmentedCallback = (wallet) => {
|
|
@@ -46,81 +64,49 @@ function transact(callback, config) {
|
|
|
46
64
|
get(target, p) {
|
|
47
65
|
if (target[p] == null) {
|
|
48
66
|
switch (p) {
|
|
49
|
-
case '
|
|
50
|
-
target[p] = function (
|
|
67
|
+
case 'signAndSendTransactions':
|
|
68
|
+
target[p] = function (_a) {
|
|
69
|
+
var { minContextSlot, transactions } = _a, rest = __rest(_a, ["minContextSlot", "transactions"]);
|
|
51
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
if (latestBlockhashPromise == null) {
|
|
56
|
-
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
57
|
-
commitment: connection.commitment,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return yield latestBlockhashPromise;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
if (transaction.feePayer == null) {
|
|
65
|
-
transaction.feePayer = params.fee_payer;
|
|
66
|
-
}
|
|
67
|
-
if (transaction.recentBlockhash == null) {
|
|
68
|
-
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
69
|
-
transaction.recentBlockhash = blockhash;
|
|
70
|
-
}
|
|
71
|
-
const serializedTransaction = transaction.serialize({
|
|
71
|
+
const payloads = yield Promise.all(transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const serializedTransaction = yield transaction.serialize({
|
|
72
73
|
requireAllSignatures: false,
|
|
73
74
|
verifySignatures: false,
|
|
74
75
|
});
|
|
75
76
|
return serializedTransaction.toString('base64');
|
|
76
77
|
})));
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
case 'processed':
|
|
82
|
-
targetCommitment = params.connection.commitment;
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
targetCommitment = 'finalized';
|
|
86
|
-
}
|
|
87
|
-
const { signatures } = yield wallet.signAndSendTransaction({
|
|
88
|
-
auth_token: params.auth_token,
|
|
89
|
-
commitment: targetCommitment,
|
|
90
|
-
payloads,
|
|
91
|
-
});
|
|
78
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (minContextSlot != null
|
|
79
|
+
? { options: { min_context_slot: minContextSlot } }
|
|
80
|
+
: null)), { payloads }));
|
|
81
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58__default["default"].encode);
|
|
92
82
|
return signatures;
|
|
93
83
|
});
|
|
94
84
|
};
|
|
95
85
|
break;
|
|
96
|
-
case '
|
|
97
|
-
target[p] = function (
|
|
86
|
+
case 'signMessages':
|
|
87
|
+
target[p] = function (_a) {
|
|
88
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
98
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const
|
|
100
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.
|
|
101
|
-
|
|
102
|
-
payloads,
|
|
103
|
-
});
|
|
104
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
90
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
91
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
92
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
105
93
|
return signedMessages;
|
|
106
94
|
});
|
|
107
95
|
};
|
|
108
96
|
break;
|
|
109
|
-
case '
|
|
110
|
-
target[p] = function (
|
|
97
|
+
case 'signTransactions':
|
|
98
|
+
target[p] = function (_a) {
|
|
99
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
111
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const serializedTransactions =
|
|
101
|
+
const serializedTransactions = transactions.map((transaction) => transaction.serialize({
|
|
113
102
|
requireAllSignatures: false,
|
|
114
103
|
verifySignatures: false,
|
|
115
104
|
}));
|
|
116
105
|
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
117
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
122
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
|
-
return transactions;
|
|
106
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
107
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
108
|
+
const signedTransactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
109
|
+
return signedTransactions;
|
|
124
110
|
});
|
|
125
111
|
};
|
|
126
112
|
break;
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -4,6 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var web3_js = require('@solana/web3.js');
|
|
6
6
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
|
+
var bs58 = require('bs58');
|
|
8
|
+
var jsBase64 = require('js-base64');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
7
13
|
|
|
8
14
|
/******************************************************************************
|
|
9
15
|
Copyright (c) Microsoft Corporation.
|
|
@@ -20,6 +26,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
20
26
|
PERFORMANCE OF THIS SOFTWARE.
|
|
21
27
|
***************************************************************************** */
|
|
22
28
|
|
|
29
|
+
function __rest(s, e) {
|
|
30
|
+
var t = {};
|
|
31
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32
|
+
t[p] = s[p];
|
|
33
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
34
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
36
|
+
t[p[i]] = s[p[i]];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
|
|
23
41
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
24
42
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
43
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -30,15 +48,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
48
|
});
|
|
31
49
|
}
|
|
32
50
|
|
|
33
|
-
function getBase64StringFromByteArray(byteArray) {
|
|
34
|
-
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
35
|
-
}
|
|
36
|
-
function getByteArrayFromBase64String(base64EncodedByteArray) {
|
|
37
|
-
return new Uint8Array(window
|
|
38
|
-
.atob(base64EncodedByteArray)
|
|
39
|
-
.split('')
|
|
40
|
-
.map((c) => c.charCodeAt(0)));
|
|
41
|
-
}
|
|
42
51
|
function transact(callback, config) {
|
|
43
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
53
|
const augmentedCallback = (wallet) => {
|
|
@@ -46,81 +55,49 @@ function transact(callback, config) {
|
|
|
46
55
|
get(target, p) {
|
|
47
56
|
if (target[p] == null) {
|
|
48
57
|
switch (p) {
|
|
49
|
-
case '
|
|
50
|
-
target[p] = function (
|
|
58
|
+
case 'signAndSendTransactions':
|
|
59
|
+
target[p] = function (_a) {
|
|
60
|
+
var { minContextSlot, transactions } = _a, rest = __rest(_a, ["minContextSlot", "transactions"]);
|
|
51
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
if (latestBlockhashPromise == null) {
|
|
56
|
-
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
57
|
-
commitment: connection.commitment,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return yield latestBlockhashPromise;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
if (transaction.feePayer == null) {
|
|
65
|
-
transaction.feePayer = params.fee_payer;
|
|
66
|
-
}
|
|
67
|
-
if (transaction.recentBlockhash == null) {
|
|
68
|
-
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
69
|
-
transaction.recentBlockhash = blockhash;
|
|
70
|
-
}
|
|
71
|
-
const serializedTransaction = transaction.serialize({
|
|
62
|
+
const payloads = yield Promise.all(transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const serializedTransaction = yield transaction.serialize({
|
|
72
64
|
requireAllSignatures: false,
|
|
73
65
|
verifySignatures: false,
|
|
74
66
|
});
|
|
75
67
|
return serializedTransaction.toString('base64');
|
|
76
68
|
})));
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
case 'processed':
|
|
82
|
-
targetCommitment = params.connection.commitment;
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
targetCommitment = 'finalized';
|
|
86
|
-
}
|
|
87
|
-
const { signatures } = yield wallet.signAndSendTransaction({
|
|
88
|
-
auth_token: params.auth_token,
|
|
89
|
-
commitment: targetCommitment,
|
|
90
|
-
payloads,
|
|
91
|
-
});
|
|
69
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (minContextSlot != null
|
|
70
|
+
? { options: { min_context_slot: minContextSlot } }
|
|
71
|
+
: null)), { payloads }));
|
|
72
|
+
const signatures = base64EncodedSignatures.map(jsBase64.toUint8Array).map(bs58__default["default"].encode);
|
|
92
73
|
return signatures;
|
|
93
74
|
});
|
|
94
75
|
};
|
|
95
76
|
break;
|
|
96
|
-
case '
|
|
97
|
-
target[p] = function (
|
|
77
|
+
case 'signMessages':
|
|
78
|
+
target[p] = function (_a) {
|
|
79
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
98
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const
|
|
100
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.
|
|
101
|
-
|
|
102
|
-
payloads,
|
|
103
|
-
});
|
|
104
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
81
|
+
const base64EncodedPayloads = payloads.map(jsBase64.fromUint8Array);
|
|
82
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
83
|
+
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
105
84
|
return signedMessages;
|
|
106
85
|
});
|
|
107
86
|
};
|
|
108
87
|
break;
|
|
109
|
-
case '
|
|
110
|
-
target[p] = function (
|
|
88
|
+
case 'signTransactions':
|
|
89
|
+
target[p] = function (_a) {
|
|
90
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
111
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const serializedTransactions =
|
|
92
|
+
const serializedTransactions = transactions.map((transaction) => transaction.serialize({
|
|
113
93
|
requireAllSignatures: false,
|
|
114
94
|
verifySignatures: false,
|
|
115
95
|
}));
|
|
116
96
|
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
117
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
122
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
|
-
return transactions;
|
|
97
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
98
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
99
|
+
const signedTransactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
100
|
+
return signedTransactions;
|
|
124
101
|
});
|
|
125
102
|
};
|
|
126
103
|
break;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Transaction } from '@solana/web3.js';
|
|
2
2
|
import { transact as transact$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
3
|
+
import bs58 from 'bs58';
|
|
3
4
|
|
|
4
5
|
/******************************************************************************
|
|
5
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -16,6 +17,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
16
17
|
PERFORMANCE OF THIS SOFTWARE.
|
|
17
18
|
***************************************************************************** */
|
|
18
19
|
|
|
20
|
+
function __rest(s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
+
t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
20
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -26,15 +39,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
26
39
|
});
|
|
27
40
|
}
|
|
28
41
|
|
|
29
|
-
function
|
|
42
|
+
function fromUint8Array(byteArray) {
|
|
30
43
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
31
44
|
}
|
|
32
|
-
function
|
|
45
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
33
46
|
return new Uint8Array(window
|
|
34
47
|
.atob(base64EncodedByteArray)
|
|
35
48
|
.split('')
|
|
36
49
|
.map((c) => c.charCodeAt(0)));
|
|
37
50
|
}
|
|
51
|
+
|
|
38
52
|
function transact(callback, config) {
|
|
39
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
54
|
const augmentedCallback = (wallet) => {
|
|
@@ -42,81 +56,49 @@ function transact(callback, config) {
|
|
|
42
56
|
get(target, p) {
|
|
43
57
|
if (target[p] == null) {
|
|
44
58
|
switch (p) {
|
|
45
|
-
case '
|
|
46
|
-
target[p] = function (
|
|
59
|
+
case 'signAndSendTransactions':
|
|
60
|
+
target[p] = function (_a) {
|
|
61
|
+
var { minContextSlot, transactions } = _a, rest = __rest(_a, ["minContextSlot", "transactions"]);
|
|
47
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
if (latestBlockhashPromise == null) {
|
|
52
|
-
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
53
|
-
commitment: connection.commitment,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return yield latestBlockhashPromise;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
if (transaction.feePayer == null) {
|
|
61
|
-
transaction.feePayer = params.fee_payer;
|
|
62
|
-
}
|
|
63
|
-
if (transaction.recentBlockhash == null) {
|
|
64
|
-
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
65
|
-
transaction.recentBlockhash = blockhash;
|
|
66
|
-
}
|
|
67
|
-
const serializedTransaction = transaction.serialize({
|
|
63
|
+
const payloads = yield Promise.all(transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const serializedTransaction = yield transaction.serialize({
|
|
68
65
|
requireAllSignatures: false,
|
|
69
66
|
verifySignatures: false,
|
|
70
67
|
});
|
|
71
68
|
return serializedTransaction.toString('base64');
|
|
72
69
|
})));
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
case 'processed':
|
|
78
|
-
targetCommitment = params.connection.commitment;
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
targetCommitment = 'finalized';
|
|
82
|
-
}
|
|
83
|
-
const { signatures } = yield wallet.signAndSendTransaction({
|
|
84
|
-
auth_token: params.auth_token,
|
|
85
|
-
commitment: targetCommitment,
|
|
86
|
-
payloads,
|
|
87
|
-
});
|
|
70
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (minContextSlot != null
|
|
71
|
+
? { options: { min_context_slot: minContextSlot } }
|
|
72
|
+
: null)), { payloads }));
|
|
73
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
88
74
|
return signatures;
|
|
89
75
|
});
|
|
90
76
|
};
|
|
91
77
|
break;
|
|
92
|
-
case '
|
|
93
|
-
target[p] = function (
|
|
78
|
+
case 'signMessages':
|
|
79
|
+
target[p] = function (_a) {
|
|
80
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
94
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const
|
|
96
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.
|
|
97
|
-
|
|
98
|
-
payloads,
|
|
99
|
-
});
|
|
100
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
82
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
83
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
84
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
101
85
|
return signedMessages;
|
|
102
86
|
});
|
|
103
87
|
};
|
|
104
88
|
break;
|
|
105
|
-
case '
|
|
106
|
-
target[p] = function (
|
|
89
|
+
case 'signTransactions':
|
|
90
|
+
target[p] = function (_a) {
|
|
91
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
107
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const serializedTransactions =
|
|
93
|
+
const serializedTransactions = transactions.map((transaction) => transaction.serialize({
|
|
109
94
|
requireAllSignatures: false,
|
|
110
95
|
verifySignatures: false,
|
|
111
96
|
}));
|
|
112
97
|
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
113
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
118
|
-
const transactions = compiledTransactions.map(Transaction.from);
|
|
119
|
-
return transactions;
|
|
98
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
99
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
100
|
+
const signedTransactions = compiledTransactions.map(Transaction.from);
|
|
101
|
+
return signedTransactions;
|
|
120
102
|
});
|
|
121
103
|
};
|
|
122
104
|
break;
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Transaction } from '@solana/web3.js';
|
|
2
2
|
import { transact as transact$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
3
|
+
import bs58 from 'bs58';
|
|
3
4
|
|
|
4
5
|
/******************************************************************************
|
|
5
6
|
Copyright (c) Microsoft Corporation.
|
|
@@ -16,6 +17,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
16
17
|
PERFORMANCE OF THIS SOFTWARE.
|
|
17
18
|
***************************************************************************** */
|
|
18
19
|
|
|
20
|
+
function __rest(s, e) {
|
|
21
|
+
var t = {};
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
+
t[p] = s[p];
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
+
t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
20
33
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21
34
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -26,15 +39,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
26
39
|
});
|
|
27
40
|
}
|
|
28
41
|
|
|
29
|
-
function
|
|
42
|
+
function fromUint8Array(byteArray) {
|
|
30
43
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
31
44
|
}
|
|
32
|
-
function
|
|
45
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
33
46
|
return new Uint8Array(window
|
|
34
47
|
.atob(base64EncodedByteArray)
|
|
35
48
|
.split('')
|
|
36
49
|
.map((c) => c.charCodeAt(0)));
|
|
37
50
|
}
|
|
51
|
+
|
|
38
52
|
function transact(callback, config) {
|
|
39
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
54
|
const augmentedCallback = (wallet) => {
|
|
@@ -42,81 +56,49 @@ function transact(callback, config) {
|
|
|
42
56
|
get(target, p) {
|
|
43
57
|
if (target[p] == null) {
|
|
44
58
|
switch (p) {
|
|
45
|
-
case '
|
|
46
|
-
target[p] = function (
|
|
59
|
+
case 'signAndSendTransactions':
|
|
60
|
+
target[p] = function (_a) {
|
|
61
|
+
var { minContextSlot, transactions } = _a, rest = __rest(_a, ["minContextSlot", "transactions"]);
|
|
47
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
if (latestBlockhashPromise == null) {
|
|
52
|
-
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
53
|
-
commitment: connection.commitment,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return yield latestBlockhashPromise;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
if (transaction.feePayer == null) {
|
|
61
|
-
transaction.feePayer = params.fee_payer;
|
|
62
|
-
}
|
|
63
|
-
if (transaction.recentBlockhash == null) {
|
|
64
|
-
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
65
|
-
transaction.recentBlockhash = blockhash;
|
|
66
|
-
}
|
|
67
|
-
const serializedTransaction = transaction.serialize({
|
|
63
|
+
const payloads = yield Promise.all(transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const serializedTransaction = yield transaction.serialize({
|
|
68
65
|
requireAllSignatures: false,
|
|
69
66
|
verifySignatures: false,
|
|
70
67
|
});
|
|
71
68
|
return serializedTransaction.toString('base64');
|
|
72
69
|
})));
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
case 'processed':
|
|
78
|
-
targetCommitment = params.connection.commitment;
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
targetCommitment = 'finalized';
|
|
82
|
-
}
|
|
83
|
-
const { signatures } = yield wallet.signAndSendTransaction({
|
|
84
|
-
auth_token: params.auth_token,
|
|
85
|
-
commitment: targetCommitment,
|
|
86
|
-
payloads,
|
|
87
|
-
});
|
|
70
|
+
const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (minContextSlot != null
|
|
71
|
+
? { options: { min_context_slot: minContextSlot } }
|
|
72
|
+
: null)), { payloads }));
|
|
73
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
88
74
|
return signatures;
|
|
89
75
|
});
|
|
90
76
|
};
|
|
91
77
|
break;
|
|
92
|
-
case '
|
|
93
|
-
target[p] = function (
|
|
78
|
+
case 'signMessages':
|
|
79
|
+
target[p] = function (_a) {
|
|
80
|
+
var { payloads } = _a, rest = __rest(_a, ["payloads"]);
|
|
94
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const
|
|
96
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.
|
|
97
|
-
|
|
98
|
-
payloads,
|
|
99
|
-
});
|
|
100
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
82
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
83
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
|
|
84
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
101
85
|
return signedMessages;
|
|
102
86
|
});
|
|
103
87
|
};
|
|
104
88
|
break;
|
|
105
|
-
case '
|
|
106
|
-
target[p] = function (
|
|
89
|
+
case 'signTransactions':
|
|
90
|
+
target[p] = function (_a) {
|
|
91
|
+
var { transactions } = _a, rest = __rest(_a, ["transactions"]);
|
|
107
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
const serializedTransactions =
|
|
93
|
+
const serializedTransactions = transactions.map((transaction) => transaction.serialize({
|
|
109
94
|
requireAllSignatures: false,
|
|
110
95
|
verifySignatures: false,
|
|
111
96
|
}));
|
|
112
97
|
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
113
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
118
|
-
const transactions = compiledTransactions.map(Transaction.from);
|
|
119
|
-
return transactions;
|
|
98
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
|
|
99
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
100
|
+
const signedTransactions = compiledTransactions.map(Transaction.from);
|
|
101
|
+
return signedTransactions;
|
|
120
102
|
});
|
|
121
103
|
};
|
|
122
104
|
break;
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthorizeAPI,
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
connection: Connection;
|
|
7
|
-
fee_payer?: PublicKey;
|
|
1
|
+
import { Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
|
+
import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
|
+
interface Web3SignAndSendTransactionsAPI {
|
|
4
|
+
signAndSendTransactions(params: {
|
|
5
|
+
minContextSlot?: number;
|
|
8
6
|
transactions: Transaction[];
|
|
9
7
|
}): Promise<TransactionSignature[]>;
|
|
10
8
|
}
|
|
11
|
-
interface
|
|
12
|
-
|
|
13
|
-
auth_token: AuthToken;
|
|
9
|
+
interface Web3SignTransactionsAPI {
|
|
10
|
+
signTransactions(params: {
|
|
14
11
|
transactions: Transaction[];
|
|
15
12
|
}): Promise<Transaction[]>;
|
|
16
13
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
interface Web3SignMessagesAPI {
|
|
15
|
+
signMessages(params: {
|
|
16
|
+
addresses: Base64EncodedAddress[];
|
|
20
17
|
payloads: Uint8Array[];
|
|
21
18
|
}): Promise<Uint8Array[]>;
|
|
22
19
|
}
|
|
23
|
-
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI,
|
|
20
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionsAPI, Web3SignTransactionsAPI, Web3SignMessagesAPI {
|
|
24
21
|
}
|
|
25
22
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
23
|
export { Web3MobileWallet, transact };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.browser.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthorizeAPI,
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
connection: Connection;
|
|
7
|
-
fee_payer?: PublicKey;
|
|
1
|
+
import { Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
|
+
import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
|
+
interface Web3SignAndSendTransactionsAPI {
|
|
4
|
+
signAndSendTransactions(params: {
|
|
5
|
+
minContextSlot?: number;
|
|
8
6
|
transactions: Transaction[];
|
|
9
7
|
}): Promise<TransactionSignature[]>;
|
|
10
8
|
}
|
|
11
|
-
interface
|
|
12
|
-
|
|
13
|
-
auth_token: AuthToken;
|
|
9
|
+
interface Web3SignTransactionsAPI {
|
|
10
|
+
signTransactions(params: {
|
|
14
11
|
transactions: Transaction[];
|
|
15
12
|
}): Promise<Transaction[]>;
|
|
16
13
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
interface Web3SignMessagesAPI {
|
|
15
|
+
signMessages(params: {
|
|
16
|
+
addresses: Base64EncodedAddress[];
|
|
20
17
|
payloads: Uint8Array[];
|
|
21
18
|
}): Promise<Uint8Array[]>;
|
|
22
19
|
}
|
|
23
|
-
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI,
|
|
20
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionsAPI, Web3SignTransactionsAPI, Web3SignMessagesAPI {
|
|
24
21
|
}
|
|
25
22
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
23
|
export { Web3MobileWallet, transact };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
package/lib/types/index.d.mts
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthorizeAPI,
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
connection: Connection;
|
|
7
|
-
fee_payer?: PublicKey;
|
|
1
|
+
import { Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
|
+
import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
|
+
interface Web3SignAndSendTransactionsAPI {
|
|
4
|
+
signAndSendTransactions(params: {
|
|
5
|
+
minContextSlot?: number;
|
|
8
6
|
transactions: Transaction[];
|
|
9
7
|
}): Promise<TransactionSignature[]>;
|
|
10
8
|
}
|
|
11
|
-
interface
|
|
12
|
-
|
|
13
|
-
auth_token: AuthToken;
|
|
9
|
+
interface Web3SignTransactionsAPI {
|
|
10
|
+
signTransactions(params: {
|
|
14
11
|
transactions: Transaction[];
|
|
15
12
|
}): Promise<Transaction[]>;
|
|
16
13
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
interface Web3SignMessagesAPI {
|
|
15
|
+
signMessages(params: {
|
|
16
|
+
addresses: Base64EncodedAddress[];
|
|
20
17
|
payloads: Uint8Array[];
|
|
21
18
|
}): Promise<Uint8Array[]>;
|
|
22
19
|
}
|
|
23
|
-
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI,
|
|
20
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionsAPI, Web3SignTransactionsAPI, Web3SignMessagesAPI {
|
|
24
21
|
}
|
|
25
22
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
23
|
export { Web3MobileWallet, transact };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthorizeAPI,
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
connection: Connection;
|
|
7
|
-
fee_payer?: PublicKey;
|
|
1
|
+
import { Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
|
+
import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
|
+
interface Web3SignAndSendTransactionsAPI {
|
|
4
|
+
signAndSendTransactions(params: {
|
|
5
|
+
minContextSlot?: number;
|
|
8
6
|
transactions: Transaction[];
|
|
9
7
|
}): Promise<TransactionSignature[]>;
|
|
10
8
|
}
|
|
11
|
-
interface
|
|
12
|
-
|
|
13
|
-
auth_token: AuthToken;
|
|
9
|
+
interface Web3SignTransactionsAPI {
|
|
10
|
+
signTransactions(params: {
|
|
14
11
|
transactions: Transaction[];
|
|
15
12
|
}): Promise<Transaction[]>;
|
|
16
13
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
interface Web3SignMessagesAPI {
|
|
15
|
+
signMessages(params: {
|
|
16
|
+
addresses: Base64EncodedAddress[];
|
|
20
17
|
payloads: Uint8Array[];
|
|
21
18
|
}): Promise<Uint8Array[]>;
|
|
22
19
|
}
|
|
23
|
-
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI,
|
|
20
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionsAPI, Web3SignTransactionsAPI, Web3SignMessagesAPI {
|
|
24
21
|
}
|
|
25
22
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
23
|
export { Web3MobileWallet, transact };
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthorizeAPI,
|
|
3
|
-
interface
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
connection: Connection;
|
|
7
|
-
fee_payer?: PublicKey;
|
|
1
|
+
import { Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
|
+
import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
|
+
interface Web3SignAndSendTransactionsAPI {
|
|
4
|
+
signAndSendTransactions(params: {
|
|
5
|
+
minContextSlot?: number;
|
|
8
6
|
transactions: Transaction[];
|
|
9
7
|
}): Promise<TransactionSignature[]>;
|
|
10
8
|
}
|
|
11
|
-
interface
|
|
12
|
-
|
|
13
|
-
auth_token: AuthToken;
|
|
9
|
+
interface Web3SignTransactionsAPI {
|
|
10
|
+
signTransactions(params: {
|
|
14
11
|
transactions: Transaction[];
|
|
15
12
|
}): Promise<Transaction[]>;
|
|
16
13
|
}
|
|
17
|
-
interface
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
interface Web3SignMessagesAPI {
|
|
15
|
+
signMessages(params: {
|
|
16
|
+
addresses: Base64EncodedAddress[];
|
|
20
17
|
payloads: Uint8Array[];
|
|
21
18
|
}): Promise<Uint8Array[]>;
|
|
22
19
|
}
|
|
23
|
-
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI,
|
|
20
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionsAPI, Web3SignTransactionsAPI, Web3SignMessagesAPI {
|
|
24
21
|
}
|
|
25
22
|
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
23
|
export { Web3MobileWallet, transact };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
|
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": "0.0
|
|
4
|
+
"version": "0.9.0",
|
|
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",
|
|
@@ -33,17 +33,20 @@
|
|
|
33
33
|
"clean": "shx rm -rf lib/*",
|
|
34
34
|
"build": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
|
|
35
35
|
"build:watch": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
|
|
36
|
-
"postbuild": "echo
|
|
36
|
+
"postbuild": "cross-env echo {\\\"type\\\":\\\"commonjs\\\"} | npx json > lib/cjs/package.json && echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json",
|
|
37
37
|
"prepublishOnly": "agadoo"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@solana/web3.js": "^1.48.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@solana-mobile/mobile-wallet-adapter-protocol": "^0.0
|
|
43
|
+
"@solana-mobile/mobile-wallet-adapter-protocol": "^0.9.0",
|
|
44
|
+
"bs58": "^5.0.0",
|
|
45
|
+
"js-base64": "^3.7.2"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"agadoo": "^2.0.0"
|
|
48
|
+
"agadoo": "^2.0.0",
|
|
49
|
+
"cross-env": "^7.0.3"
|
|
47
50
|
},
|
|
48
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "e8d08469864173ec8480e4cf069849d663500883"
|
|
49
52
|
}
|