@solana-mobile/mobile-wallet-adapter-protocol-web3js 0.0.1-alpha.4 → 0.0.1-alpha.5

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.
@@ -42,7 +42,7 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
42
42
  function transact(callback, config) {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  const augmentedCallback = (walletAPI) => {
45
- const augmentedAPI = ((apiCall) => __awaiter(this, void 0, void 0, function* () {
45
+ const augmentedAPI = ((...args) => __awaiter(this, void 0, void 0, function* () {
46
46
  let latestBlockhashPromise;
47
47
  function getLatestBlockhash(connection) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,22 +54,16 @@ function transact(callback, config) {
54
54
  return yield latestBlockhashPromise;
55
55
  });
56
56
  }
57
- switch (apiCall.method) {
58
- case 'authorize':
59
- return yield walletAPI(apiCall);
60
- case 'clone_authorization':
61
- return yield walletAPI(apiCall);
62
- case 'deauthorize':
63
- return yield walletAPI(apiCall);
64
- case 'reauthorize':
65
- return yield walletAPI(apiCall);
57
+ const [method] = args;
58
+ switch (method) {
66
59
  case 'sign_and_send_transaction': {
67
- const payloads = yield Promise.all(apiCall.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
60
+ const params = args[1];
61
+ const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
68
62
  if (transaction.feePayer == null) {
69
- transaction.feePayer = apiCall.fee_payer;
63
+ transaction.feePayer = params.fee_payer;
70
64
  }
71
65
  if (transaction.recentBlockhash == null) {
72
- const { blockhash } = yield getLatestBlockhash(apiCall.connection);
66
+ const { blockhash } = yield getLatestBlockhash(params.connection);
73
67
  transaction.recentBlockhash = blockhash;
74
68
  }
75
69
  const serializedTransaction = transaction.serialize({
@@ -79,42 +73,41 @@ function transact(callback, config) {
79
73
  return serializedTransaction.toString('base64');
80
74
  })));
81
75
  let targetCommitment;
82
- switch (apiCall.connection.commitment) {
76
+ switch (params.connection.commitment) {
83
77
  case 'confirmed':
84
78
  case 'finalized':
85
79
  case 'processed':
86
- targetCommitment = apiCall.connection.commitment;
80
+ targetCommitment = params.connection.commitment;
87
81
  break;
88
82
  default:
89
83
  targetCommitment = 'finalized';
90
84
  }
91
- const { signatures } = yield walletAPI({
92
- method: 'sign_and_send_transaction',
93
- auth_token: apiCall.auth_token,
85
+ const { signatures } = yield walletAPI('sign_and_send_transaction', {
86
+ auth_token: params.auth_token,
94
87
  commitment: targetCommitment,
95
88
  payloads,
96
89
  });
97
90
  return signatures;
98
91
  }
99
92
  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,
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,
104
97
  payloads,
105
98
  });
106
99
  const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
107
100
  return signedMessages;
108
101
  }
109
102
  case 'sign_transaction': {
110
- const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
103
+ const params = args[1];
104
+ const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
111
105
  requireAllSignatures: false,
112
106
  verifySignatures: false,
113
107
  }));
114
108
  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,
109
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
110
+ auth_token: params.auth_token,
118
111
  payloads,
119
112
  });
120
113
  const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
@@ -122,8 +115,7 @@ function transact(callback, config) {
122
115
  return transactions;
123
116
  }
124
117
  default:
125
- // If this switch is exhausive, this should be unreachable.
126
- return ((_) => undefined)();
118
+ return yield walletAPI(...args);
127
119
  }
128
120
  }));
129
121
  return callback(augmentedAPI);
