@solana-mobile/mobile-wallet-adapter-protocol-kit 0.2.2 → 0.2.3
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 -83
- package/lib/cjs/index.js +41 -83
- package/lib/cjs/index.native.js +41 -83
- package/lib/esm/index.browser.js +42 -82
- package/lib/esm/index.js +42 -82
- package/package.json +64 -64
package/lib/cjs/index.browser.js
CHANGED
|
@@ -1,47 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var transactions = require('@solana/transactions');
|
|
6
4
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
5
|
|
|
8
|
-
/******************************************************************************
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */
|
|
22
|
-
|
|
23
|
-
function __rest(s, e) {
|
|
24
|
-
var t = {};
|
|
25
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
26
|
-
t[p] = s[p];
|
|
27
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
28
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
29
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
30
|
-
t[p[i]] = s[p[i]];
|
|
31
|
-
}
|
|
32
|
-
return t;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
6
|
function fromUint8Array(byteArray) {
|
|
46
7
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
47
8
|
}
|
|
@@ -68,22 +29,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
68
29
|
const transactionDecoder = transactions.getTransactionDecoder();
|
|
69
30
|
return transactionDecoder.decode(byteArray);
|
|
70
31
|
}
|
|
71
|
-
function transact(callback, config) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
77
|
-
});
|
|
32
|
+
async function transact(callback, config) {
|
|
33
|
+
const augmentedCallback = (wallet) => {
|
|
34
|
+
return callback(augmentWalletAPI(wallet));
|
|
35
|
+
};
|
|
36
|
+
return await mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
78
37
|
}
|
|
79
|
-
function startRemoteScenario(config) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return augmentWalletAPI(wallet);
|
|
84
|
-
});
|
|
85
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
38
|
+
async function startRemoteScenario(config) {
|
|
39
|
+
const { wallet, close, associationUrl } = await mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
40
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
41
|
+
return augmentWalletAPI(wallet);
|
|
86
42
|
});
|
|
43
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
87
44
|
}
|
|
88
45
|
function augmentWalletAPI(wallet) {
|
|
89
46
|
return new Proxy({}, {
|
|
@@ -91,46 +48,47 @@ function augmentWalletAPI(wallet) {
|
|
|
91
48
|
if (target[p] == null) {
|
|
92
49
|
switch (p) {
|
|
93
50
|
case 'signAndSendTransactions':
|
|
94
|
-
target[p] = function (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
51
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
52
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
53
|
+
const options = {
|
|
54
|
+
min_context_slot: minContextSlot,
|
|
55
|
+
commitment: commitment,
|
|
56
|
+
skip_preflight: skipPreflight,
|
|
57
|
+
max_retries: maxRetries,
|
|
58
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
59
|
+
};
|
|
60
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
61
|
+
...rest,
|
|
62
|
+
...(Object.values(options).some(element => element != null)
|
|
106
63
|
? { options: options }
|
|
107
|
-
: null)
|
|
108
|
-
|
|
109
|
-
return signatures;
|
|
64
|
+
: null),
|
|
65
|
+
payloads,
|
|
110
66
|
});
|
|
67
|
+
const signatures = base64EncodedSignatures.map(toUint8Array);
|
|
68
|
+
return signatures;
|
|
111
69
|
};
|
|
112
70
|
break;
|
|
113
71
|
case 'signMessages':
|
|
114
|
-
target[p] = function (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
120
|
-
return signedMessages;
|
|
72
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
73
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
74
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
75
|
+
...rest,
|
|
76
|
+
payloads: base64EncodedPayloads,
|
|
121
77
|
});
|
|
78
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
79
|
+
return signedMessages;
|
|
122
80
|
};
|
|
123
81
|
break;
|
|
124
82
|
case 'signTransactions':
|
|
125
|
-
target[p] = function (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
131
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
132
|
-
return signedTransactions;
|
|
83
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
84
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
85
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
86
|
+
...rest,
|
|
87
|
+
payloads,
|
|
133
88
|
});
|
|
89
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
90
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
91
|
+
return signedTransactions;
|
|
134
92
|
};
|
|
135
93
|
break;
|
|
136
94
|
default: {
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,47 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var transactions = require('@solana/transactions');
|
|
6
4
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
5
|
|
|
8
|
-
/******************************************************************************
|
|
9
|
-
Copyright (c) Microsoft Corporation.
|
|
10
|
-
|
|
11
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
-
purpose with or without fee is hereby granted.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
***************************************************************************** */
|
|
22
|
-
|
|
23
|
-
function __rest(s, e) {
|
|
24
|
-
var t = {};
|
|
25
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
26
|
-
t[p] = s[p];
|
|
27
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
28
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
29
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
30
|
-
t[p[i]] = s[p[i]];
|
|
31
|
-
}
|
|
32
|
-
return t;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
6
|
function fromUint8Array(byteArray) {
|
|
46
7
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
47
8
|
}
|
|
@@ -68,22 +29,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
68
29
|
const transactionDecoder = transactions.getTransactionDecoder();
|
|
69
30
|
return transactionDecoder.decode(byteArray);
|
|
70
31
|
}
|
|
71
|
-
function transact(callback, config) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
77
|
-
});
|
|
32
|
+
async function transact(callback, config) {
|
|
33
|
+
const augmentedCallback = (wallet) => {
|
|
34
|
+
return callback(augmentWalletAPI(wallet));
|
|
35
|
+
};
|
|
36
|
+
return await mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
78
37
|
}
|
|
79
|
-
function startRemoteScenario(config) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return augmentWalletAPI(wallet);
|
|
84
|
-
});
|
|
85
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
38
|
+
async function startRemoteScenario(config) {
|
|
39
|
+
const { wallet, close, associationUrl } = await mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
40
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
41
|
+
return augmentWalletAPI(wallet);
|
|
86
42
|
});
|
|
43
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
87
44
|
}
|
|
88
45
|
function augmentWalletAPI(wallet) {
|
|
89
46
|
return new Proxy({}, {
|
|
@@ -91,46 +48,47 @@ function augmentWalletAPI(wallet) {
|
|
|
91
48
|
if (target[p] == null) {
|
|
92
49
|
switch (p) {
|
|
93
50
|
case 'signAndSendTransactions':
|
|
94
|
-
target[p] = function (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
51
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
52
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
53
|
+
const options = {
|
|
54
|
+
min_context_slot: minContextSlot,
|
|
55
|
+
commitment: commitment,
|
|
56
|
+
skip_preflight: skipPreflight,
|
|
57
|
+
max_retries: maxRetries,
|
|
58
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
59
|
+
};
|
|
60
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
61
|
+
...rest,
|
|
62
|
+
...(Object.values(options).some(element => element != null)
|
|
106
63
|
? { options: options }
|
|
107
|
-
: null)
|
|
108
|
-
|
|
109
|
-
return signatures;
|
|
64
|
+
: null),
|
|
65
|
+
payloads,
|
|
110
66
|
});
|
|
67
|
+
const signatures = base64EncodedSignatures.map(toUint8Array);
|
|
68
|
+
return signatures;
|
|
111
69
|
};
|
|
112
70
|
break;
|
|
113
71
|
case 'signMessages':
|
|
114
|
-
target[p] = function (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
120
|
-
return signedMessages;
|
|
72
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
73
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
74
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
75
|
+
...rest,
|
|
76
|
+
payloads: base64EncodedPayloads,
|
|
121
77
|
});
|
|
78
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
79
|
+
return signedMessages;
|
|
122
80
|
};
|
|
123
81
|
break;
|
|
124
82
|
case 'signTransactions':
|
|
125
|
-
target[p] = function (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
131
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
132
|
-
return signedTransactions;
|
|
83
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
84
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
85
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
86
|
+
...rest,
|
|
87
|
+
payloads,
|
|
133
88
|
});
|
|
89
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
90
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
91
|
+
return signedTransactions;
|
|
134
92
|
};
|
|
135
93
|
break;
|
|
136
94
|
default: {
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -1,48 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var transactions = require('@solana/transactions');
|
|
6
4
|
var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
|
|
7
5
|
var jsBase64 = require('js-base64');
|
|
8
6
|
|
|
9
|
-
/******************************************************************************
|
|
10
|
-
Copyright (c) Microsoft Corporation.
|
|
11
|
-
|
|
12
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
-
purpose with or without fee is hereby granted.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
-
***************************************************************************** */
|
|
23
|
-
|
|
24
|
-
function __rest(s, e) {
|
|
25
|
-
var t = {};
|
|
26
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
27
|
-
t[p] = s[p];
|
|
28
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
29
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
30
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
31
|
-
t[p[i]] = s[p[i]];
|
|
32
|
-
}
|
|
33
|
-
return t;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
37
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
7
|
function getPayloadFromTransaction(transaction) {
|
|
47
8
|
if ('messageBytes' in transaction) {
|
|
48
9
|
return transactions.getBase64EncodedWireTransaction(transaction);
|
|
@@ -59,22 +20,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
59
20
|
const transactionDecoder = transactions.getTransactionDecoder();
|
|
60
21
|
return transactionDecoder.decode(byteArray);
|
|
61
22
|
}
|
|
62
|
-
function transact(callback, config) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
68
|
-
});
|
|
23
|
+
async function transact(callback, config) {
|
|
24
|
+
const augmentedCallback = (wallet) => {
|
|
25
|
+
return callback(augmentWalletAPI(wallet));
|
|
26
|
+
};
|
|
27
|
+
return await mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
69
28
|
}
|
|
70
|
-
function startRemoteScenario(config) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return augmentWalletAPI(wallet);
|
|
75
|
-
});
|
|
76
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
29
|
+
async function startRemoteScenario(config) {
|
|
30
|
+
const { wallet, close, associationUrl } = await mobileWalletAdapterProtocol.startRemoteScenario(config);
|
|
31
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
32
|
+
return augmentWalletAPI(wallet);
|
|
77
33
|
});
|
|
34
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
78
35
|
}
|
|
79
36
|
function augmentWalletAPI(wallet) {
|
|
80
37
|
return new Proxy({}, {
|
|
@@ -82,46 +39,47 @@ function augmentWalletAPI(wallet) {
|
|
|
82
39
|
if (target[p] == null) {
|
|
83
40
|
switch (p) {
|
|
84
41
|
case 'signAndSendTransactions':
|
|
85
|
-
target[p] = function (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
42
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
43
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
44
|
+
const options = {
|
|
45
|
+
min_context_slot: minContextSlot,
|
|
46
|
+
commitment: commitment,
|
|
47
|
+
skip_preflight: skipPreflight,
|
|
48
|
+
max_retries: maxRetries,
|
|
49
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
50
|
+
};
|
|
51
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
52
|
+
...rest,
|
|
53
|
+
...(Object.values(options).some(element => element != null)
|
|
97
54
|
? { options: options }
|
|
98
|
-
: null)
|
|
99
|
-
|
|
100
|
-
return signatures;
|
|
55
|
+
: null),
|
|
56
|
+
payloads,
|
|
101
57
|
});
|
|
58
|
+
const signatures = base64EncodedSignatures.map(jsBase64.toUint8Array);
|
|
59
|
+
return signatures;
|
|
102
60
|
};
|
|
103
61
|
break;
|
|
104
62
|
case 'signMessages':
|
|
105
|
-
target[p] = function (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
111
|
-
return signedMessages;
|
|
63
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
64
|
+
const base64EncodedPayloads = payloads.map(jsBase64.fromUint8Array);
|
|
65
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
66
|
+
...rest,
|
|
67
|
+
payloads: base64EncodedPayloads,
|
|
112
68
|
});
|
|
69
|
+
const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
|
|
70
|
+
return signedMessages;
|
|
113
71
|
};
|
|
114
72
|
break;
|
|
115
73
|
case 'signTransactions':
|
|
116
|
-
target[p] = function (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
122
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
123
|
-
return signedTransactions;
|
|
74
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
75
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
76
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
77
|
+
...rest,
|
|
78
|
+
payloads,
|
|
124
79
|
});
|
|
80
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
|
|
81
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
82
|
+
return signedTransactions;
|
|
125
83
|
};
|
|
126
84
|
break;
|
|
127
85
|
default: {
|
package/lib/esm/index.browser.js
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
import { getBase64EncodedWireTransaction, compileTransaction, getTransactionDecoder } from '@solana/transactions';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/******************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
|
|
7
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
purpose with or without fee is hereby granted.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
***************************************************************************** */
|
|
18
|
-
|
|
19
|
-
function __rest(s, e) {
|
|
20
|
-
var t = {};
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
24
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
26
|
-
t[p[i]] = s[p[i]];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
32
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
-
});
|
|
39
|
-
}
|
|
2
|
+
import { startRemoteScenario as startRemoteScenario$1, transact as transact$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
40
3
|
|
|
41
4
|
function fromUint8Array(byteArray) {
|
|
42
5
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
@@ -64,22 +27,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
64
27
|
const transactionDecoder = getTransactionDecoder();
|
|
65
28
|
return transactionDecoder.decode(byteArray);
|
|
66
29
|
}
|
|
67
|
-
function transact(callback, config) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return yield transact$1(augmentedCallback, config);
|
|
73
|
-
});
|
|
30
|
+
async function transact(callback, config) {
|
|
31
|
+
const augmentedCallback = (wallet) => {
|
|
32
|
+
return callback(augmentWalletAPI(wallet));
|
|
33
|
+
};
|
|
34
|
+
return await transact$1(augmentedCallback, config);
|
|
74
35
|
}
|
|
75
|
-
function startRemoteScenario(config) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return augmentWalletAPI(wallet);
|
|
80
|
-
});
|
|
81
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
36
|
+
async function startRemoteScenario(config) {
|
|
37
|
+
const { wallet, close, associationUrl } = await startRemoteScenario$1(config);
|
|
38
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
39
|
+
return augmentWalletAPI(wallet);
|
|
82
40
|
});
|
|
41
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
83
42
|
}
|
|
84
43
|
function augmentWalletAPI(wallet) {
|
|
85
44
|
return new Proxy({}, {
|
|
@@ -87,46 +46,47 @@ function augmentWalletAPI(wallet) {
|
|
|
87
46
|
if (target[p] == null) {
|
|
88
47
|
switch (p) {
|
|
89
48
|
case 'signAndSendTransactions':
|
|
90
|
-
target[p] = function (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
49
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
50
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
51
|
+
const options = {
|
|
52
|
+
min_context_slot: minContextSlot,
|
|
53
|
+
commitment: commitment,
|
|
54
|
+
skip_preflight: skipPreflight,
|
|
55
|
+
max_retries: maxRetries,
|
|
56
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
57
|
+
};
|
|
58
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
59
|
+
...rest,
|
|
60
|
+
...(Object.values(options).some(element => element != null)
|
|
102
61
|
? { options: options }
|
|
103
|
-
: null)
|
|
104
|
-
|
|
105
|
-
return signatures;
|
|
62
|
+
: null),
|
|
63
|
+
payloads,
|
|
106
64
|
});
|
|
65
|
+
const signatures = base64EncodedSignatures.map(toUint8Array);
|
|
66
|
+
return signatures;
|
|
107
67
|
};
|
|
108
68
|
break;
|
|
109
69
|
case 'signMessages':
|
|
110
|
-
target[p] = function (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
116
|
-
return signedMessages;
|
|
70
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
71
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
72
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
73
|
+
...rest,
|
|
74
|
+
payloads: base64EncodedPayloads,
|
|
117
75
|
});
|
|
76
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
77
|
+
return signedMessages;
|
|
118
78
|
};
|
|
119
79
|
break;
|
|
120
80
|
case 'signTransactions':
|
|
121
|
-
target[p] = function (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
127
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
128
|
-
return signedTransactions;
|
|
81
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
82
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
83
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
84
|
+
...rest,
|
|
85
|
+
payloads,
|
|
129
86
|
});
|
|
87
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
88
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
89
|
+
return signedTransactions;
|
|
130
90
|
};
|
|
131
91
|
break;
|
|
132
92
|
default: {
|
package/lib/esm/index.js
CHANGED
|
@@ -1,42 +1,5 @@
|
|
|
1
1
|
import { getBase64EncodedWireTransaction, compileTransaction, getTransactionDecoder } from '@solana/transactions';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/******************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
|
|
7
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
purpose with or without fee is hereby granted.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
***************************************************************************** */
|
|
18
|
-
|
|
19
|
-
function __rest(s, e) {
|
|
20
|
-
var t = {};
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
24
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
26
|
-
t[p[i]] = s[p[i]];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
32
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
33
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
34
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
35
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
36
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
37
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
38
|
-
});
|
|
39
|
-
}
|
|
2
|
+
import { startRemoteScenario as startRemoteScenario$1, transact as transact$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
|
|
40
3
|
|
|
41
4
|
function fromUint8Array(byteArray) {
|
|
42
5
|
return window.btoa(String.fromCharCode.call(null, ...byteArray));
|
|
@@ -64,22 +27,18 @@ function getTransactionFromWireMessage(byteArray) {
|
|
|
64
27
|
const transactionDecoder = getTransactionDecoder();
|
|
65
28
|
return transactionDecoder.decode(byteArray);
|
|
66
29
|
}
|
|
67
|
-
function transact(callback, config) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return yield transact$1(augmentedCallback, config);
|
|
73
|
-
});
|
|
30
|
+
async function transact(callback, config) {
|
|
31
|
+
const augmentedCallback = (wallet) => {
|
|
32
|
+
return callback(augmentWalletAPI(wallet));
|
|
33
|
+
};
|
|
34
|
+
return await transact$1(augmentedCallback, config);
|
|
74
35
|
}
|
|
75
|
-
function startRemoteScenario(config) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return augmentWalletAPI(wallet);
|
|
80
|
-
});
|
|
81
|
-
return { wallet: augmentedPromise, close, associationUrl };
|
|
36
|
+
async function startRemoteScenario(config) {
|
|
37
|
+
const { wallet, close, associationUrl } = await startRemoteScenario$1(config);
|
|
38
|
+
const augmentedPromise = wallet.then((wallet) => {
|
|
39
|
+
return augmentWalletAPI(wallet);
|
|
82
40
|
});
|
|
41
|
+
return { wallet: augmentedPromise, close, associationUrl };
|
|
83
42
|
}
|
|
84
43
|
function augmentWalletAPI(wallet) {
|
|
85
44
|
return new Proxy({}, {
|
|
@@ -87,46 +46,47 @@ function augmentWalletAPI(wallet) {
|
|
|
87
46
|
if (target[p] == null) {
|
|
88
47
|
switch (p) {
|
|
89
48
|
case 'signAndSendTransactions':
|
|
90
|
-
target[p] = function (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
49
|
+
target[p] = async function ({ minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions, ...rest }) {
|
|
50
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
51
|
+
const options = {
|
|
52
|
+
min_context_slot: minContextSlot,
|
|
53
|
+
commitment: commitment,
|
|
54
|
+
skip_preflight: skipPreflight,
|
|
55
|
+
max_retries: maxRetries,
|
|
56
|
+
wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
|
|
57
|
+
};
|
|
58
|
+
const { signatures: base64EncodedSignatures } = await wallet.signAndSendTransactions({
|
|
59
|
+
...rest,
|
|
60
|
+
...(Object.values(options).some(element => element != null)
|
|
102
61
|
? { options: options }
|
|
103
|
-
: null)
|
|
104
|
-
|
|
105
|
-
return signatures;
|
|
62
|
+
: null),
|
|
63
|
+
payloads,
|
|
106
64
|
});
|
|
65
|
+
const signatures = base64EncodedSignatures.map(toUint8Array);
|
|
66
|
+
return signatures;
|
|
107
67
|
};
|
|
108
68
|
break;
|
|
109
69
|
case 'signMessages':
|
|
110
|
-
target[p] = function (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
116
|
-
return signedMessages;
|
|
70
|
+
target[p] = async function ({ payloads, ...rest }) {
|
|
71
|
+
const base64EncodedPayloads = payloads.map(fromUint8Array);
|
|
72
|
+
const { signed_payloads: base64EncodedSignedMessages } = await wallet.signMessages({
|
|
73
|
+
...rest,
|
|
74
|
+
payloads: base64EncodedPayloads,
|
|
117
75
|
});
|
|
76
|
+
const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
|
|
77
|
+
return signedMessages;
|
|
118
78
|
};
|
|
119
79
|
break;
|
|
120
80
|
case 'signTransactions':
|
|
121
|
-
target[p] = function (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
127
|
-
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
128
|
-
return signedTransactions;
|
|
81
|
+
target[p] = async function ({ transactions, ...rest }) {
|
|
82
|
+
const payloads = transactions.map(getPayloadFromTransaction);
|
|
83
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = await wallet.signTransactions({
|
|
84
|
+
...rest,
|
|
85
|
+
payloads,
|
|
129
86
|
});
|
|
87
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
|
|
88
|
+
const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
|
|
89
|
+
return signedTransactions;
|
|
130
90
|
};
|
|
131
91
|
break;
|
|
132
92
|
default: {
|
package/package.json
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"name": "@solana-mobile/mobile-wallet-adapter-protocol-kit",
|
|
3
|
+
"description": "A convenience wrapper that enables you to call Solana Mobile Stack protocol methods using objects from @solana/kit",
|
|
4
|
+
"version": "0.2.3",
|
|
5
|
+
"author": "Marco Martinez <marco.martinez@solana.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
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
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/kit": "^2.1.0"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@solana/transactions": "^2.1.0",
|
|
53
|
+
"@solana/transaction-messages": "^2.1.0",
|
|
54
|
+
"bs58": "^6.0.0",
|
|
55
|
+
"js-base64": "^3.7.7",
|
|
56
|
+
"@solana-mobile/mobile-wallet-adapter-protocol": "^2.2.6"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@solana/keys": "^2.1.0",
|
|
60
|
+
"agadoo": "^3.0.0",
|
|
61
|
+
"cross-env": "^10.1.0",
|
|
62
|
+
"shx": "^0.4.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"clean": "shx rm -rf lib/*",
|
|
66
|
+
"build": "pnpm clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
|
|
67
|
+
"build:watch": "pnpm clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
|
|
68
|
+
"postbuild": "cross-env echo {\\\"type\\\":\\\"commonjs\\\"} | npx json > lib/cjs/package.json && echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json"
|
|
69
|
+
}
|
|
70
|
+
}
|