@solana-mobile/mobile-wallet-adapter-protocol-web3js 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.browser.js +41 -87
- package/lib/cjs/index.js +41 -87
- package/lib/cjs/index.native.js +41 -87
- package/lib/esm/index.browser.js +42 -82
- package/lib/esm/index.js +42 -82
- package/package.json +61 -62
package/lib/cjs/index.browser.js
CHANGED
|
@@ -1,52 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var web3_js = require('@solana/web3.js');
|
|
6
4
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
5
|
var bs58 = require('bs58');
|
|
8
6
|
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
12
|
-
|
|
13
|
-
/******************************************************************************
|
|
14
|
-
Copyright (c) Microsoft Corporation.
|
|
15
|
-
|
|
16
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
17
|
-
purpose with or without fee is hereby granted.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
22
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
24
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
-
***************************************************************************** */
|
|
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
|
-
|
|
40
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
7
|
function fromUint8Array(byteArray) {
|
|
51
8
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
52
9
|
}
|
|
@@ -78,22 +35,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
78
35
|
return web3_js.VersionedTransaction.deserialize(byteArray);
|
|
79
36
|
}
|
|
80
37
|
}
|
|
81
|
-
function transact(callback, config) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
87
|
-
});
|
|
38
|
+
async function transact(callback, config) {
|
|
39
|
+
const augmentedCallback = (wallet) => {
|
|
40
|
+
return callback(augmentWalletAPI(wallet));
|
|
41
|
+
};
|
|
42
|
+
return await mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
88
43
|
}
|
|
89
|
-
function startRemoteScenario(config) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return augmentWalletAPI(wallet);
|
|
94
|
-
});
|
|
95
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
44
|
+
async function startRemoteScenario(config) {
|
|
45
|
+
const { wallet, close, associationUrl } = await mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
46
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
47
|
+
return augmentWalletAPI(wallet);
|
|
96
48
|
});
|
|
49
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
97
50
|
}
|
|
98
51
|
function augmentWalletAPI(wallet) {
|
|
99
52
|
return new Proxy({}, {
|
|
@@ -101,46 +54,47 @@ function augmentWalletAPI(wallet) {
|
|
|
101
54
|
if (target[p] == null) {
|
|
102
55
|
switch (p) {
|
|
103
56
|
case 'signAndSendTransactions':
|
|
104
|
-
target[p] = function (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
57
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
58
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
59
|
+
const options = {
|
|
60
|
+
min_context_slot: minContextSlot,
|
|
61
|
+
commitment: commitment,
|
|
62
|
+
skip_preflight: skipPreflight,
|
|
63
|
+
max_retries: maxRetries,
|
|
64
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
65
|
+
};
|
|
66
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
67
|
+
...rest,
|
|
68
|
+
...(Object.values(options).some(element => element != null)
|
|
116
69
|
? { options: options }
|
|
117
|
-
: null)
|
|
118
|
-
|
|
119
|
-
return signatures;
|
|
70
|
+
: null),
|
|
71
|
+
payloads,
|
|
120
72
|
});
|
|
73
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
74
|
+
return signatures;
|
|
121
75
|
};
|
|
122
76
|
break;
|
|
123
77
|
case 'signMessages':
|
|
124
|
-
target[p] = function (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
130
|
-
return signedMessages;
|
|
78
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
79
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
80
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
81
|
+
...rest,
|
|
82
|
+
payloads: base64EncodedPayloads,
|
|
131
83
|
});
|
|
84
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
85
|
+
return signedMessages;
|
|
132
86
|
};
|
|
133
87
|
break;
|
|
134
88
|
case 'signTransactions':
|
|
135
|
-
target[p] = function (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
141
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
142
|
-
return signedTransactions;
|
|
89
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
90
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
91
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
92
|
+
...rest,
|
|
93
|
+
payloads,
|
|
143
94
|
});
|
|
95
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
96
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
97
|
+
return signedTransactions;
|
|
144
98
|
};
|
|
145
99
|
break;
|
|
146
100
|
default: {
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,52 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var web3_js = require('@solana/web3.js');
|
|
6
4
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
5
|
var bs58 = require('bs58');
|
|
8
6
|
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
12
|
-
|
|
13
|
-
/******************************************************************************
|
|
14
|
-
Copyright (c) Microsoft Corporation.
|
|
15
|
-
|
|
16
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
17
|
-
purpose with or without fee is hereby granted.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
22
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
24
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
-
***************************************************************************** */
|
|
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
|
-
|
|
40
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
41
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
7
|
function fromUint8Array(byteArray) {
|
|
51
8
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
52
9
|
}
|
|
@@ -78,22 +35,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
78
35
|
return web3_js.VersionedTransaction.deserialize(byteArray);
|
|
79
36
|
}
|
|
80
37
|
}
|
|
81
|
-
function transact(callback, config) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
87
|
-
});
|
|
38
|
+
async function transact(callback, config) {
|
|
39
|
+
const augmentedCallback = (wallet) => {
|
|
40
|
+
return callback(augmentWalletAPI(wallet));
|
|
41
|
+
};
|
|
42
|
+
return await mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
88
43
|
}
|
|
89
|
-
function startRemoteScenario(config) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return augmentWalletAPI(wallet);
|
|
94
|
-
});
|
|
95
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
44
|
+
async function startRemoteScenario(config) {
|
|
45
|
+
const { wallet, close, associationUrl } = await mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
46
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
47
|
+
return augmentWalletAPI(wallet);
|
|
96
48
|
});
|
|
49
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
97
50
|
}
|
|
98
51
|
function augmentWalletAPI(wallet) {
|
|
99
52
|
return new Proxy({}, {
|
|
@@ -101,46 +54,47 @@ function augmentWalletAPI(wallet) {
|
|
|
101
54
|
if (target[p] == null) {
|
|
102
55
|
switch (p) {
|
|
103
56
|
case 'signAndSendTransactions':
|
|
104
|
-
target[p] = function (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
57
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
58
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
59
|
+
const options = {
|
|
60
|
+
min_context_slot: minContextSlot,
|
|
61
|
+
commitment: commitment,
|
|
62
|
+
skip_preflight: skipPreflight,
|
|
63
|
+
max_retries: maxRetries,
|
|
64
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
65
|
+
};
|
|
66
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
67
|
+
...rest,
|
|
68
|
+
...(Object.values(options).some(element => element != null)
|
|
116
69
|
? { options: options }
|
|
117
|
-
: null)
|
|
118
|
-
|
|
119
|
-
return signatures;
|
|
70
|
+
: null),
|
|
71
|
+
payloads,
|
|
120
72
|
});
|
|
73
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
74
|
+
return signatures;
|
|
121
75
|
};
|
|
122
76
|
break;
|
|
123
77
|
case 'signMessages':
|
|
124
|
-
target[p] = function (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
130
|
-
return signedMessages;
|
|
78
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
79
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
80
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
81
|
+
...rest,
|
|
82
|
+
payloads: base64EncodedPayloads,
|
|
131
83
|
});
|
|
84
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
85
|
+
return signedMessages;
|
|
132
86
|
};
|
|
133
87
|
break;
|
|
134
88
|
case 'signTransactions':
|
|
135
|
-
target[p] = function (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
141
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
142
|
-
return signedTransactions;
|
|
89
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
90
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
91
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
92
|
+
...rest,
|
|
93
|
+
payloads,
|
|
143
94
|
});
|
|
95
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
96
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
97
|
+
return signedTransactions;
|
|
144
98
|
};
|
|
145
99
|
break;
|
|
146
100
|
default: {
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -1,53 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var web3_js = require('@solana/web3.js');
|
|
6
4
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
5
|
var bs58 = require('bs58');
|
|
8
6
|
var jsBase64 = require('js-base64');
|
|
9
7
|
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
|
|
13
|
-
|
|
14
|
-
/******************************************************************************
|
|
15
|
-
Copyright (c) Microsoft Corporation.
|
|
16
|
-
|
|
17
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
18
|
-
purpose with or without fee is hereby granted.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
22
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
24
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
-
***************************************************************************** */
|
|
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
|
-
|
|
41
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
42
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
43
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
44
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
45
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
46
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
47
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
8
|
function getPayloadFromTransaction(transaction) {
|
|
52
9
|
const serializedTransaction = 'version' in transaction
|
|
53
10
|
? transaction.serialize()
|
|
@@ -69,22 +26,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
69
26
|
return web3_js.VersionedTransaction.deserialize(byteArray);
|
|
70
27
|
}
|
|
71
28
|
}
|
|
72
|
-
function transact(callback, config) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
78
|
-
});
|
|
29
|
+
async function transact(callback, config) {
|
|
30
|
+
const augmentedCallback = (wallet) => {
|
|
31
|
+
return callback(augmentWalletAPI(wallet));
|
|
32
|
+
};
|
|
33
|
+
return await mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
79
34
|
}
|
|
80
|
-
function startRemoteScenario(config) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return augmentWalletAPI(wallet);
|
|
85
|
-
});
|
|
86
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
35
|
+
async function startRemoteScenario(config) {
|
|
36
|
+
const { wallet, close, associationUrl } = await mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
37
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
38
|
+
return augmentWalletAPI(wallet);
|
|
87
39
|
});
|
|
40
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
88
41
|
}
|
|
89
42
|
function augmentWalletAPI(wallet) {
|
|
90
43
|
return new Proxy({}, {
|
|
@@ -92,46 +45,47 @@ function augmentWalletAPI(wallet) {
|
|
|
92
45
|
if (target[p] == null) {
|
|
93
46
|
switch (p) {
|
|
94
47
|
case 'signAndSendTransactions':
|
|
95
|
-
target[p] = function (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
48
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
49
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
50
|
+
const options = {
|
|
51
|
+
min_context_slot: minContextSlot,
|
|
52
|
+
commitment: commitment,
|
|
53
|
+
skip_preflight: skipPreflight,
|
|
54
|
+
max_retries: maxRetries,
|
|
55
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
56
|
+
};
|
|
57
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
58
|
+
...rest,
|
|
59
|
+
...(Object.values(options).some(element => element != null)
|
|
107
60
|
? { options: options }
|
|
108
|
-
: null)
|
|
109
|
-
|
|
110
|
-
return signatures;
|
|
61
|
+
: null),
|
|
62
|
+
payloads,
|
|
111
63
|
});
|
|
64
|
+
const signatures = base64EncodedSignatures.map(jsBase64.toUint8Array).map(bs58.encode);
|
|
65
|
+
return signatures;
|
|
112
66
|
};
|
|
113
67
|
break;
|
|
114
68
|
case 'signMessages':
|
|
115
|
-
target[p] = function (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
121
|
-
return signedMessages;
|
|
69
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
70
|
+
const base64EncodedPayloads = payloads.map(jsBase64.fromUint8Array);
|
|
71
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
72
|
+
...rest,
|
|
73
|
+
payloads: base64EncodedPayloads,
|
|
122
74
|
});
|
|
75
|
+
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
76
|
+
return signedMessages;
|
|
123
77
|
};
|
|
124
78
|
break;
|
|
125
79
|
case 'signTransactions':
|
|
126
|
-
target[p] = function (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
132
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
133
|
-
return signedTransactions;
|
|
80
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
81
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
82
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
83
|
+
...rest,
|
|
84
|
+
payloads,
|
|
134
85
|
});
|
|
86
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
87
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
88
|
+
return signedTransactions;
|
|
135
89
|
};
|
|
136
90
|
break;
|
|
137
91
|
default: {
|
package/lib/esm/index.browser.js
CHANGED
|
@@ -1,44 +1,7 @@
|
|
|
1
1
|
import { VersionedMessage, Transaction, VersionedTransaction, SIGNATURE_LENGTH_IN_BYTES } from '@solana/web3.js';
|
|
2
|
-
import {
|
|
2
|
+
import { startRemoteScenario as startRemoteScenario$1, transact as transact$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
3
3
|
import bs58 from 'bs58';
|
|
4
4
|
|
|
5
|
-
/******************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
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
|
-
|
|
32
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
33
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
5
|
function fromUint8Array(byteArray) {
|
|
43
6
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
44
7
|
}
|
|
@@ -70,22 +33,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
70
33
|
return VersionedTransaction.deserialize(byteArray);
|
|
71
34
|
}
|
|
72
35
|
}
|
|
73
|
-
function transact(callback, config) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return yield transact$1(augmentedCallback, config);
|
|
79
|
-
});
|
|
36
|
+
async function transact(callback, config) {
|
|
37
|
+
const augmentedCallback = (wallet) => {
|
|
38
|
+
return callback(augmentWalletAPI(wallet));
|
|
39
|
+
};
|
|
40
|
+
return await transact$1(augmentedCallback, config);
|
|
80
41
|
}
|
|
81
|
-
function startRemoteScenario(config) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return augmentWalletAPI(wallet);
|
|
86
|
-
});
|
|
87
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
42
|
+
async function startRemoteScenario(config) {
|
|
43
|
+
const { wallet, close, associationUrl } = await startRemoteScenario$1(config);
|
|
44
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
45
|
+
return augmentWalletAPI(wallet);
|
|
88
46
|
});
|
|
47
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
89
48
|
}
|
|
90
49
|
function augmentWalletAPI(wallet) {
|
|
91
50
|
return new Proxy({}, {
|
|
@@ -93,46 +52,47 @@ function augmentWalletAPI(wallet) {
|
|
|
93
52
|
if (target[p] == null) {
|
|
94
53
|
switch (p) {
|
|
95
54
|
case 'signAndSendTransactions':
|
|
96
|
-
target[p] = function (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
55
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
56
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
57
|
+
const options = {
|
|
58
|
+
min_context_slot: minContextSlot,
|
|
59
|
+
commitment: commitment,
|
|
60
|
+
skip_preflight: skipPreflight,
|
|
61
|
+
max_retries: maxRetries,
|
|
62
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
63
|
+
};
|
|
64
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
65
|
+
...rest,
|
|
66
|
+
...(Object.values(options).some(element => element != null)
|
|
108
67
|
? { options: options }
|
|
109
|
-
: null)
|
|
110
|
-
|
|
111
|
-
return signatures;
|
|
68
|
+
: null),
|
|
69
|
+
payloads,
|
|
112
70
|
});
|
|
71
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
72
|
+
return signatures;
|
|
113
73
|
};
|
|
114
74
|
break;
|
|
115
75
|
case 'signMessages':
|
|
116
|
-
target[p] = function (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
122
|
-
return signedMessages;
|
|
76
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
77
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
78
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
79
|
+
...rest,
|
|
80
|
+
payloads: base64EncodedPayloads,
|
|
123
81
|
});
|
|
82
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
83
|
+
return signedMessages;
|
|
124
84
|
};
|
|
125
85
|
break;
|
|
126
86
|
case 'signTransactions':
|
|
127
|
-
target[p] = function (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
133
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
134
|
-
return signedTransactions;
|
|
87
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
88
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
89
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
90
|
+
...rest,
|
|
91
|
+
payloads,
|
|
135
92
|
});
|
|
93
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
94
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
95
|
+
return signedTransactions;
|
|
136
96
|
};
|
|
137
97
|
break;
|
|
138
98
|
default: {
|
package/lib/esm/index.js
CHANGED
|
@@ -1,44 +1,7 @@
|
|
|
1
1
|
import { VersionedMessage, Transaction, VersionedTransaction, SIGNATURE_LENGTH_IN_BYTES } from '@solana/web3.js';
|
|
2
|
-
import {
|
|
2
|
+
import { startRemoteScenario as startRemoteScenario$1, transact as transact$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
3
3
|
import bs58 from 'bs58';
|
|
4
4
|
|
|
5
|
-
/******************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
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
|
-
|
|
32
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
33
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
5
|
function fromUint8Array(byteArray) {
|
|
43
6
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
44
7
|
}
|
|
@@ -70,22 +33,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
70
33
|
return VersionedTransaction.deserialize(byteArray);
|
|
71
34
|
}
|
|
72
35
|
}
|
|
73
|
-
function transact(callback, config) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return yield transact$1(augmentedCallback, config);
|
|
79
|
-
});
|
|
36
|
+
async function transact(callback, config) {
|
|
37
|
+
const augmentedCallback = (wallet) => {
|
|
38
|
+
return callback(augmentWalletAPI(wallet));
|
|
39
|
+
};
|
|
40
|
+
return await transact$1(augmentedCallback, config);
|
|
80
41
|
}
|
|
81
|
-
function startRemoteScenario(config) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return augmentWalletAPI(wallet);
|
|
86
|
-
});
|
|
87
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
42
|
+
async function startRemoteScenario(config) {
|
|
43
|
+
const { wallet, close, associationUrl } = await startRemoteScenario$1(config);
|
|
44
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
45
|
+
return augmentWalletAPI(wallet);
|
|
88
46
|
});
|
|
47
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
89
48
|
}
|
|
90
49
|
function augmentWalletAPI(wallet) {
|
|
91
50
|
return new Proxy({}, {
|
|
@@ -93,46 +52,47 @@ function augmentWalletAPI(wallet) {
|
|
|
93
52
|
if (target[p] == null) {
|
|
94
53
|
switch (p) {
|
|
95
54
|
case 'signAndSendTransactions':
|
|
96
|
-
target[p] = function (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
55
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
56
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
57
|
+
const options = {
|
|
58
|
+
min_context_slot: minContextSlot,
|
|
59
|
+
commitment: commitment,
|
|
60
|
+
skip_preflight: skipPreflight,
|
|
61
|
+
max_retries: maxRetries,
|
|
62
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
63
|
+
};
|
|
64
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
65
|
+
...rest,
|
|
66
|
+
...(Object.values(options).some(element => element != null)
|
|
108
67
|
? { options: options }
|
|
109
|
-
: null)
|
|
110
|
-
|
|
111
|
-
return signatures;
|
|
68
|
+
: null),
|
|
69
|
+
payloads,
|
|
112
70
|
});
|
|
71
|
+
const signatures = base64EncodedSignatures.map(toUint8Array).map(bs58.encode);
|
|
72
|
+
return signatures;
|
|
113
73
|
};
|
|
114
74
|
break;
|
|
115
75
|
case 'signMessages':
|
|
116
|
-
target[p] = function (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
122
|
-
return signedMessages;
|
|
76
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
77
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
78
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
79
|
+
...rest,
|
|
80
|
+
payloads: base64EncodedPayloads,
|
|
123
81
|
});
|
|
82
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
83
|
+
return signedMessages;
|
|
124
84
|
};
|
|
125
85
|
break;
|
|
126
86
|
case 'signTransactions':
|
|
127
|
-
target[p] = function (
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
133
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
134
|
-
return signedTransactions;
|
|
87
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
88
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
89
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
90
|
+
...rest,
|
|
91
|
+
payloads,
|
|
135
92
|
});
|
|
93
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
94
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
95
|
+
return signedTransactions;
|
|
136
96
|
};
|
|
137
97
|
break;
|
|
138
98
|
default: {
|
package/package.json
CHANGED
|
@@ -1,69 +1,68 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"name": "@solana-mobile/mobile-wallet-adapter-protocol-web3js",
|
|
3
|
+
"description": "A convenience wrapper that enables you to call Solana Mobile Stack protocol methods using objects from @solana/web3.js",
|
|
4
|
+
"version": "2.2.6",
|
|
5
|
+
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/solana-mobile/mobile-wallet-adapter.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"exports": {
|
|
12
|
+
"edge-light": {
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"require": "./lib/cjs/index.js"
|
|
9
15
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"import": "./lib/esm/index.js",
|
|
14
|
-
"require": "./lib/cjs/index.js"
|
|
15
|
-
},
|
|
16
|
-
"workerd": {
|
|
17
|
-
"import": "./lib/esm/index.js",
|
|
18
|
-
"require": "./lib/cjs/index.js"
|
|
19
|
-
},
|
|
20
|
-
"browser": {
|
|
21
|
-
"import": "./lib/esm/index.browser.js",
|
|
22
|
-
"require": "./lib/cjs/index.browser.js"
|
|
23
|
-
},
|
|
24
|
-
"node": {
|
|
25
|
-
"import": "./lib/esm/index.js",
|
|
26
|
-
"require": "./lib/cjs/index.js"
|
|
27
|
-
},
|
|
28
|
-
"react-native": "./lib/cjs/index.native.js",
|
|
29
|
-
"types": "./lib/types/index.d.ts"
|
|
16
|
+
"workerd": {
|
|
17
|
+
"import": "./lib/esm/index.js",
|
|
18
|
+
"require": "./lib/cjs/index.js"
|
|
30
19
|
},
|
|
31
20
|
"browser": {
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
"import": "./lib/esm/index.browser.js",
|
|
22
|
+
"require": "./lib/cjs/index.browser.js"
|
|
34
23
|
},
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"types": "lib/types/index.d.ts",
|
|
39
|
-
"type": "module",
|
|
40
|
-
"files": [
|
|
41
|
-
"lib",
|
|
42
|
-
"LICENSE"
|
|
43
|
-
],
|
|
44
|
-
"sideEffects": false,
|
|
45
|
-
"publishConfig": {
|
|
46
|
-
"access": "public"
|
|
24
|
+
"node": {
|
|
25
|
+
"import": "./lib/esm/index.js",
|
|
26
|
+
"require": "./lib/cjs/index.js"
|
|
47
27
|
},
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
28
|
+
"react-native": "./lib/cjs/index.native.js",
|
|
29
|
+
"types": "./lib/types/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"browser": {
|
|
32
|
+
"./lib/cjs/index.js": "./lib/cjs/index.browser.js",
|
|
33
|
+
"./lib/esm/index.js": "./lib/esm/index.browser.js"
|
|
34
|
+
},
|
|
35
|
+
"main": "lib/cjs/index.js",
|
|
36
|
+
"module": "lib/esm/index.js",
|
|
37
|
+
"react-native": "lib/cjs/index.native.js",
|
|
38
|
+
"types": "lib/types/index.d.ts",
|
|
39
|
+
"type": "module",
|
|
40
|
+
"files": [
|
|
41
|
+
"lib",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"sideEffects": false,
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@solana/web3.js": "^1.58.0"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"bs58": "^6.0.0",
|
|
53
|
+
"js-base64": "^3.7.5",
|
|
54
|
+
"@solana-mobile/mobile-wallet-adapter-protocol": "^2.2.6"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@solana/web3.js": "^1.91.7",
|
|
58
|
+
"agadoo": "^3.0.0",
|
|
59
|
+
"cross-env": "^10.1.0",
|
|
60
|
+
"shx": "^0.4.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"clean": "shx rm -rf lib/*",
|
|
64
|
+
"build": "pnpm clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
|
|
65
|
+
"build:watch": "pnpm clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
|
|
66
|
+
"postbuild": "cross-env echo {\\\"type\\\":\\\"commonjs\\\"} | npx json > lib/cjs/package.json && echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json"
|
|
67
|
+
}
|
|
69
68
|
}
|