package/lib/cjs/index.js CHANGED
@@ -42,7 +42,7 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
42
42
  function transact(callback, config) {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  const augmentedCallback = (walletAPI) => {
45
- const augmentedAPI = ((apiCall) => __awaiter(this, void 0, void 0, function* () {
45
+ const augmentedAPI = ((...args) => __awaiter(this, void 0, void 0, function* () {
46
46
  let latestBlockhashPromise;
47
47
  function getLatestBlockhash(connection) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,22 +54,16 @@ function transact(callback, config) {
54
54
  return yield latestBlockhashPromise;
55
55
  });
56
56
  }
57
- switch (apiCall.method) {
58
- case 'authorize':
59
- return yield walletAPI(apiCall);
60
- case 'clone_authorization':
61
- return yield walletAPI(apiCall);
62
- case 'deauthorize':
63
- return yield walletAPI(apiCall);
64
- case 'reauthorize':
65
- return yield walletAPI(apiCall);
57
+ const [method] = args;
58
+ switch (method) {
66
59
  case 'sign_and_send_transaction': {
67
- const payloads = yield Promise.all(apiCall.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
60
+ const params = args[1];
61
+ const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
68
62
  if (transaction.feePayer == null) {
69
- transaction.feePayer = apiCall.fee_payer;
63
+ transaction.feePayer = params.fee_payer;
70
64
  }
71
65
  if (transaction.recentBlockhash == null) {
72
- const { blockhash } = yield getLatestBlockhash(apiCall.connection);
66
+ const { blockhash } = yield getLatestBlockhash(params.connection);
73
67
  transaction.recentBlockhash = blockhash;
74
68
  }
75
69
  const serializedTransaction = transaction.serialize({
@@ -79,42 +73,41 @@ function transact(callback, config) {
79
73
  return serializedTransaction.toString('base64');
80
74
  })));
81
75
  let targetCommitment;
82
- switch (apiCall.connection.commitment) {
76
+ switch (params.connection.commitment) {
83
77
  case 'confirmed':
84
78
  case 'finalized':
85
79
  case 'processed':
86
- targetCommitment = apiCall.connection.commitment;
80
+ targetCommitment = params.connection.commitment;
87
81
  break;
88
82
  default:
89
83
  targetCommitment = 'finalized';
90
84
  }
91
- const { signatures } = yield walletAPI({
92
- method: 'sign_and_send_transaction',
93
- auth_token: apiCall.auth_token,
85
+ const { signatures } = yield walletAPI('sign_and_send_transaction', {
86
+ auth_token: params.auth_token,
94
87
  commitment: targetCommitment,
95
88
  payloads,
96
89
  });
97
90
  return signatures;
98
91
  }
99
92
  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,
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,
104
97
  payloads,
105
98
  });
106
99
  const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
107
100
  return signedMessages;
108
101
  }
109
102
  case 'sign_transaction': {
110
- const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
103
+ const params = args[1];
104
+ const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
111
105
  requireAllSignatures: false,
112
106
  verifySignatures: false,
113
107
  }));
114
108
  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,
109
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
110
+ auth_token: params.auth_token,
118
111
  payloads,
119
112
  });
120
113
  const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
@@ -122,8 +115,7 @@ function transact(callback, config) {
122
115
  return transactions;
123
116
  }
124
117
  default:
125
- // If this switch is exhausive, this should be unreachable.
126
- return ((_) => undefined)();
118
+ return yield walletAPI(...args);
127
119
  }
128
120
  }));
129
121
  return callback(augmentedAPI);
