@solana-mobile/mobile-wallet-adapter-protocol-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2025 Solana Mobile Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@solana-mobile/mobile-wallet-adapter-protocol-kit`
2
+
3
+ This is a convenience wrapper that makes it easy to use common primitives from [@solana/kit](https://github.com/anza-xyz/kit) – such as `Transaction` and `Signature` – with [@solana-mobile/mobile-wallet-adapter-protocol](https://github.com/solana-mobile/mobile-wallet-adapter/tree/main/js/packages/mobile-wallet-adapter-protocol).
@@ -0,0 +1,154 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var transactions = require('@solana/transactions');
6
+ var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
7
+
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
+ function fromUint8Array(byteArray) {
46
+ return window.btoa(String.fromCharCode.call(null, ...byteArray));
47
+ }
48
+ function toUint8Array(base64EncodedByteArray) {
49
+ return new Uint8Array(window
50
+ .atob(base64EncodedByteArray)
51
+ .split('')
52
+ .map((c) => c.charCodeAt(0)));
53
+ }
54
+
55
+ function getPayloadFromTransaction(transaction) {
56
+ if ('messageBytes' in transaction) {
57
+ return transactions.getBase64EncodedWireTransaction(transaction);
58
+ }
59
+ else if ('instructions' in transaction) {
60
+ const compiledTransaction = transactions.compileTransaction(transaction);
61
+ return transactions.getBase64EncodedWireTransaction(compiledTransaction);
62
+ }
63
+ else {
64
+ throw new Error('Invalid transaction type');
65
+ }
66
+ }
67
+ function getTransactionFromWireMessage(byteArray) {
68
+ const transactionDecoder = transactions.getTransactionDecoder();
69
+ return transactionDecoder.decode(byteArray);
70
+ }
71
+ function transact(callback, config) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const augmentedCallback = (wallet) => {
74
+ return callback(augmentWalletAPI(wallet));
75
+ };
76
+ return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
77
+ });
78
+ }
79
+ function startRemoteScenario(config) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const { wallet, close, associationUrl } = yield mobileWalletAdapterProtocol.startRemoteScenario(config);
82
+ const augmentedPromise = wallet.then((wallet) => {
83
+ return augmentWalletAPI(wallet);
84
+ });
85
+ return { wallet: augmentedPromise, close, associationUrl };
86
+ });
87
+ }
88
+ function augmentWalletAPI(wallet) {
89
+ return new Proxy({}, {
90
+ get(target, p) {
91
+ if (target[p] == null) {
92
+ switch (p) {
93
+ case 'signAndSendTransactions':
94
+ target[p] = function (_a) {
95
+ var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ const payloads = transactions.map(getPayloadFromTransaction);
98
+ const options = {
99
+ min_context_slot: minContextSlot,
100
+ commitment: commitment,
101
+ skip_preflight: skipPreflight,
102
+ max_retries: maxRetries,
103
+ wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
104
+ };
105
+ const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
106
+ ? { options: options }
107
+ : null)), { payloads }));
108
+ const signatures = base64EncodedSignatures.map(toUint8Array);
109
+ return signatures;
110
+ });
111
+ };
112
+ break;
113
+ case 'signMessages':
114
+ target[p] = function (_a) {
115
+ var { payloads } = _a, rest = __rest(_a, ["payloads"]);
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const base64EncodedPayloads = payloads.map(fromUint8Array);
118
+ const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
119
+ const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
120
+ return signedMessages;
121
+ });
122
+ };
123
+ break;
124
+ case 'signTransactions':
125
+ target[p] = function (_a) {
126
+ var { transactions } = _a, rest = __rest(_a, ["transactions"]);
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const payloads = transactions.map(getPayloadFromTransaction);
129
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
130
+ const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
131
+ const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
132
+ return signedTransactions;
133
+ });
134
+ };
135
+ break;
136
+ default: {
137
+ target[p] = wallet[p];
138
+ break;
139
+ }
140
+ }
141
+ }
142
+ return target[p];
143
+ },
144
+ defineProperty() {
145
+ return false;
146
+ },
147
+ deleteProperty() {
148
+ return false;
149
+ },
150
+ });
151
+ }
152
+
153
+ exports.startRemoteScenario = startRemoteScenario;
154
+ exports.transact = transact;
@@ -0,0 +1,154 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var transactions = require('@solana/transactions');
6
+ var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
7
+
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
+ function fromUint8Array(byteArray) {
46
+ return window.btoa(String.fromCharCode.call(null, ...byteArray));
47
+ }
48
+ function toUint8Array(base64EncodedByteArray) {
49
+ return new Uint8Array(window
50
+ .atob(base64EncodedByteArray)
51
+ .split('')
52
+ .map((c) => c.charCodeAt(0)));
53
+ }
54
+
55
+ function getPayloadFromTransaction(transaction) {
56
+ if ('messageBytes' in transaction) {
57
+ return transactions.getBase64EncodedWireTransaction(transaction);
58
+ }
59
+ else if ('instructions' in transaction) {
60
+ const compiledTransaction = transactions.compileTransaction(transaction);
61
+ return transactions.getBase64EncodedWireTransaction(compiledTransaction);
62
+ }
63
+ else {
64
+ throw new Error('Invalid transaction type');
65
+ }
66
+ }
67
+ function getTransactionFromWireMessage(byteArray) {
68
+ const transactionDecoder = transactions.getTransactionDecoder();
69
+ return transactionDecoder.decode(byteArray);
70
+ }
71
+ function transact(callback, config) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const augmentedCallback = (wallet) => {
74
+ return callback(augmentWalletAPI(wallet));
75
+ };
76
+ return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
77
+ });
78
+ }
79
+ function startRemoteScenario(config) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const { wallet, close, associationUrl } = yield mobileWalletAdapterProtocol.startRemoteScenario(config);
82
+ const augmentedPromise = wallet.then((wallet) => {
83
+ return augmentWalletAPI(wallet);
84
+ });
85
+ return { wallet: augmentedPromise, close, associationUrl };
86
+ });
87
+ }
88
+ function augmentWalletAPI(wallet) {
89
+ return new Proxy({}, {
90
+ get(target, p) {
91
+ if (target[p] == null) {
92
+ switch (p) {
93
+ case 'signAndSendTransactions':
94
+ target[p] = function (_a) {
95
+ var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ const payloads = transactions.map(getPayloadFromTransaction);
98
+ const options = {
99
+ min_context_slot: minContextSlot,
100
+ commitment: commitment,
101
+ skip_preflight: skipPreflight,
102
+ max_retries: maxRetries,
103
+ wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
104
+ };
105
+ const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
106
+ ? { options: options }
107
+ : null)), { payloads }));
108
+ const signatures = base64EncodedSignatures.map(toUint8Array);
109
+ return signatures;
110
+ });
111
+ };
112
+ break;
113
+ case 'signMessages':
114
+ target[p] = function (_a) {
115
+ var { payloads } = _a, rest = __rest(_a, ["payloads"]);
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const base64EncodedPayloads = payloads.map(fromUint8Array);
118
+ const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
119
+ const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
120
+ return signedMessages;
121
+ });
122
+ };
123
+ break;
124
+ case 'signTransactions':
125
+ target[p] = function (_a) {
126
+ var { transactions } = _a, rest = __rest(_a, ["transactions"]);
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const payloads = transactions.map(getPayloadFromTransaction);
129
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
130
+ const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
131
+ const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
132
+ return signedTransactions;
133
+ });
134
+ };
135
+ break;
136
+ default: {
137
+ target[p] = wallet[p];
138
+ break;
139
+ }
140
+ }
141
+ }
142
+ return target[p];
143
+ },
144
+ defineProperty() {
145
+ return false;
146
+ },
147
+ deleteProperty() {
148
+ return false;
149
+ },
150
+ });
151
+ }
152
+
153
+ exports.startRemoteScenario = startRemoteScenario;
154
+ exports.transact = transact;
@@ -0,0 +1,145 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var transactions = require('@solana/transactions');
6
+ var mobileWalletAdapterProtocol = require('@solana-mobile/mobile-wallet-adapter-protocol');
7
+ var jsBase64 = require('js-base64');
8
+
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
+ function getPayloadFromTransaction(transaction) {
47
+ if ('messageBytes' in transaction) {
48
+ return transactions.getBase64EncodedWireTransaction(transaction);
49
+ }
50
+ else if ('instructions' in transaction) {
51
+ const compiledTransaction = transactions.compileTransaction(transaction);
52
+ return transactions.getBase64EncodedWireTransaction(compiledTransaction);
53
+ }
54
+ else {
55
+ throw new Error('Invalid transaction type');
56
+ }
57
+ }
58
+ function getTransactionFromWireMessage(byteArray) {
59
+ const transactionDecoder = transactions.getTransactionDecoder();
60
+ return transactionDecoder.decode(byteArray);
61
+ }
62
+ function transact(callback, config) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const augmentedCallback = (wallet) => {
65
+ return callback(augmentWalletAPI(wallet));
66
+ };
67
+ return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
68
+ });
69
+ }
70
+ function startRemoteScenario(config) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const { wallet, close, associationUrl } = yield mobileWalletAdapterProtocol.startRemoteScenario(config);
73
+ const augmentedPromise = wallet.then((wallet) => {
74
+ return augmentWalletAPI(wallet);
75
+ });
76
+ return { wallet: augmentedPromise, close, associationUrl };
77
+ });
78
+ }
79
+ function augmentWalletAPI(wallet) {
80
+ return new Proxy({}, {
81
+ get(target, p) {
82
+ if (target[p] == null) {
83
+ switch (p) {
84
+ case 'signAndSendTransactions':
85
+ target[p] = function (_a) {
86
+ var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const payloads = transactions.map(getPayloadFromTransaction);
89
+ const options = {
90
+ min_context_slot: minContextSlot,
91
+ commitment: commitment,
92
+ skip_preflight: skipPreflight,
93
+ max_retries: maxRetries,
94
+ wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
95
+ };
96
+ const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
97
+ ? { options: options }
98
+ : null)), { payloads }));
99
+ const signatures = base64EncodedSignatures.map(jsBase64.toUint8Array);
100
+ return signatures;
101
+ });
102
+ };
103
+ break;
104
+ case 'signMessages':
105
+ target[p] = function (_a) {
106
+ var { payloads } = _a, rest = __rest(_a, ["payloads"]);
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ const base64EncodedPayloads = payloads.map(jsBase64.fromUint8Array);
109
+ const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
110
+ const signedMessages = base64EncodedSignedMessages.map(jsBase64.toUint8Array);
111
+ return signedMessages;
112
+ });
113
+ };
114
+ break;
115
+ case 'signTransactions':
116
+ target[p] = function (_a) {
117
+ var { transactions } = _a, rest = __rest(_a, ["transactions"]);
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const payloads = transactions.map(getPayloadFromTransaction);
120
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
121
+ const compiledTransactions = base64EncodedCompiledTransactions.map(jsBase64.toUint8Array);
122
+ const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
123
+ return signedTransactions;
124
+ });
125
+ };
126
+ break;
127
+ default: {
128
+ target[p] = wallet[p];
129
+ break;
130
+ }
131
+ }
132
+ }
133
+ return target[p];
134
+ },
135
+ defineProperty() {
136
+ return false;
137
+ },
138
+ deleteProperty() {
139
+ return false;
140
+ },
141
+ });
142
+ }
143
+
144
+ exports.startRemoteScenario = startRemoteScenario;
145
+ exports.transact = transact;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,149 @@
1
+ import { getBase64EncodedWireTransaction, compileTransaction, getTransactionDecoder } from '@solana/transactions';
2
+ import { transact as transact$1, startRemoteScenario as startRemoteScenario$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
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
+ }
40
+
41
+ function fromUint8Array(byteArray) {
42
+ return window.btoa(String.fromCharCode.call(null, ...byteArray));
43
+ }
44
+ function toUint8Array(base64EncodedByteArray) {
45
+ return new Uint8Array(window
46
+ .atob(base64EncodedByteArray)
47
+ .split('')
48
+ .map((c) => c.charCodeAt(0)));
49
+ }
50
+
51
+ function getPayloadFromTransaction(transaction) {
52
+ if ('messageBytes' in transaction) {
53
+ return getBase64EncodedWireTransaction(transaction);
54
+ }
55
+ else if ('instructions' in transaction) {
56
+ const compiledTransaction = compileTransaction(transaction);
57
+ return getBase64EncodedWireTransaction(compiledTransaction);
58
+ }
59
+ else {
60
+ throw new Error('Invalid transaction type');
61
+ }
62
+ }
63
+ function getTransactionFromWireMessage(byteArray) {
64
+ const transactionDecoder = getTransactionDecoder();
65
+ return transactionDecoder.decode(byteArray);
66
+ }
67
+ function transact(callback, config) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const augmentedCallback = (wallet) => {
70
+ return callback(augmentWalletAPI(wallet));
71
+ };
72
+ return yield transact$1(augmentedCallback, config);
73
+ });
74
+ }
75
+ function startRemoteScenario(config) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const { wallet, close, associationUrl } = yield startRemoteScenario$1(config);
78
+ const augmentedPromise = wallet.then((wallet) => {
79
+ return augmentWalletAPI(wallet);
80
+ });
81
+ return { wallet: augmentedPromise, close, associationUrl };
82
+ });
83
+ }
84
+ function augmentWalletAPI(wallet) {
85
+ return new Proxy({}, {
86
+ get(target, p) {
87
+ if (target[p] == null) {
88
+ switch (p) {
89
+ case 'signAndSendTransactions':
90
+ target[p] = function (_a) {
91
+ var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const payloads = transactions.map(getPayloadFromTransaction);
94
+ const options = {
95
+ min_context_slot: minContextSlot,
96
+ commitment: commitment,
97
+ skip_preflight: skipPreflight,
98
+ max_retries: maxRetries,
99
+ wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
100
+ };
101
+ const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
102
+ ? { options: options }
103
+ : null)), { payloads }));
104
+ const signatures = base64EncodedSignatures.map(toUint8Array);
105
+ return signatures;
106
+ });
107
+ };
108
+ break;
109
+ case 'signMessages':
110
+ target[p] = function (_a) {
111
+ var { payloads } = _a, rest = __rest(_a, ["payloads"]);
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const base64EncodedPayloads = payloads.map(fromUint8Array);
114
+ const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
115
+ const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
116
+ return signedMessages;
117
+ });
118
+ };
119
+ break;
120
+ case 'signTransactions':
121
+ target[p] = function (_a) {
122
+ var { transactions } = _a, rest = __rest(_a, ["transactions"]);
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ const payloads = transactions.map(getPayloadFromTransaction);
125
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
126
+ const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
127
+ const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
128
+ return signedTransactions;
129
+ });
130
+ };
131
+ break;
132
+ default: {
133
+ target[p] = wallet[p];
134
+ break;
135
+ }
136
+ }
137
+ }
138
+ return target[p];
139
+ },
140
+ defineProperty() {
141
+ return false;
142
+ },
143
+ deleteProperty() {
144
+ return false;
145
+ },
146
+ });
147
+ }
148
+
149
+ export { startRemoteScenario, transact };
@@ -0,0 +1,149 @@
1
+ import { getBase64EncodedWireTransaction, compileTransaction, getTransactionDecoder } from '@solana/transactions';
2
+ import { transact as transact$1, startRemoteScenario as startRemoteScenario$1 } from '@solana-mobile/mobile-wallet-adapter-protocol';
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
+ }
40
+
41
+ function fromUint8Array(byteArray) {
42
+ return window.btoa(String.fromCharCode.call(null, ...byteArray));
43
+ }
44
+ function toUint8Array(base64EncodedByteArray) {
45
+ return new Uint8Array(window
46
+ .atob(base64EncodedByteArray)
47
+ .split('')
48
+ .map((c) => c.charCodeAt(0)));
49
+ }
50
+
51
+ function getPayloadFromTransaction(transaction) {
52
+ if ('messageBytes' in transaction) {
53
+ return getBase64EncodedWireTransaction(transaction);
54
+ }
55
+ else if ('instructions' in transaction) {
56
+ const compiledTransaction = compileTransaction(transaction);
57
+ return getBase64EncodedWireTransaction(compiledTransaction);
58
+ }
59
+ else {
60
+ throw new Error('Invalid transaction type');
61
+ }
62
+ }
63
+ function getTransactionFromWireMessage(byteArray) {
64
+ const transactionDecoder = getTransactionDecoder();
65
+ return transactionDecoder.decode(byteArray);
66
+ }
67
+ function transact(callback, config) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const augmentedCallback = (wallet) => {
70
+ return callback(augmentWalletAPI(wallet));
71
+ };
72
+ return yield transact$1(augmentedCallback, config);
73
+ });
74
+ }
75
+ function startRemoteScenario(config) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const { wallet, close, associationUrl } = yield startRemoteScenario$1(config);
78
+ const augmentedPromise = wallet.then((wallet) => {
79
+ return augmentWalletAPI(wallet);
80
+ });
81
+ return { wallet: augmentedPromise, close, associationUrl };
82
+ });
83
+ }
84
+ function augmentWalletAPI(wallet) {
85
+ return new Proxy({}, {
86
+ get(target, p) {
87
+ if (target[p] == null) {
88
+ switch (p) {
89
+ case 'signAndSendTransactions':
90
+ target[p] = function (_a) {
91
+ var { minContextSlot, commitment, skipPreflight, maxRetries, waitForCommitmentToSendNextTransaction, transactions } = _a, rest = __rest(_a, ["minContextSlot", "commitment", "skipPreflight", "maxRetries", "waitForCommitmentToSendNextTransaction", "transactions"]);
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const payloads = transactions.map(getPayloadFromTransaction);
94
+ const options = {
95
+ min_context_slot: minContextSlot,
96
+ commitment: commitment,
97
+ skip_preflight: skipPreflight,
98
+ max_retries: maxRetries,
99
+ wait_for_commitment_to_send_next_transaction: waitForCommitmentToSendNextTransaction
100
+ };
101
+ const { signatures: base64EncodedSignatures } = yield wallet.signAndSendTransactions(Object.assign(Object.assign(Object.assign({}, rest), (Object.values(options).some(element => element != null)
102
+ ? { options: options }
103
+ : null)), { payloads }));
104
+ const signatures = base64EncodedSignatures.map(toUint8Array);
105
+ return signatures;
106
+ });
107
+ };
108
+ break;
109
+ case 'signMessages':
110
+ target[p] = function (_a) {
111
+ var { payloads } = _a, rest = __rest(_a, ["payloads"]);
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const base64EncodedPayloads = payloads.map(fromUint8Array);
114
+ const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessages(Object.assign(Object.assign({}, rest), { payloads: base64EncodedPayloads }));
115
+ const signedMessages = base64EncodedSignedMessages.map(toUint8Array);
116
+ return signedMessages;
117
+ });
118
+ };
119
+ break;
120
+ case 'signTransactions':
121
+ target[p] = function (_a) {
122
+ var { transactions } = _a, rest = __rest(_a, ["transactions"]);
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ const payloads = transactions.map(getPayloadFromTransaction);
125
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransactions(Object.assign(Object.assign({}, rest), { payloads }));
126
+ const compiledTransactions = base64EncodedCompiledTransactions.map(toUint8Array);
127
+ const signedTransactions = compiledTransactions.map(getTransactionFromWireMessage);
128
+ return signedTransactions;
129
+ });
130
+ };
131
+ break;
132
+ default: {
133
+ target[p] = wallet[p];
134
+ break;
135
+ }
136
+ }
137
+ }
138
+ return target[p];
139
+ },
140
+ defineProperty() {
141
+ return false;
142
+ },
143
+ deleteProperty() {
144
+ return false;
145
+ },
146
+ });
147
+ }
148
+
149
+ export { startRemoteScenario, transact };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,40 @@
1
+ import { Transaction } from "@solana/transactions";
2
+ import { CompilableTransactionMessage } from "@solana/transaction-messages";
3
+ import { SignatureBytes } from "@solana/keys";
4
+ import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, TerminateSessionAPI, WalletAssociationConfig, RemoteWalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
5
+ interface KitSignAndSendTransactionsAPI {
6
+ signAndSendTransactions<T extends Transaction | CompilableTransactionMessage>(params: {
7
+ minContextSlot?: number;
8
+ commitment?: string;
9
+ skipPreflight?: boolean;
10
+ maxRetries?: number;
11
+ waitForCommitmentToSendNextTransaction?: boolean;
12
+ transactions: T[];
13
+ }): Promise<SignatureBytes[]>;
14
+ }
15
+ interface KitSignTransactionsAPI {
16
+ signTransactions<T extends Transaction>(params: {
17
+ transactions: T[];
18
+ }): Promise<T[]>;
19
+ }
20
+ interface KitSignMessagesAPI {
21
+ signMessages(params: {
22
+ addresses: Base64EncodedAddress[];
23
+ payloads: Uint8Array[];
24
+ }): Promise<Uint8Array[]>;
25
+ }
26
+ interface KitMobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, KitSignAndSendTransactionsAPI, KitSignTransactionsAPI, KitSignMessagesAPI {
27
+ }
28
+ interface KitRemoteMobileWallet extends KitMobileWallet, TerminateSessionAPI {
29
+ }
30
+ type KitScenario = Readonly<{
31
+ wallet: Promise<KitMobileWallet>;
32
+ close: () => void;
33
+ }>;
34
+ type KitRemoteScenario = KitScenario & Readonly<{
35
+ associationUrl: URL;
36
+ }>;
37
+ declare function transact<TReturn>(callback: (wallet: KitMobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
38
+ declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<KitRemoteScenario>;
39
+ export { KitMobileWallet, KitRemoteMobileWallet, KitScenario, KitRemoteScenario, transact, startRemoteScenario };
40
+ //# sourceMappingURL=index.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { Transaction } from "@solana/transactions";
2
+ import { CompilableTransactionMessage } from "@solana/transaction-messages";
3
+ import { SignatureBytes } from "@solana/keys";
4
+ import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, TerminateSessionAPI, WalletAssociationConfig, RemoteWalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
5
+ interface KitSignAndSendTransactionsAPI {
6
+ signAndSendTransactions<T extends Transaction | CompilableTransactionMessage>(params: {
7
+ minContextSlot?: number;
8
+ commitment?: string;
9
+ skipPreflight?: boolean;
10
+ maxRetries?: number;
11
+ waitForCommitmentToSendNextTransaction?: boolean;
12
+ transactions: T[];
13
+ }): Promise<SignatureBytes[]>;
14
+ }
15
+ interface KitSignTransactionsAPI {
16
+ signTransactions<T extends Transaction>(params: {
17
+ transactions: T[];
18
+ }): Promise<T[]>;
19
+ }
20
+ interface KitSignMessagesAPI {
21
+ signMessages(params: {
22
+ addresses: Base64EncodedAddress[];
23
+ payloads: Uint8Array[];
24
+ }): Promise<Uint8Array[]>;
25
+ }
26
+ interface KitMobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, KitSignAndSendTransactionsAPI, KitSignTransactionsAPI, KitSignMessagesAPI {
27
+ }
28
+ interface KitRemoteMobileWallet extends KitMobileWallet, TerminateSessionAPI {
29
+ }
30
+ type KitScenario = Readonly<{
31
+ wallet: Promise<KitMobileWallet>;
32
+ close: () => void;
33
+ }>;
34
+ type KitRemoteScenario = KitScenario & Readonly<{
35
+ associationUrl: URL;
36
+ }>;
37
+ declare function transact<TReturn>(callback: (wallet: KitMobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
38
+ declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<KitRemoteScenario>;
39
+ export { KitMobileWallet, KitRemoteMobileWallet, KitScenario, KitRemoteScenario, transact, startRemoteScenario };
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import { Transaction } from "@solana/transactions";
2
+ import { CompilableTransactionMessage } from "@solana/transaction-messages";
3
+ import { SignatureBytes } from "@solana/keys";
4
+ import { AuthorizeAPI, Base64EncodedAddress, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, TerminateSessionAPI, WalletAssociationConfig, RemoteWalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
5
+ interface KitSignAndSendTransactionsAPI {
6
+ signAndSendTransactions<T extends Transaction | CompilableTransactionMessage>(params: {
7
+ minContextSlot?: number;
8
+ commitment?: string;
9
+ skipPreflight?: boolean;
10
+ maxRetries?: number;
11
+ waitForCommitmentToSendNextTransaction?: boolean;
12
+ transactions: T[];
13
+ }): Promise<SignatureBytes[]>;
14
+ }
15
+ interface KitSignTransactionsAPI {
16
+ signTransactions<T extends Transaction>(params: {
17
+ transactions: T[];
18
+ }): Promise<T[]>;
19
+ }
20
+ interface KitSignMessagesAPI {
21
+ signMessages(params: {
22
+ addresses: Base64EncodedAddress[];
23
+ payloads: Uint8Array[];
24
+ }): Promise<Uint8Array[]>;
25
+ }
26
+ interface KitMobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, KitSignAndSendTransactionsAPI, KitSignTransactionsAPI, KitSignMessagesAPI {
27
+ }
28
+ interface KitRemoteMobileWallet extends KitMobileWallet, TerminateSessionAPI {
29
+ }
30
+ type KitScenario = Readonly<{
31
+ wallet: Promise<KitMobileWallet>;
32
+ close: () => void;
33
+ }>;
34
+ type KitRemoteScenario = KitScenario & Readonly<{
35
+ associationUrl: URL;
36
+ }>;
37
+ declare function transact<TReturn>(callback: (wallet: KitMobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
38
+ declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<KitRemoteScenario>;
39
+ export { KitMobileWallet, KitRemoteMobileWallet, KitScenario, KitRemoteScenario, transact, startRemoteScenario };
40
+ //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../src/index.ts","../../src/base64Utils.ts","../../src/transact.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
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.1.0",
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"
15
+ },
16
+ "workerd": {
17
+ "import": "./lib/esm/index.js",
18
+ "require": "./lib/cjs/index.js"
19
+ },
20
+ "browser": {
21
+ "import": "./lib/cjs/index.browser.js",
22
+ "require": "./lib/esm/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"
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
+ "scripts": {
49
+ "clean": "shx rm -rf lib/*",
50
+ "build": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts",
51
+ "build:watch": "yarn clean && rollup --config ../../rollup.config.ts --configPlugin rollup-plugin-ts --watch",
52
+ "postbuild": "cross-env echo {\\\"type\\\":\\\"commonjs\\\"} | npx json > lib/cjs/package.json && echo {\\\"type\\\":\\\"module\\\"} | npx json > lib/esm/package.json",
53
+ "prepublishOnly": "agadoo"
54
+ },
55
+ "peerDependencies": {
56
+ "@solana/kit": "^2.1.0"
57
+ },
58
+ "dependencies": {
59
+ "@solana/transactions": "^2.1.0",
60
+ "@solana-mobile/mobile-wallet-adapter-protocol": "^2.2.0",
61
+ "bs58": "^5.0.0",
62
+ "js-base64": "^3.7.7"
63
+ },
64
+ "devDependencies": {
65
+ "@solana/keys": "^2.1.0",
66
+ "agadoo": "^3.0.0",
67
+ "cross-env": "^7.0.3",
68
+ "shx": "^0.4.0"
69
+ }
70
+ }