@solana-mobile/mobile-wallet-adapter-protocol-web3js 0.0.1-alpha.6 → 0.0.1-alpha.7
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 +6 -5
- package/lib/cjs/index.js +6 -5
- package/lib/cjs/index.native.js +4 -12
- package/lib/esm/index.browser.mjs +6 -5
- package/lib/esm/index.mjs +6 -5
- package/lib/types/index.browser.d.mts.map +1 -1
- package/lib/types/index.browser.d.ts.map +1 -1
- package/lib/types/index.d.mts.map +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.native.d.ts.map +1 -1
- package/package.json +4 -3
package/lib/cjs/index.browser.js
CHANGED
|
@@ -30,15 +30,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function
|
|
33
|
+
function fromUint8Array(byteArray) {
|
|
34
34
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
37
37
|
return new Uint8Array(window
|
|
38
38
|
.atob(base64EncodedByteArray)
|
|
39
39
|
.split('')
|
|
40
40
|
.map((c) => c.charCodeAt(0)));
|
|
41
41
|
}
|
|
42
|
+
|
|
42
43
|
function transact(callback, config) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const augmentedCallback = (wallet) => {
|
|
@@ -96,12 +97,12 @@ function transact(callback, config) {
|
|
|
96
97
|
case 'signMessage':
|
|
97
98
|
target[p] = function (params) {
|
|
98
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const payloads = params.payloads.map(
|
|
100
|
+
const payloads = params.payloads.map(fromUint8Array);
|
|
100
101
|
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
101
102
|
auth_token: params.auth_token,
|
|
102
103
|
payloads,
|
|
103
104
|
});
|
|
104
|
-
const signedMessages = base64EncodedSignedMessages.map(
|
|
105
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
105
106
|
return signedMessages;
|
|
106
107
|
});
|
|
107
108
|
};
|
|
@@ -118,7 +119,7 @@ function transact(callback, config) {
|
|
|
118
119
|
auth_token: params.auth_token,
|
|
119
120
|
payloads,
|
|
120
121
|
});
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(
|
|
122
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
122
123
|
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
124
|
return transactions;
|
|
124
125
|
});
|
package/lib/cjs/index.js
CHANGED
|
@@ -30,15 +30,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function
|
|
33
|
+
function fromUint8Array(byteArray) {
|
|
34
34
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
37
37
|
return new Uint8Array(window
|
|
38
38
|
.atob(base64EncodedByteArray)
|
|
39
39
|
.split('')
|
|
40
40
|
.map((c) => c.charCodeAt(0)));
|
|
41
41
|
}
|
|
42
|
+
|
|
42
43
|
function transact(callback, config) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const augmentedCallback = (wallet) => {
|
|
@@ -96,12 +97,12 @@ function transact(callback, config) {
|
|
|
96
97
|
case 'signMessage':
|
|
97
98
|
target[p] = function (params) {
|
|
98
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const payloads = params.payloads.map(
|
|
100
|
+
const payloads = params.payloads.map(fromUint8Array);
|
|
100
101
|
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
101
102
|
auth_token: params.auth_token,
|
|
102
103
|
payloads,
|
|
103
104
|
});
|
|
104
|
-
const signedMessages = base64EncodedSignedMessages.map(
|
|
105
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
105
106
|
return signedMessages;
|
|
106
107
|
});
|
|
107
108
|
};
|
|
@@ -118,7 +119,7 @@ function transact(callback, config) {
|
|
|
118
119
|
auth_token: params.auth_token,
|
|
119
120
|
payloads,
|
|
120
121
|
});
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(
|
|
122
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
122
123
|
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
124
|
return transactions;
|
|
124
125
|
});
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -4,6 +4,7 @@ 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 jsBase64 = require('js-base64');
|
|
7
8
|
|
|
8
9
|
/******************************************************************************
|
|
9
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -30,15 +31,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
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
34
|
function transact(callback, config) {
|
|
43
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
36
|
const augmentedCallback = (wallet) => {
|
|
@@ -96,12 +88,12 @@ function transact(callback, config) {
|
|
|
96
88
|
case 'signMessage':
|
|
97
89
|
target[p] = function (params) {
|
|
98
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const payloads = params.payloads.map(
|
|
91
|
+
const payloads = params.payloads.map(jsBase64.fromUint8Array);
|
|
100
92
|
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
101
93
|
auth_token: params.auth_token,
|
|
102
94
|
payloads,
|
|
103
95
|
});
|
|
104
|
-
const signedMessages = base64EncodedSignedMessages.map(
|
|
96
|
+
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
105
97
|
return signedMessages;
|
|
106
98
|
});
|
|
107
99
|
};
|
|
@@ -118,7 +110,7 @@ function transact(callback, config) {
|
|
|
118
110
|
auth_token: params.auth_token,
|
|
119
111
|
payloads,
|
|
120
112
|
});
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(
|
|
113
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
122
114
|
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
115
|
return transactions;
|
|
124
116
|
});
|
|
@@ -26,15 +26,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function fromUint8Array(byteArray) {
|
|
30
30
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
33
33
|
return new Uint8Array(window
|
|
34
34
|
.atob(base64EncodedByteArray)
|
|
35
35
|
.split('')
|
|
36
36
|
.map((c) => c.charCodeAt(0)));
|
|
37
37
|
}
|
|
38
|
+
|
|
38
39
|
function transact(callback, config) {
|
|
39
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
const augmentedCallback = (wallet) => {
|
|
@@ -92,12 +93,12 @@ function transact(callback, config) {
|
|
|
92
93
|
case 'signMessage':
|
|
93
94
|
target[p] = function (params) {
|
|
94
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const payloads = params.payloads.map(
|
|
96
|
+
const payloads = params.payloads.map(fromUint8Array);
|
|
96
97
|
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
97
98
|
auth_token: params.auth_token,
|
|
98
99
|
payloads,
|
|
99
100
|
});
|
|
100
|
-
const signedMessages = base64EncodedSignedMessages.map(
|
|
101
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
101
102
|
return signedMessages;
|
|
102
103
|
});
|
|
103
104
|
};
|
|
@@ -114,7 +115,7 @@ function transact(callback, config) {
|
|
|
114
115
|
auth_token: params.auth_token,
|
|
115
116
|
payloads,
|
|
116
117
|
});
|
|
117
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(
|
|
118
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
118
119
|
const transactions = compiledTransactions.map(Transaction.from);
|
|
119
120
|
return transactions;
|
|
120
121
|
});
|
package/lib/esm/index.mjs
CHANGED
|
@@ -26,15 +26,16 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function fromUint8Array(byteArray) {
|
|
30
30
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function toUint8Array(base64EncodedByteArray) {
|
|
33
33
|
return new Uint8Array(window
|
|
34
34
|
.atob(base64EncodedByteArray)
|
|
35
35
|
.split('')
|
|
36
36
|
.map((c) => c.charCodeAt(0)));
|
|
37
37
|
}
|
|
38
|
+
|
|
38
39
|
function transact(callback, config) {
|
|
39
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
const augmentedCallback = (wallet) => {
|
|
@@ -92,12 +93,12 @@ function transact(callback, config) {
|
|
|
92
93
|
case 'signMessage':
|
|
93
94
|
target[p] = function (params) {
|
|
94
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
const payloads = params.payloads.map(
|
|
96
|
+
const payloads = params.payloads.map(fromUint8Array);
|
|
96
97
|
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
97
98
|
auth_token: params.auth_token,
|
|
98
99
|
payloads,
|
|
99
100
|
});
|
|
100
|
-
const signedMessages = base64EncodedSignedMessages.map(
|
|
101
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
101
102
|
return signedMessages;
|
|
102
103
|
});
|
|
103
104
|
};
|
|
@@ -114,7 +115,7 @@ function transact(callback, config) {
|
|
|
114
115
|
auth_token: params.auth_token,
|
|
115
116
|
payloads,
|
|
116
117
|
});
|
|
117
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(
|
|
118
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
118
119
|
const transactions = compiledTransactions.map(Transaction.from);
|
|
119
120
|
return transactions;
|
|
120
121
|
});
|
|
@@ -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 +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":""}
|
|
@@ -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.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 +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.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.7",
|
|
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",
|
|
@@ -40,10 +40,11 @@
|
|
|
40
40
|
"@solana/web3.js": "^1.48.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@solana-mobile/mobile-wallet-adapter-protocol": "^0.0.1-alpha.
|
|
43
|
+
"@solana-mobile/mobile-wallet-adapter-protocol": "^0.0.1-alpha.7",
|
|
44
|
+
"js-base64": "^3.7.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"agadoo": "^2.0.0"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "3af26689f4dddaa208fc32ea9c7cf4046c767c78"
|
|
49
50
|
}
|