@@ -42,7 +42,7 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
42
42
  function transact(callback, config) {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  const augmentedCallback = (walletAPI) => {
45
- const augmentedAPI = ((apiCall) => __awaiter(this, void 0, void 0, function* () {
45
+ const augmentedAPI = ((...args) => __awaiter(this, void 0, void 0, function* () {
46
46
  let latestBlockhashPromise;
47
47
  function getLatestBlockhash(connection) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
@@ -54,22 +54,16 @@ function transact(callback, config) {
54
54
  return yield latestBlockhashPromise;
55
55
  });
56
56
  }
57
- switch (apiCall.method) {
58
- case 'authorize':
59
- return yield walletAPI(apiCall);
60
- case 'clone_authorization':
61
- return yield walletAPI(apiCall);
62
- case 'deauthorize':
63
- return yield walletAPI(apiCall);
64
- case 'reauthorize':
65
- return yield walletAPI(apiCall);
57
+ const [method] = args;
58
+ switch (method) {
66
59
  case 'sign_and_send_transaction': {
67
- const payloads = yield Promise.all(apiCall.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
60
+ const params = args[1];
61
+ const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
68
62
  if (transaction.feePayer == null) {
69
- transaction.feePayer = apiCall.fee_payer;
63
+ transaction.feePayer = params.fee_payer;
70
64
  }
71
65
  if (transaction.recentBlockhash == null) {
72
- const { blockhash } = yield getLatestBlockhash(apiCall.connection);
66
+ const { blockhash } = yield getLatestBlockhash(params.connection);
73
67
  transaction.recentBlockhash = blockhash;
74
68
  }
75
69
  const serializedTransaction = transaction.serialize({
@@ -79,42 +73,41 @@ function transact(callback, config) {
79
73
  return serializedTransaction.toString('base64');
80
74
  })));
81
75
  let targetCommitment;
82
- switch (apiCall.connection.commitment) {
76
+ switch (params.connection.commitment) {
83
77
  case 'confirmed':
84
78
  case 'finalized':
85
79
  case 'processed':
86
- targetCommitment = apiCall.connection.commitment;
80
+ targetCommitment = params.connection.commitment;
87
81
  break;
88
82
  default:
89
83
  targetCommitment = 'finalized';
90
84
  }
91
- const { signatures } = yield walletAPI({
92
- method: 'sign_and_send_transaction',
93
- auth_token: apiCall.auth_token,
85
+ const { signatures } = yield walletAPI('sign_and_send_transaction', {
86
+ auth_token: params.auth_token,
94
87
  commitment: targetCommitment,
95
88
  payloads,
96
89
  });
97
90
  return signatures;
98
91
  }
99
92
  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,
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,
104
97
  payloads,
105
98
  });
106
99
  const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
107
100
  return signedMessages;
108
101
  }
109
102
  case 'sign_transaction': {
110
- const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
103
+ const params = args[1];
104
+ const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
111
105
  requireAllSignatures: false,
112
106
  verifySignatures: false,
113
107
  }));
114
108
  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,
109
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
110
+ auth_token: params.auth_token,
118
111
  payloads,
119
112
  });
120
113
  const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
@@ -122,8 +115,7 @@ function transact(callback, config) {
122
115
  return transactions;
123
116
  }
124
117
  default:
125
- // If this switch is exhausive, this should be unreachable.
126
- return ((_) => undefined)();
118
+ return yield walletAPI(...args);
127
119
  }
128
120
  }));
129
121
  return callback(augmentedAPI);
@@ -38,7 +38,7 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
38
38
  function transact(callback, config) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  const augmentedCallback = (walletAPI) => {
41
- const augmentedAPI = ((apiCall) => __awaiter(this, void 0, void 0, function* () {
41
+ const augmentedAPI = ((...args) => __awaiter(this, void 0, void 0, function* () {
42
42
  let latestBlockhashPromise;
43
43
  function getLatestBlockhash(connection) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
@@ -50,22 +50,16 @@ function transact(callback, config) {
50
50
  return yield latestBlockhashPromise;
51
51
  });
52
52
  }
53
- switch (apiCall.method) {
54
- case 'authorize':
55
- return yield walletAPI(apiCall);
56
- case 'clone_authorization':
57
- return yield walletAPI(apiCall);
58
- case 'deauthorize':
59
- return yield walletAPI(apiCall);
60
- case 'reauthorize':
61
- return yield walletAPI(apiCall);
53
+ const [method] = args;
54
+ switch (method) {
62
55
  case 'sign_and_send_transaction': {
63
- const payloads = yield Promise.all(apiCall.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
56
+ const params = args[1];
57
+ const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
64
58
  if (transaction.feePayer == null) {
65
- transaction.feePayer = apiCall.fee_payer;
59
+ transaction.feePayer = params.fee_payer;
66
60
  }
67
61
  if (transaction.recentBlockhash == null) {
68
- const { blockhash } = yield getLatestBlockhash(apiCall.connection);
62
+ const { blockhash } = yield getLatestBlockhash(params.connection);
69
63
  transaction.recentBlockhash = blockhash;
70
64
  }
71
65
  const serializedTransaction = transaction.serialize({
@@ -75,42 +69,41 @@ function transact(callback, config) {
75
69
  return serializedTransaction.toString('base64');
76
70
  })));
77
71
  let targetCommitment;
78
- switch (apiCall.connection.commitment) {
72
+ switch (params.connection.commitment) {
79
73
  case 'confirmed':
80
74
  case 'finalized':
81
75
  case 'processed':
82
- targetCommitment = apiCall.connection.commitment;
76
+ targetCommitment = params.connection.commitment;
83
77
  break;
84
78
  default:
85
79
  targetCommitment = 'finalized';
86
80
  }
87
- const { signatures } = yield walletAPI({
88
- method: 'sign_and_send_transaction',
89
- auth_token: apiCall.auth_token,
81
+ const { signatures } = yield walletAPI('sign_and_send_transaction', {
82
+ auth_token: params.auth_token,
90
83
  commitment: targetCommitment,
91
84
  payloads,
92
85
  });
93
86
  return signatures;
94
87
  }
95
88
  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,
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,
100
93
  payloads,
101
94
  });
102
95
  const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
103
96
  return signedMessages;
104
97
  }
105
98
  case 'sign_transaction': {
106
- const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
99
+ const params = args[1];
100
+ const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
107
101
  requireAllSignatures: false,
108
102
  verifySignatures: false,
109
103
  }));
110
104
  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,
105
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
106
+ auth_token: params.auth_token,
114
107
  payloads,
115
108
  });
116
109
  const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
@@ -118,8 +111,7 @@ function transact(callback, config) {
118
111
  return transactions;
119
112
  }
120
113
  default:
121
- // If this switch is exhausive, this should be unreachable.
122
- return ((_) => undefined)();
114
+ return yield walletAPI(...args);
123
115
  }
124
116
  }));
