@solana-mobile/mobile-wallet-adapter-protocol-web3js 0.0.1-alpha.3 → 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 -82
- package/lib/cjs/index.js +95 -82
- package/lib/cjs/index.native.js +95 -82
- package/lib/esm/index.browser.mjs +95 -82
- package/lib/esm/index.mjs +95 -82
- package/lib/types/index.browser.d.mts +13 -10
- package/lib/types/index.browser.d.ts +13 -10
- package/lib/types/index.d.mts +13 -10
- package/lib/types/index.d.ts +13 -10
- package/lib/types/index.native.d.ts +13 -10
- package/package.json +3 -3
package/lib/cjs/index.browser.js
CHANGED
|
@@ -41,91 +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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
};
|
|
87
126
|
break;
|
|
88
|
-
default:
|
|
89
|
-
|
|
127
|
+
default: {
|
|
128
|
+
target[p] = wallet[p];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
90
131
|
}
|
|
91
|
-
const { signatures } = yield walletAPI({
|
|
92
|
-
method: 'sign_and_send_transaction',
|
|
93
|
-
auth_token: apiCall.auth_token,
|
|
94
|
-
commitment: targetCommitment,
|
|
95
|
-
payloads,
|
|
96
|
-
});
|
|
97
|
-
return signatures;
|
|
98
|
-
}
|
|
99
|
-
case 'sign_message': {
|
|
100
|
-
const payloads = apiCall.byteArrays.map(getBase64StringFromByteArray);
|
|
101
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI({
|
|
102
|
-
method: 'sign_message',
|
|
103
|
-
auth_token: apiCall.auth_token,
|
|
104
|
-
payloads,
|
|
105
|
-
});
|
|
106
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
107
|
-
return signedMessages;
|
|
108
|
-
}
|
|
109
|
-
case 'sign_transaction': {
|
|
110
|
-
const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
|
|
111
|
-
requireAllSignatures: false,
|
|
112
|
-
verifySignatures: false,
|
|
113
|
-
}));
|
|
114
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
115
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI({
|
|
116
|
-
method: 'sign_transaction',
|
|
117
|
-
auth_token: apiCall.auth_token,
|
|
118
|
-
payloads,
|
|
119
|
-
});
|
|
120
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
121
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
122
|
-
return transactions;
|
|
123
132
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
return target[p];
|
|
134
|
+
},
|
|
135
|
+
defineProperty() {
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
deleteProperty() {
|
|
139
|
+
return false;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
129
142
|
return callback(augmentedAPI);
|
|
130
143
|
};
|
|
131
144
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
package/lib/cjs/index.js
CHANGED
|
@@ -41,91 +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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
};
|
|
87
126
|
break;
|
|
88
|
-
default:
|
|
89
|
-
|
|
127
|
+
default: {
|
|
128
|
+
target[p] = wallet[p];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
90
131
|
}
|
|
91
|
-
const { signatures } = yield walletAPI({
|
|
92
|
-
method: 'sign_and_send_transaction',
|
|
93
|
-
auth_token: apiCall.auth_token,
|
|
94
|
-
commitment: targetCommitment,
|
|
95
|
-
payloads,
|
|
96
|
-
});
|
|
97
|
-
return signatures;
|
|
98
|
-
}
|
|
99
|
-
case 'sign_message': {
|
|
100
|
-
const payloads = apiCall.byteArrays.map(getBase64StringFromByteArray);
|
|
101
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI({
|
|
102
|
-
method: 'sign_message',
|
|
103
|
-
auth_token: apiCall.auth_token,
|
|
104
|
-
payloads,
|
|
105
|
-
});
|
|
106
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
107
|
-
return signedMessages;
|
|
108
|
-
}
|
|
109
|
-
case 'sign_transaction': {
|
|
110
|
-
const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
|
|
111
|
-
requireAllSignatures: false,
|
|
112
|
-
verifySignatures: false,
|
|
113
|
-
}));
|
|
114
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
115
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI({
|
|
116
|
-
method: 'sign_transaction',
|
|
117
|
-
auth_token: apiCall.auth_token,
|
|
118
|
-
payloads,
|
|
119
|
-
});
|
|
120
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
121
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
122
|
-
return transactions;
|
|
123
132
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
return target[p];
|
|
134
|
+
},
|
|
135
|
+
defineProperty() {
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
deleteProperty() {
|
|
139
|
+
return false;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
129
142
|
return callback(augmentedAPI);
|
|
130
143
|
};
|
|
131
144
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
package/lib/cjs/index.native.js
CHANGED
|
@@ -41,91 +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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
};
|
|
87
126
|
break;
|
|
88
|
-
default:
|
|
89
|
-
|
|
127
|
+
default: {
|
|
128
|
+
target[p] = wallet[p];
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
90
131
|
}
|
|
91
|
-
const { signatures } = yield walletAPI({
|
|
92
|
-
method: 'sign_and_send_transaction',
|
|
93
|
-
auth_token: apiCall.auth_token,
|
|
94
|
-
commitment: targetCommitment,
|
|
95
|
-
payloads,
|
|
96
|
-
});
|
|
97
|
-
return signatures;
|
|
98
|
-
}
|
|
99
|
-
case 'sign_message': {
|
|
100
|
-
const payloads = apiCall.byteArrays.map(getBase64StringFromByteArray);
|
|
101
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI({
|
|
102
|
-
method: 'sign_message',
|
|
103
|
-
auth_token: apiCall.auth_token,
|
|
104
|
-
payloads,
|
|
105
|
-
});
|
|
106
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
107
|
-
return signedMessages;
|
|
108
|
-
}
|
|
109
|
-
case 'sign_transaction': {
|
|
110
|
-
const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
|
|
111
|
-
requireAllSignatures: false,
|
|
112
|
-
verifySignatures: false,
|
|
113
|
-
}));
|
|
114
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
115
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI({
|
|
116
|
-
method: 'sign_transaction',
|
|
117
|
-
auth_token: apiCall.auth_token,
|
|
118
|
-
payloads,
|
|
119
|
-
});
|
|
120
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
121
|
-
const transactions = compiledTransactions.map(web3_js.Transaction.from);
|
|
122
|
-
return transactions;
|
|
123
132
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
133
|
+
return target[p];
|
|
134
|
+
},
|
|
135
|
+
defineProperty() {
|
|
136
|
+
return false;
|
|
137
|
+
},
|
|
138
|
+
deleteProperty() {
|
|
139
|
+
return false;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
129
142
|
return callback(augmentedAPI);
|
|
130
143
|
};
|
|
131
144
|
return yield mobileWalletAdapterProtocol.transact(augmentedCallback, config);
|
|
@@ -37,91 +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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
+
};
|
|
83
122
|
break;
|
|
84
|
-
default:
|
|
85
|
-
|
|
123
|
+
default: {
|
|
124
|
+
target[p] = wallet[p];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
86
127
|
}
|
|
87
|
-
const { signatures } = yield walletAPI({
|
|
88
|
-
method: 'sign_and_send_transaction',
|
|
89
|
-
auth_token: apiCall.auth_token,
|
|
90
|
-
commitment: targetCommitment,
|
|
91
|
-
payloads,
|
|
92
|
-
});
|
|
93
|
-
return signatures;
|
|
94
|
-
}
|
|
95
|
-
case 'sign_message': {
|
|
96
|
-
const payloads = apiCall.byteArrays.map(getBase64StringFromByteArray);
|
|
97
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI({
|
|
98
|
-
method: 'sign_message',
|
|
99
|
-
auth_token: apiCall.auth_token,
|
|
100
|
-
payloads,
|
|
101
|
-
});
|
|
102
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
103
|
-
return signedMessages;
|
|
104
|
-
}
|
|
105
|
-
case 'sign_transaction': {
|
|
106
|
-
const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
|
|
107
|
-
requireAllSignatures: false,
|
|
108
|
-
verifySignatures: false,
|
|
109
|
-
}));
|
|
110
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
111
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI({
|
|
112
|
-
method: 'sign_transaction',
|
|
113
|
-
auth_token: apiCall.auth_token,
|
|
114
|
-
payloads,
|
|
115
|
-
});
|
|
116
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
117
|
-
const transactions = compiledTransactions.map(Transaction.from);
|
|
118
|
-
return transactions;
|
|
119
128
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
return target[p];
|
|
130
|
+
},
|
|
131
|
+
defineProperty() {
|
|
132
|
+
return false;
|
|
133
|
+
},
|
|
134
|
+
deleteProperty() {
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
125
138
|
return callback(augmentedAPI);
|
|
126
139
|
};
|
|
127
140
|
return yield transact$1(augmentedCallback, config);
|
package/lib/esm/index.mjs
CHANGED
|
@@ -37,91 +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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
+
};
|
|
83
122
|
break;
|
|
84
|
-
default:
|
|
85
|
-
|
|
123
|
+
default: {
|
|
124
|
+
target[p] = wallet[p];
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
86
127
|
}
|
|
87
|
-
const { signatures } = yield walletAPI({
|
|
88
|
-
method: 'sign_and_send_transaction',
|
|
89
|
-
auth_token: apiCall.auth_token,
|
|
90
|
-
commitment: targetCommitment,
|
|
91
|
-
payloads,
|
|
92
|
-
});
|
|
93
|
-
return signatures;
|
|
94
|
-
}
|
|
95
|
-
case 'sign_message': {
|
|
96
|
-
const payloads = apiCall.byteArrays.map(getBase64StringFromByteArray);
|
|
97
|
-
const { signed_payloads: base64EncodedSignedMessages } = yield walletAPI({
|
|
98
|
-
method: 'sign_message',
|
|
99
|
-
auth_token: apiCall.auth_token,
|
|
100
|
-
payloads,
|
|
101
|
-
});
|
|
102
|
-
const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
|
|
103
|
-
return signedMessages;
|
|
104
|
-
}
|
|
105
|
-
case 'sign_transaction': {
|
|
106
|
-
const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
|
|
107
|
-
requireAllSignatures: false,
|
|
108
|
-
verifySignatures: false,
|
|
109
|
-
}));
|
|
110
|
-
const payloads = serializedTransactions.map((serializedTransaction) => serializedTransaction.toString('base64'));
|
|
111
|
-
const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI({
|
|
112
|
-
method: 'sign_transaction',
|
|
113
|
-
auth_token: apiCall.auth_token,
|
|
114
|
-
payloads,
|
|
115
|
-
});
|
|
116
|
-
const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
|
|
117
|
-
const transactions = compiledTransactions.map(Transaction.from);
|
|
118
|
-
return transactions;
|
|
119
128
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
return target[p];
|
|
130
|
+
},
|
|
131
|
+
defineProperty() {
|
|
132
|
+
return false;
|
|
133
|
+
},
|
|
134
|
+
deleteProperty() {
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
});
|
|
125
138
|
return callback(augmentedAPI);
|
|
126
139
|
};
|
|
127
140
|
return yield transact$1(augmentedCallback, config);
|
|
@@ -1,24 +1,27 @@
|
|
|
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
|
-
interface
|
|
4
|
-
(
|
|
5
|
-
method: "sign_and_send_transaction";
|
|
3
|
+
interface Web3SignAndSendTransactionAPI {
|
|
4
|
+
signAndSendTransaction(params: {
|
|
6
5
|
auth_token: AuthToken;
|
|
7
6
|
connection: Connection;
|
|
8
7
|
fee_payer?: PublicKey;
|
|
9
8
|
transactions: Transaction[];
|
|
10
9
|
}): Promise<TransactionSignature[]>;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
interface Web3SignTransactionAPI {
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
interface Web3SignMessageAPI {
|
|
18
|
+
signMessage(params: {
|
|
18
19
|
auth_token: AuthToken;
|
|
19
|
-
|
|
20
|
+
payloads: Uint8Array[];
|
|
20
21
|
}): Promise<Uint8Array[]>;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
|
+
}
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
24
27
|
//# sourceMappingURL=index.browser.d.mts.map
|
|
@@ -1,24 +1,27 @@
|
|
|
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
|
-
interface
|
|
4
|
-
(
|
|
5
|
-
method: "sign_and_send_transaction";
|
|
3
|
+
interface Web3SignAndSendTransactionAPI {
|
|
4
|
+
signAndSendTransaction(params: {
|
|
6
5
|
auth_token: AuthToken;
|
|
7
6
|
connection: Connection;
|
|
8
7
|
fee_payer?: PublicKey;
|
|
9
8
|
transactions: Transaction[];
|
|
10
9
|
}): Promise<TransactionSignature[]>;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
interface Web3SignTransactionAPI {
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
interface Web3SignMessageAPI {
|
|
18
|
+
signMessage(params: {
|
|
18
19
|
auth_token: AuthToken;
|
|
19
|
-
|
|
20
|
+
payloads: Uint8Array[];
|
|
20
21
|
}): Promise<Uint8Array[]>;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
|
+
}
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
24
27
|
//# sourceMappingURL=index.browser.d.ts.map
|
package/lib/types/index.d.mts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
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
|
-
interface
|
|
4
|
-
(
|
|
5
|
-
method: "sign_and_send_transaction";
|
|
3
|
+
interface Web3SignAndSendTransactionAPI {
|
|
4
|
+
signAndSendTransaction(params: {
|
|
6
5
|
auth_token: AuthToken;
|
|
7
6
|
connection: Connection;
|
|
8
7
|
fee_payer?: PublicKey;
|
|
9
8
|
transactions: Transaction[];
|
|
10
9
|
}): Promise<TransactionSignature[]>;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
interface Web3SignTransactionAPI {
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
interface Web3SignMessageAPI {
|
|
18
|
+
signMessage(params: {
|
|
18
19
|
auth_token: AuthToken;
|
|
19
|
-
|
|
20
|
+
payloads: Uint8Array[];
|
|
20
21
|
}): Promise<Uint8Array[]>;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
|
+
}
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
24
27
|
//# sourceMappingURL=index.d.mts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
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
|
-
interface
|
|
4
|
-
(
|
|
5
|
-
method: "sign_and_send_transaction";
|
|
3
|
+
interface Web3SignAndSendTransactionAPI {
|
|
4
|
+
signAndSendTransaction(params: {
|
|
6
5
|
auth_token: AuthToken;
|
|
7
6
|
connection: Connection;
|
|
8
7
|
fee_payer?: PublicKey;
|
|
9
8
|
transactions: Transaction[];
|
|
10
9
|
}): Promise<TransactionSignature[]>;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
interface Web3SignTransactionAPI {
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
interface Web3SignMessageAPI {
|
|
18
|
+
signMessage(params: {
|
|
18
19
|
auth_token: AuthToken;
|
|
19
|
-
|
|
20
|
+
payloads: Uint8Array[];
|
|
20
21
|
}): Promise<Uint8Array[]>;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
|
+
}
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
24
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,24 +1,27 @@
|
|
|
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
|
-
interface
|
|
4
|
-
(
|
|
5
|
-
method: "sign_and_send_transaction";
|
|
3
|
+
interface Web3SignAndSendTransactionAPI {
|
|
4
|
+
signAndSendTransaction(params: {
|
|
6
5
|
auth_token: AuthToken;
|
|
7
6
|
connection: Connection;
|
|
8
7
|
fee_payer?: PublicKey;
|
|
9
8
|
transactions: Transaction[];
|
|
10
9
|
}): Promise<TransactionSignature[]>;
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
interface Web3SignTransactionAPI {
|
|
12
|
+
signTransaction(params: {
|
|
13
13
|
auth_token: AuthToken;
|
|
14
14
|
transactions: Transaction[];
|
|
15
15
|
}): Promise<Transaction[]>;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
}
|
|
17
|
+
interface Web3SignMessageAPI {
|
|
18
|
+
signMessage(params: {
|
|
18
19
|
auth_token: AuthToken;
|
|
19
|
-
|
|
20
|
+
payloads: Uint8Array[];
|
|
20
21
|
}): Promise<Uint8Array[]>;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
interface Web3MobileWallet extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
|
|
24
|
+
}
|
|
25
|
+
declare function transact<TReturn>(callback: (wallet: Web3MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
26
|
+
export { Web3MobileWallet, transact };
|
|
24
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
|
}
|