@solana-mobile/mobile-wallet-adapter-protocol-web3js 0.0.1-alpha.5 → 0.0.1-alpha.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 +95 -74
- package/lib/cjs/index.js +95 -74
- package/lib/cjs/index.native.js +95 -74
- package/lib/esm/index.browser.mjs +95 -74
- package/lib/esm/index.mjs +95 -74
- package/lib/types/index.browser.d.mts +6 -6
- package/lib/types/index.browser.d.ts +6 -6
- package/lib/types/index.d.mts +6 -6
- package/lib/types/index.d.ts +6 -6
- package/lib/types/index.native.d.ts +6 -6
- package/package.json +3 -3
package/lib/cjs/index.browser.js
CHANGED
|
@@ -41,83 +41,104 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
|
|
|
41
41
|
}
|
|
42
42
|
function transact(callback, config) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const augmentedCallback = (
|
|
45
|
-
const augmentedAPI =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
44
|
+
const augmentedCallback = (wallet) => {
|
|
45
|
+
const augmentedAPI = new Proxy({}, {
|
|
46
|
+
get(target, p) {
|
|
47
|
+
if (target[p] == null) {
|
|
48
|
+
switch (p) {
|
|
49
|
+
case 'signAndSendTransaction':
|
|
50
|
+
target[p] = function (params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
let latestBlockhashPromise;
|
|
53
|
+
function getLatestBlockhash(connection) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (latestBlockhashPromise == null) {
|
|
56
|
+
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
57
|
+
commitment: connection.commitment,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return yield latestBlockhashPromise;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (transaction.feePayer == null) {
|
|
65
|
+
transaction.feePayer = params.fee_payer;
|
|
66
|
+
}
|
|
67
|
+
if (transaction.recentBlockhash == null) {
|
|
68
|
+
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
69
|
+
transaction.recentBlockhash = blockhash;
|
|
70
|
+
}
|
|
71
|
+
const serializedTransaction = transaction.serialize({
|
|
72
|
+
requireAllSignatures: false,
|
|
73
|
+
verifySignatures: false,
|
|
74
|
+
});
|
|
75
|
+
return serializedTransaction.toString('base64');
|
|
76
|
+
})));
|
|
77
|
+
let targetCommitment;
|
|
78
|
+
switch (params.connection.commitment) {
|
|
79
|
+
case 'confirmed':
|
|
80
|
+
case 'finalized':
|
|
81
|
+
case 'processed':
|
|
82
|
+
targetCommitment = params.connection.commitment;
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
targetCommitment = 'finalized';
|
|
86
|
+
}
|
|
87
|
+
const { signatures } = yield wallet.signAndSendTransaction({
|
|
88
|
+
auth_token: params.auth_token,
|
|
89
|
+
commitment: targetCommitment,
|
|
90
|
+
payloads,
|
|
91
|
+
});
|
|
92
|
+
return signatures;
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
break;
|
|
96
|
+
case 'signMessage':
|
|
97
|
+
target[p] = function (params) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
100
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
101
|
+
auth_token: params.auth_token,
|
|
102
|
+
payloads,
|
|
103
|
+
});
|
|
104
|
+
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
105
|
+
return signedMessages;
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
break;
|
|
109
|
+
case 'signTransaction':
|
|
110
|
+
target[p] = function (params) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
113
|
+
requireAllSignatures: false,
|
|
114
|
+
verifySignatures: false,
|
|
115
|
+
}));
|
|
116
|
+
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
117
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransaction({
|
|
118
|
+
auth_token: params.auth_token,
|
|
119
|
+
payloads,
|
|
120
|
+
});
|
|
121
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
122
|
+
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
|
+
return transactions;
|
|
124
|
+
});
|
|
125
|
+
};
|
|
81
126
|
break;
|
|
82
|
-
default:
|
|
83
|
-
|
|
127
|
+
default: {
|
|
128
|
+
target[p] = wallet[p];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
84
131
|
}
|
|
85
|
-
const { signatures } = yield walletAPI('sign_and_send_transaction', {
|
|
86
|
-
auth_token: params.auth_token,
|
|
87
|
-
commitment: targetCommitment,
|
|
88
|
-
payloads,
|
|
89
|
-
});
|
|
90
|
-
return signatures;
|
|
91
|
-
}
|
|
92
|
-
case 'sign_message': {
|
|
93
|
-
const params = args[1];
|
|
94
|
-
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
95
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI('sign_message', {
|
|
96
|
-
auth_token: params.auth_token,
|
|
97
|
-
payloads,
|
|
98
|
-
});
|
|
99
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
100
|
-
return signedMessages;
|
|
101
|
-
}
|
|
102
|
-
case 'sign_transaction': {
|
|
103
|
-
const params = args[1];
|
|
104
|
-
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
105
|
-
requireAllSignatures: false,
|
|
106
|
-
verifySignatures: false,
|
|
107
|
-
}));
|
|
108
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
109
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
|
|
110
|
-
auth_token: params.auth_token,
|
|
111
|
-
payloads,
|
|
112
|
-
});
|
|
113
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
114
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
115
|
-
return transactions;
|
|
116
132
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
return target[p];
|
|
134
|
+
},
|
|
135
|
+
defineProperty() {
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
deleteProperty() {
|
|
139
|
+
return false;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
121
142
|
return callback(augmentedAPI);
|
|
122
143
|
};
|
|
123
144
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
package/lib/cjs/index.js
CHANGED
|
@@ -41,83 +41,104 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
|
|
|
41
41
|
}
|
|
42
42
|
function transact(callback, config) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const augmentedCallback = (
|
|
45
|
-
const augmentedAPI =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
44
|
+
const augmentedCallback = (wallet) => {
|
|
45
|
+
const augmentedAPI = new Proxy({}, {
|
|
46
|
+
get(target, p) {
|
|
47
|
+
if (target[p] == null) {
|
|
48
|
+
switch (p) {
|
|
49
|
+
case 'signAndSendTransaction':
|
|
50
|
+
target[p] = function (params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
let latestBlockhashPromise;
|
|
53
|
+
function getLatestBlockhash(connection) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (latestBlockhashPromise == null) {
|
|
56
|
+
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
57
|
+
commitment: connection.commitment,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return yield latestBlockhashPromise;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (transaction.feePayer == null) {
|
|
65
|
+
transaction.feePayer = params.fee_payer;
|
|
66
|
+
}
|
|
67
|
+
if (transaction.recentBlockhash == null) {
|
|
68
|
+
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
69
|
+
transaction.recentBlockhash = blockhash;
|
|
70
|
+
}
|
|
71
|
+
const serializedTransaction = transaction.serialize({
|
|
72
|
+
requireAllSignatures: false,
|
|
73
|
+
verifySignatures: false,
|
|
74
|
+
});
|
|
75
|
+
return serializedTransaction.toString('base64');
|
|
76
|
+
})));
|
|
77
|
+
let targetCommitment;
|
|
78
|
+
switch (params.connection.commitment) {
|
|
79
|
+
case 'confirmed':
|
|
80
|
+
case 'finalized':
|
|
81
|
+
case 'processed':
|
|
82
|
+
targetCommitment = params.connection.commitment;
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
targetCommitment = 'finalized';
|
|
86
|
+
}
|
|
87
|
+
const { signatures } = yield wallet.signAndSendTransaction({
|
|
88
|
+
auth_token: params.auth_token,
|
|
89
|
+
commitment: targetCommitment,
|
|
90
|
+
payloads,
|
|
91
|
+
});
|
|
92
|
+
return signatures;
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
break;
|
|
96
|
+
case 'signMessage':
|
|
97
|
+
target[p] = function (params) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
100
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
101
|
+
auth_token: params.auth_token,
|
|
102
|
+
payloads,
|
|
103
|
+
});
|
|
104
|
+
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
105
|
+
return signedMessages;
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
break;
|
|
109
|
+
case 'signTransaction':
|
|
110
|
+
target[p] = function (params) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
113
|
+
requireAllSignatures: false,
|
|
114
|
+
verifySignatures: false,
|
|
115
|
+
}));
|
|
116
|
+
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
117
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransaction({
|
|
118
|
+
auth_token: params.auth_token,
|
|
119
|
+
payloads,
|
|
120
|
+
});
|
|
121
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
122
|
+
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
|
+
return transactions;
|
|
124
|
+
});
|
|
125
|
+
};
|
|
81
126
|
break;
|
|
82
|
-
default:
|
|
83
|
-
|
|
127
|
+
default: {
|
|
128
|
+
target[p] = wallet[p];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
84
131
|
}
|
|
85
|
-
const { signatures } = yield walletAPI('sign_and_send_transaction', {
|
|
86
|
-
auth_token: params.auth_token,
|
|
87
|
-
commitment: targetCommitment,
|
|
88
|
-
payloads,
|
|
89
|
-
});
|
|
90
|
-
return signatures;
|
|
91
|
-
}
|
|
92
|
-
case 'sign_message': {
|
|
93
|
-
const params = args[1];
|
|
94
|
-
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
95
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI('sign_message', {
|
|
96
|
-
auth_token: params.auth_token,
|
|
97
|
-
payloads,
|
|
98
|
-
});
|
|
99
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
100
|
-
return signedMessages;
|
|
101
|
-
}
|
|
102
|
-
case 'sign_transaction': {
|
|
103
|
-
const params = args[1];
|
|
104
|
-
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
105
|
-
requireAllSignatures: false,
|
|
106
|
-
verifySignatures: false,
|
|
107
|
-
}));
|
|
108
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
109
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
|
|
110
|
-
auth_token: params.auth_token,
|
|
111
|
-
payloads,
|
|
112
|
-
});
|
|
113
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
114
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
115
|
-
return transactions;
|
|
116
132
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
return target[p];
|
|
134
|
+
},
|
|
135
|
+
defineProperty() {
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
deleteProperty() {
|
|
139
|
+
return false;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
121
142
|
return callback(augmentedAPI);
|
|
122
143
|
};
|
|
123
144
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -41,83 +41,104 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
|
|
|
41
41
|
}
|
|
42
42
|
function transact(callback, config) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const augmentedCallback = (
|
|
45
|
-
const augmentedAPI =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
44
|
+
const augmentedCallback = (wallet) => {
|
|
45
|
+
const augmentedAPI = new Proxy({}, {
|
|
46
|
+
get(target, p) {
|
|
47
|
+
if (target[p] == null) {
|
|
48
|
+
switch (p) {
|
|
49
|
+
case 'signAndSendTransaction':
|
|
50
|
+
target[p] = function (params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
let latestBlockhashPromise;
|
|
53
|
+
function getLatestBlockhash(connection) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (latestBlockhashPromise == null) {
|
|
56
|
+
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
57
|
+
commitment: connection.commitment,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return yield latestBlockhashPromise;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (transaction.feePayer == null) {
|
|
65
|
+
transaction.feePayer = params.fee_payer;
|
|
66
|
+
}
|
|
67
|
+
if (transaction.recentBlockhash == null) {
|
|
68
|
+
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
69
|
+
transaction.recentBlockhash = blockhash;
|
|
70
|
+
}
|
|
71
|
+
const serializedTransaction = transaction.serialize({
|
|
72
|
+
requireAllSignatures: false,
|
|
73
|
+
verifySignatures: false,
|
|
74
|
+
});
|
|
75
|
+
return serializedTransaction.toString('base64');
|
|
76
|
+
})));
|
|
77
|
+
let targetCommitment;
|
|
78
|
+
switch (params.connection.commitment) {
|
|
79
|
+
case 'confirmed':
|
|
80
|
+
case 'finalized':
|
|
81
|
+
case 'processed':
|
|
82
|
+
targetCommitment = params.connection.commitment;
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
targetCommitment = 'finalized';
|
|
86
|
+
}
|
|
87
|
+
const { signatures } = yield wallet.signAndSendTransaction({
|
|
88
|
+
auth_token: params.auth_token,
|
|
89
|
+
commitment: targetCommitment,
|
|
90
|
+
payloads,
|
|
91
|
+
});
|
|
92
|
+
return signatures;
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
break;
|
|
96
|
+
case 'signMessage':
|
|
97
|
+
target[p] = function (params) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
100
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
101
|
+
auth_token: params.auth_token,
|
|
102
|
+
payloads,
|
|
103
|
+
});
|
|
104
|
+
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
105
|
+
return signedMessages;
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
break;
|
|
109
|
+
case 'signTransaction':
|
|
110
|
+
target[p] = function (params) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
113
|
+
requireAllSignatures: false,
|
|
114
|
+
verifySignatures: false,
|
|
115
|
+
}));
|
|
116
|
+
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
117
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransaction({
|
|
118
|
+
auth_token: params.auth_token,
|
|
119
|
+
payloads,
|
|
120
|
+
});
|
|
121
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
122
|
+
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
123
|
+
return transactions;
|
|
124
|
+
});
|
|
125
|
+
};
|
|
81
126
|
break;
|
|
82
|
-
default:
|
|
83
|
-
|
|
127
|
+
default: {
|
|
128
|
+
target[p] = wallet[p];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
84
131
|
}
|
|
85
|
-
const { signatures } = yield walletAPI('sign_and_send_transaction', {
|
|
86
|
-
auth_token: params.auth_token,
|
|
87
|
-
commitment: targetCommitment,
|
|
88
|
-
payloads,
|
|
89
|
-
});
|
|
90
|
-
return signatures;
|
|
91
|
-
}
|
|
92
|
-
case 'sign_message': {
|
|
93
|
-
const params = args[1];
|
|
94
|
-
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
95
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI('sign_message', {
|
|
96
|
-
auth_token: params.auth_token,
|
|
97
|
-
payloads,
|
|
98
|
-
});
|
|
99
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
100
|
-
return signedMessages;
|
|
101
|
-
}
|
|
102
|
-
case 'sign_transaction': {
|
|
103
|
-
const params = args[1];
|
|
104
|
-
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
105
|
-
requireAllSignatures: false,
|
|
106
|
-
verifySignatures: false,
|
|
107
|
-
}));
|
|
108
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
109
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
|
|
110
|
-
auth_token: params.auth_token,
|
|
111
|
-
payloads,
|
|
112
|
-
});
|
|
113
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
114
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
115
|
-
return transactions;
|
|
116
132
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
return target[p];
|
|
134
|
+
},
|
|
135
|
+
defineProperty() {
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
deleteProperty() {
|
|
139
|
+
return false;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
121
142
|
return callback(augmentedAPI);
|
|
122
143
|
};
|
|
123
144
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
@@ -37,83 +37,104 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
|
|
|
37
37
|
}
|
|
38
38
|
function transact(callback, config) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const augmentedCallback = (
|
|
41
|
-
const augmentedAPI =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
40
|
+
const augmentedCallback = (wallet) => {
|
|
41
|
+
const augmentedAPI = new Proxy({}, {
|
|
42
|
+
get(target, p) {
|
|
43
|
+
if (target[p] == null) {
|
|
44
|
+
switch (p) {
|
|
45
|
+
case 'signAndSendTransaction':
|
|
46
|
+
target[p] = function (params) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
let latestBlockhashPromise;
|
|
49
|
+
function getLatestBlockhash(connection) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (latestBlockhashPromise == null) {
|
|
52
|
+
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
53
|
+
commitment: connection.commitment,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return yield latestBlockhashPromise;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (transaction.feePayer == null) {
|
|
61
|
+
transaction.feePayer = params.fee_payer;
|
|
62
|
+
}
|
|
63
|
+
if (transaction.recentBlockhash == null) {
|
|
64
|
+
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
65
|
+
transaction.recentBlockhash = blockhash;
|
|
66
|
+
}
|
|
67
|
+
const serializedTransaction = transaction.serialize({
|
|
68
|
+
requireAllSignatures: false,
|
|
69
|
+
verifySignatures: false,
|
|
70
|
+
});
|
|
71
|
+
return serializedTransaction.toString('base64');
|
|
72
|
+
})));
|
|
73
|
+
let targetCommitment;
|
|
74
|
+
switch (params.connection.commitment) {
|
|
75
|
+
case 'confirmed':
|
|
76
|
+
case 'finalized':
|
|
77
|
+
case 'processed':
|
|
78
|
+
targetCommitment = params.connection.commitment;
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
targetCommitment = 'finalized';
|
|
82
|
+
}
|
|
83
|
+
const { signatures } = yield wallet.signAndSendTransaction({
|
|
84
|
+
auth_token: params.auth_token,
|
|
85
|
+
commitment: targetCommitment,
|
|
86
|
+
payloads,
|
|
87
|
+
});
|
|
88
|
+
return signatures;
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
break;
|
|
92
|
+
case 'signMessage':
|
|
93
|
+
target[p] = function (params) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
96
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
97
|
+
auth_token: params.auth_token,
|
|
98
|
+
payloads,
|
|
99
|
+
});
|
|
100
|
+
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
101
|
+
return signedMessages;
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
break;
|
|
105
|
+
case 'signTransaction':
|
|
106
|
+
target[p] = function (params) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
109
|
+
requireAllSignatures: false,
|
|
110
|
+
verifySignatures: false,
|
|
111
|
+
}));
|
|
112
|
+
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
113
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransaction({
|
|
114
|
+
auth_token: params.auth_token,
|
|
115
|
+
payloads,
|
|
116
|
+
});
|
|
117
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
118
|
+
const transactions = compiledTransactions.map(Transaction.from);
|
|
119
|
+
return transactions;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
77
122
|
break;
|
|
78
|
-
default:
|
|
79
|
-
|
|
123
|
+
default: {
|
|
124
|
+
target[p] = wallet[p];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
80
127
|
}
|
|
81
|
-
const { signatures } = yield walletAPI('sign_and_send_transaction', {
|
|
82
|
-
auth_token: params.auth_token,
|
|
83
|
-
commitment: targetCommitment,
|
|
84
|
-
payloads,
|
|
85
|
-
});
|
|
86
|
-
return signatures;
|
|
87
|
-
}
|
|
88
|
-
case 'sign_message': {
|
|
89
|
-
const params = args[1];
|
|
90
|
-
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
91
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI('sign_message', {
|
|
92
|
-
auth_token: params.auth_token,
|
|
93
|
-
payloads,
|
|
94
|
-
});
|
|
95
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
96
|
-
return signedMessages;
|
|
97
|
-
}
|
|
98
|
-
case 'sign_transaction': {
|
|
99
|
-
const params = args[1];
|
|
100
|
-
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
101
|
-
requireAllSignatures: false,
|
|
102
|
-
verifySignatures: false,
|
|
103
|
-
}));
|
|
104
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
105
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
|
|
106
|
-
auth_token: params.auth_token,
|
|
107
|
-
payloads,
|
|
108
|
-
});
|
|
109
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
110
|
-
const transactions = compiledTransactions.map(Transaction.from);
|
|
111
|
-
return transactions;
|
|
112
128
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
return target[p];
|
|
130
|
+
},
|
|
131
|
+
defineProperty() {
|
|
132
|
+
return false;
|
|
133
|
+
},
|
|
134
|
+
deleteProperty() {
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
117
138
|
return callback(augmentedAPI);
|
|
118
139
|
};
|
|
119
140
|
return yield transact$1(augmentedCallback, config);
|
package/lib/esm/index.mjs
CHANGED
|
@@ -37,83 +37,104 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
|
|
|
37
37
|
}
|
|
38
38
|
function transact(callback, config) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const augmentedCallback = (
|
|
41
|
-
const augmentedAPI =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
40
|
+
const augmentedCallback = (wallet) => {
|
|
41
|
+
const augmentedAPI = new Proxy({}, {
|
|
42
|
+
get(target, p) {
|
|
43
|
+
if (target[p] == null) {
|
|
44
|
+
switch (p) {
|
|
45
|
+
case 'signAndSendTransaction':
|
|
46
|
+
target[p] = function (params) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
let latestBlockhashPromise;
|
|
49
|
+
function getLatestBlockhash(connection) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (latestBlockhashPromise == null) {
|
|
52
|
+
latestBlockhashPromise = connection.getLatestBlockhash({
|
|
53
|
+
commitment: connection.commitment,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return yield latestBlockhashPromise;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (transaction.feePayer == null) {
|
|
61
|
+
transaction.feePayer = params.fee_payer;
|
|
62
|
+
}
|
|
63
|
+
if (transaction.recentBlockhash == null) {
|
|
64
|
+
const { blockhash } = yield getLatestBlockhash(params.connection);
|
|
65
|
+
transaction.recentBlockhash = blockhash;
|
|
66
|
+
}
|
|
67
|
+
const serializedTransaction = transaction.serialize({
|
|
68
|
+
requireAllSignatures: false,
|
|
69
|
+
verifySignatures: false,
|
|
70
|
+
});
|
|
71
|
+
return serializedTransaction.toString('base64');
|
|
72
|
+
})));
|
|
73
|
+
let targetCommitment;
|
|
74
|
+
switch (params.connection.commitment) {
|
|
75
|
+
case 'confirmed':
|
|
76
|
+
case 'finalized':
|
|
77
|
+
case 'processed':
|
|
78
|
+
targetCommitment = params.connection.commitment;
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
targetCommitment = 'finalized';
|
|
82
|
+
}
|
|
83
|
+
const { signatures } = yield wallet.signAndSendTransaction({
|
|
84
|
+
auth_token: params.auth_token,
|
|
85
|
+
commitment: targetCommitment,
|
|
86
|
+
payloads,
|
|
87
|
+
});
|
|
88
|
+
return signatures;
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
break;
|
|
92
|
+
case 'signMessage':
|
|
93
|
+
target[p] = function (params) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
96
|
+
const { signed_payloads: base64EncodedSignedMessages } = yield wallet.signMessage({
|
|
97
|
+
auth_token: params.auth_token,
|
|
98
|
+
payloads,
|
|
99
|
+
});
|
|
100
|
+
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
101
|
+
return signedMessages;
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
break;
|
|
105
|
+
case 'signTransaction':
|
|
106
|
+
target[p] = function (params) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
109
|
+
requireAllSignatures: false,
|
|
110
|
+
verifySignatures: false,
|
|
111
|
+
}));
|
|
112
|
+
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
113
|
+
const { signed_payloads: base64EncodedCompiledTransactions } = yield wallet.signTransaction({
|
|
114
|
+
auth_token: params.auth_token,
|
|
115
|
+
payloads,
|
|
116
|
+
});
|
|
117
|
+
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
118
|
+
const transactions = compiledTransactions.map(Transaction.from);
|
|
119
|
+
return transactions;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
77
122
|
break;
|
|
78
|
-
default:
|
|
79
|
-
|
|
123
|
+
default: {
|
|
124
|
+
target[p] = wallet[p];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
80
127
|
}
|
|
81
|
-
const { signatures } = yield walletAPI('sign_and_send_transaction', {
|
|
82
|
-
auth_token: params.auth_token,
|
|
83
|
-
commitment: targetCommitment,
|
|
84
|
-
payloads,
|
|
85
|
-
});
|
|
86
|
-
return signatures;
|
|
87
|
-
}
|
|
88
|
-
case 'sign_message': {
|
|
89
|
-
const params = args[1];
|
|
90
|
-
const payloads = params.payloads.map(getBase64StringFromByteArray);
|
|
91
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI('sign_message', {
|
|
92
|
-
auth_token: params.auth_token,
|
|
93
|
-
payloads,
|
|
94
|
-
});
|
|
95
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
96
|
-
return signedMessages;
|
|
97
|
-
}
|
|
98
|
-
case 'sign_transaction': {
|
|
99
|
-
const params = args[1];
|
|
100
|
-
const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
|
|
101
|
-
requireAllSignatures: false,
|
|
102
|
-
verifySignatures: false,
|
|
103
|
-
}));
|
|
104
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
105
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
|
|
106
|
-
auth_token: params.auth_token,
|
|
107
|
-
payloads,
|
|
108
|
-
});
|
|
109
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
110
|
-
const transactions = compiledTransactions.map(Transaction.from);
|
|
111
|
-
return transactions;
|
|
112
128
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
return target[p];
|
|
130
|
+
},
|
|
131
|
+
defineProperty() {
|
|
132
|
+
return false;
|
|
133
|
+
},
|
|
134
|
+
deleteProperty() {
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
117
138
|
return callback(augmentedAPI);
|
|
118
139
|
};
|
|
119
140
|
return yield transact$1(augmentedCallback, config);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, PublicKey, Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
2
|
import { AuthorizeAPI, AuthToken, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
3
|
interface Web3SignAndSendTransactionAPI {
|
|
4
|
-
(
|
|
4
|
+
signAndSendTransaction(params: {
|
|
5
5
|
auth_token: AuthToken;
|
|
6
6
|
connection: Connection;
|
|
7
7
|
fee_payer?: PublicKey;
|
|
@@ -9,19 +9,19 @@ interface Web3SignAndSendTransactionAPI {
|
|
|
9
9
|
}): Promise<TransactionSignature[]>;
|
|
10
10
|
}
|
|
11
11
|
interface Web3SignTransactionAPI {
|
|
12
|
-
(
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
16
|
}
|
|
17
17
|
interface Web3SignMessageAPI {
|
|
18
|
-
(
|
|
18
|
+
signMessage(params: {
|
|
19
19
|
auth_token: AuthToken;
|
|
20
20
|
payloads: Uint8Array[];
|
|
21
21
|
}): Promise<Uint8Array[]>;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
24
|
}
|
|
25
|
-
declare function transact<TReturn>(callback: (
|
|
26
|
-
export {
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
27
27
|
//# sourceMappingURL=index.browser.d.mts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, PublicKey, Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
2
|
import { AuthorizeAPI, AuthToken, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
3
|
interface Web3SignAndSendTransactionAPI {
|
|
4
|
-
(
|
|
4
|
+
signAndSendTransaction(params: {
|
|
5
5
|
auth_token: AuthToken;
|
|
6
6
|
connection: Connection;
|
|
7
7
|
fee_payer?: PublicKey;
|
|
@@ -9,19 +9,19 @@ interface Web3SignAndSendTransactionAPI {
|
|
|
9
9
|
}): Promise<TransactionSignature[]>;
|
|
10
10
|
}
|
|
11
11
|
interface Web3SignTransactionAPI {
|
|
12
|
-
(
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
16
|
}
|
|
17
17
|
interface Web3SignMessageAPI {
|
|
18
|
-
(
|
|
18
|
+
signMessage(params: {
|
|
19
19
|
auth_token: AuthToken;
|
|
20
20
|
payloads: Uint8Array[];
|
|
21
21
|
}): Promise<Uint8Array[]>;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
24
|
}
|
|
25
|
-
declare function transact<TReturn>(callback: (
|
|
26
|
-
export {
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
27
27
|
//# sourceMappingURL=index.browser.d.ts.map
|
package/lib/types/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, PublicKey, Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
2
|
import { AuthorizeAPI, AuthToken, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
3
|
interface Web3SignAndSendTransactionAPI {
|
|
4
|
-
(
|
|
4
|
+
signAndSendTransaction(params: {
|
|
5
5
|
auth_token: AuthToken;
|
|
6
6
|
connection: Connection;
|
|
7
7
|
fee_payer?: PublicKey;
|
|
@@ -9,19 +9,19 @@ interface Web3SignAndSendTransactionAPI {
|
|
|
9
9
|
}): Promise<TransactionSignature[]>;
|
|
10
10
|
}
|
|
11
11
|
interface Web3SignTransactionAPI {
|
|
12
|
-
(
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
16
|
}
|
|
17
17
|
interface Web3SignMessageAPI {
|
|
18
|
-
(
|
|
18
|
+
signMessage(params: {
|
|
19
19
|
auth_token: AuthToken;
|
|
20
20
|
payloads: Uint8Array[];
|
|
21
21
|
}): Promise<Uint8Array[]>;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
24
|
}
|
|
25
|
-
declare function transact<TReturn>(callback: (
|
|
26
|
-
export {
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
27
27
|
//# sourceMappingURL=index.d.mts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, PublicKey, Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
2
|
import { AuthorizeAPI, AuthToken, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
3
|
interface Web3SignAndSendTransactionAPI {
|
|
4
|
-
(
|
|
4
|
+
signAndSendTransaction(params: {
|
|
5
5
|
auth_token: AuthToken;
|
|
6
6
|
connection: Connection;
|
|
7
7
|
fee_payer?: PublicKey;
|
|
@@ -9,19 +9,19 @@ interface Web3SignAndSendTransactionAPI {
|
|
|
9
9
|
}): Promise<TransactionSignature[]>;
|
|
10
10
|
}
|
|
11
11
|
interface Web3SignTransactionAPI {
|
|
12
|
-
(
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
16
|
}
|
|
17
17
|
interface Web3SignMessageAPI {
|
|
18
|
-
(
|
|
18
|
+
signMessage(params: {
|
|
19
19
|
auth_token: AuthToken;
|
|
20
20
|
payloads: Uint8Array[];
|
|
21
21
|
}): Promise<Uint8Array[]>;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
24
|
}
|
|
25
|
-
declare function transact<TReturn>(callback: (
|
|
26
|
-
export {
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, PublicKey, Transaction, TransactionSignature } from "@solana/web3.js";
|
|
2
2
|
import { AuthorizeAPI, AuthToken, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, WalletAssociationConfig } from "@solana-mobile/mobile-wallet-adapter-protocol";
|
|
3
3
|
interface Web3SignAndSendTransactionAPI {
|
|
4
|
-
(
|
|
4
|
+
signAndSendTransaction(params: {
|
|
5
5
|
auth_token: AuthToken;
|
|
6
6
|
connection: Connection;
|
|
7
7
|
fee_payer?: PublicKey;
|
|
@@ -9,19 +9,19 @@ interface Web3SignAndSendTransactionAPI {
|
|
|
9
9
|
}): Promise<TransactionSignature[]>;
|
|
10
10
|
}
|
|
11
11
|
interface Web3SignTransactionAPI {
|
|
12
|
-
(
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
16
|
}
|
|
17
17
|
interface Web3SignMessageAPI {
|
|
18
|
-
(
|
|
18
|
+
signMessage(params: {
|
|
19
19
|
auth_token: AuthToken;
|
|
20
20
|
payloads: Uint8Array[];
|
|
21
21
|
}): Promise<Uint8Array[]>;
|
|
22
22
|
}
|
|
23
|
-
interface
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
24
|
}
|
|
25
|
-
declare function transact<TReturn>(callback: (
|
|
26
|
-
export {
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
27
27
|
//# sourceMappingURL=index.native.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/mobile-wallet-adapter-protocol-web3js",
|
|
3
3
|
"description": "A convenience wrapper that enables you to call Solana Mobile Stack protocol methods using objects from @solana/web3.js",
|
|
4
|
-
"version": "0.0.1-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.6",
|
|
5
5
|
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
6
|
"repository": "https://github.com/solana-mobile/mobile-wallet-adapter",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@solana/web3.js": "^1.48.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@solana-mobile/mobile-wallet-adapter-protocol": "^0.0.1-alpha.
|
|
43
|
+
"@solana-mobile/mobile-wallet-adapter-protocol": "^0.0.1-alpha.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"agadoo": "^2.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "8cef0e0dd72e01cd522b16b6e486a26abe1e032b"
|
|
49
49
|
}
|