125
117
  return callback(augmentedAPI);
package/lib/esm/index.mjs CHANGED
@@ -38,7 +38,7 @@ function getByteArrayFromBase64String(base64EncodedByteArray) {
38
38
  function transact(callback, config) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  const augmentedCallback = (walletAPI) => {
41
- const augmentedAPI = ((apiCall) => __awaiter(this, void 0, void 0, function* () {
41
+ const augmentedAPI = ((...args) => __awaiter(this, void 0, void 0, function* () {
42
42
  let latestBlockhashPromise;
43
43
  function getLatestBlockhash(connection) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
@@ -50,22 +50,16 @@ function transact(callback, config) {
50
50
  return yield latestBlockhashPromise;
51
51
  });
52
52
  }
53
- switch (apiCall.method) {
54
- case 'authorize':
55
- return yield walletAPI(apiCall);
56
- case 'clone_authorization':
57
- return yield walletAPI(apiCall);
58
- case 'deauthorize':
59
- return yield walletAPI(apiCall);
60
- case 'reauthorize':
61
- return yield walletAPI(apiCall);
53
+ const [method] = args;
54
+ switch (method) {
62
55
  case 'sign_and_send_transaction': {
63
- const payloads = yield Promise.all(apiCall.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
56
+ const params = args[1];
57
+ const payloads = yield Promise.all(params.transactions.map((transaction) => __awaiter(this, void 0, void 0, function* () {
64
58
  if (transaction.feePayer == null) {
65
- transaction.feePayer = apiCall.fee_payer;
59
+ transaction.feePayer = params.fee_payer;
66
60
  }
67
61
  if (transaction.recentBlockhash == null) {
68
- const { blockhash } = yield getLatestBlockhash(apiCall.connection);
62
+ const { blockhash } = yield getLatestBlockhash(params.connection);
69
63
  transaction.recentBlockhash = blockhash;
70
64
  }
71
65
  const serializedTransaction = transaction.serialize({
@@ -75,42 +69,41 @@ function transact(callback, config) {
75
69
  return serializedTransaction.toString('base64');
76
70
  })));
77
71
  let targetCommitment;
78
- switch (apiCall.connection.commitment) {
72
+ switch (params.connection.commitment) {
79
73
  case 'confirmed':
80
74
  case 'finalized':
81
75
  case 'processed':
82
- targetCommitment = apiCall.connection.commitment;
76
+ targetCommitment = params.connection.commitment;
83
77
  break;
84
78
  default:
85
79
  targetCommitment = 'finalized';
86
80
  }
87
- const { signatures } = yield walletAPI({
88
- method: 'sign_and_send_transaction',
89
- auth_token: apiCall.auth_token,
81
+ const { signatures } = yield walletAPI('sign_and_send_transaction', {
82
+ auth_token: params.auth_token,
90
83
  commitment: targetCommitment,
91
84
  payloads,
92
85
  });
93
86
  return signatures;
94
87
  }
95
88
  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,
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,
100
93
  payloads,
101
94
  });
102
95
  const signedMessages = base64EncodedSignedMessages.map(getByteArrayFromBase64String);
103
96
  return signedMessages;
104
97
  }
105
98
  case 'sign_transaction': {
106
- const serializedTransactions = apiCall.transactions.map((transaction) => transaction.serialize({
99
+ const params = args[1];
100
+ const serializedTransactions = params.transactions.map((transaction) => transaction.serialize({
107
101
  requireAllSignatures: false,
108
102
  verifySignatures: false,
109
103
  }));
110
104
  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,
105
+ const { signed_payloads: base64EncodedCompiledTransactions } = yield walletAPI('sign_transaction', {
106
+ auth_token: params.auth_token,
114
107
  payloads,
115
108
  });
116
109
  const compiledTransactions = base64EncodedCompiledTransactions.map(getByteArrayFromBase64String);
@@ -118,8 +111,7 @@ function transact(callback, config) {
118
111
  return transactions;
119
112
  }
120
113
  default:
121
- // If this switch is exhausive, this should be unreachable.
122
- return ((_) => undefined)();
114
+ return yield walletAPI(...args);
123
115
  }
124
116
  }));
125
117
  return callback(augmentedAPI);
@@ -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 Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI {
4
- (apiCall: {
5
- method: "sign_and_send_transaction";
3
+ interface Web3SignAndSendTransactionAPI {
4
+ (method: "sign_and_send_transaction", params: {
6
5
  auth_token: AuthToken;
7
6
  connection: Connection;
8
7
  fee_payer?: PublicKey;
9
8
  transactions: Transaction[];
10
9
  }): Promise<TransactionSignature[]>;
11
- (apiCall: {
12
- method: "sign_transaction";
10
+ }
11
+ interface Web3SignTransactionAPI {
12
+ (method: "sign_transaction", params: {
13
13
  auth_token: AuthToken;
14
14
  transactions: Transaction[];
15
15
  }): Promise<Transaction[]>;
16
- (apiCall: {
17
- method: "sign_message";
16
+ }
17
+ interface Web3SignMessageAPI {
18
+ (method: "sign_message", params: {
18
19
  auth_token: AuthToken;
19
- byteArrays: Uint8Array[];
20
+ payloads: Uint8Array[];
20
21
  }): Promise<Uint8Array[]>;
21
22
  }
23
+ interface Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
24
+ }
22
25
  declare function transact<TReturn>(callback: (walletAPI: Web3MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
23
26
  export { Web3MobileWalletAPI, 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 Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI {
4
- (apiCall: {
5
- method: "sign_and_send_transaction";
3
+ interface Web3SignAndSendTransactionAPI {
4
+ (method: "sign_and_send_transaction", params: {
6
5
  auth_token: AuthToken;
7
6
  connection: Connection;
8
7
  fee_payer?: PublicKey;
9
8
  transactions: Transaction[];
10
9
  }): Promise<TransactionSignature[]>;
11
- (apiCall: {
12
- method: "sign_transaction";
10
+ }
11
+ interface Web3SignTransactionAPI {
12
+ (method: "sign_transaction", params: {
13
13
  auth_token: AuthToken;
14
14
  transactions: Transaction[];
15
15
  }): Promise<Transaction[]>;
16
- (apiCall: {
17
- method: "sign_message";
16
+ }
17
+ interface Web3SignMessageAPI {
18
+ (method: "sign_message", params: {
18
19
  auth_token: AuthToken;
19
- byteArrays: Uint8Array[];
20
+ payloads: Uint8Array[];
20
21
  }): Promise<Uint8Array[]>;
21
22
  }
23
+ interface Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
24
+ }
22
25
  declare function transact<TReturn>(callback: (walletAPI: Web3MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
23
26
  export { Web3MobileWalletAPI, transact };
24
27
  //# sourceMappingURL=index.browser.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 Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI {
4
- (apiCall: {
5
- method: "sign_and_send_transaction";
3
+ interface Web3SignAndSendTransactionAPI {
4
+ (method: "sign_and_send_transaction", params: {
6
5
  auth_token: AuthToken;
7
6
  connection: Connection;
8
7
  fee_payer?: PublicKey;
9
8
  transactions: Transaction[];
10
9
  }): Promise<TransactionSignature[]>;
11
- (apiCall: {
12
- method: "sign_transaction";
10
+ }
11
+ interface Web3SignTransactionAPI {
12
+ (method: "sign_transaction", params: {
13
13
  auth_token: AuthToken;
14
14
  transactions: Transaction[];
15
15
  }): Promise<Transaction[]>;
16
- (apiCall: {
17
- method: "sign_message";
16
+ }
17
+ interface Web3SignMessageAPI {
18
+ (method: "sign_message", params: {
18
19
  auth_token: AuthToken;
19
- byteArrays: Uint8Array[];
20
+ payloads: Uint8Array[];
20
21
  }): Promise<Uint8Array[]>;
21
22
  }
23
+ interface Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
24
+ }
22
25
  declare function transact<TReturn>(callback: (walletAPI: Web3MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
23
26
  export { Web3MobileWalletAPI, transact };
24
27
  //# sourceMappingURL=index.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 Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI {
4
- (apiCall: {
5
- method: "sign_and_send_transaction";
3
+ interface Web3SignAndSendTransactionAPI {
4
+ (method: "sign_and_send_transaction", params: {
6
5
  auth_token: AuthToken;
7
6
  connection: Connection;
8
7
  fee_payer?: PublicKey;
9
8
  transactions: Transaction[];
10
9
  }): Promise<TransactionSignature[]>;
11
- (apiCall: {
12
- method: "sign_transaction";
10
+ }
11
+ interface Web3SignTransactionAPI {
12
+ (method: "sign_transaction", params: {
13
13
  auth_token: AuthToken;
14
14
  transactions: Transaction[];
15
15
  }): Promise<Transaction[]>;
16
- (apiCall: {
17
- method: "sign_message";
16
+ }
17
+ interface Web3SignMessageAPI {
18
+ (method: "sign_message", params: {
18
19
  auth_token: AuthToken;
19
- byteArrays: Uint8Array[];
20
+ payloads: Uint8Array[];
20
21
  }): Promise<Uint8Array[]>;
21
22
  }
23
+ interface Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
24
+ }
22
25
  declare function transact<TReturn>(callback: (walletAPI: Web3MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
23
26
  export { Web3MobileWalletAPI, 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 Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI {
4
- (apiCall: {
5
- method: "sign_and_send_transaction";
3
+ interface Web3SignAndSendTransactionAPI {
4
+ (method: "sign_and_send_transaction", params: {
6
5
  auth_token: AuthToken;
7
6
  connection: Connection;
8
7
  fee_payer?: PublicKey;
9
8
  transactions: Transaction[];
10
9
  }): Promise<TransactionSignature[]>;
11
- (apiCall: {
12
- method: "sign_transaction";
10
+ }
11
+ interface Web3SignTransactionAPI {
12
+ (method: "sign_transaction", params: {
13
13
  auth_token: AuthToken;
14
14
  transactions: Transaction[];
15
15
  }): Promise<Transaction[]>;
16
- (apiCall: {
17
- method: "sign_message";
16
+ }
17
+ interface Web3SignMessageAPI {
18
+ (method: "sign_message", params: {
18
19
  auth_token: AuthToken;
19
- byteArrays: Uint8Array[];
20
+ payloads: Uint8Array[];
20
21
  }): Promise<Uint8Array[]>;
21
22
  }
23
+ interface Web3MobileWalletAPI extends AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, ReauthorizeAPI, Web3SignAndSendTransactionAPI, Web3SignTransactionAPI, Web3SignMessageAPI {
24
+ }
22
25
  declare function transact<TReturn>(callback: (walletAPI: Web3MobileWalletAPI) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
23
26
  export { Web3MobileWalletAPI, 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",
4
+ "version": "0.0.1-alpha.5",
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.4"
43
+ "@solana-mobile/mobile-wallet-adapter-protocol": "^0.0.1-alpha.5"
44
44
  },
45
45
  "devDependencies": {
46
46
  "agadoo": "^2.0.0"
47
47
  },
48
- "gitHead": "d8a5244c5535b02f3dcf8144554a474ddac43f32"
48
+ "gitHead": "7df380859bd4a3e6acc4f4b7385e9604919c76a8"
49
49
  }