@solana-mobile/mobile-wallet-adapter-protocol 2.1.6 → 2.1.8
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/.DS_Store +0 -0
- package/lib/cjs/index.browser.js +26 -0
- package/lib/cjs/index.js +26 -0
- package/lib/esm/index.browser.js +26 -1
- package/lib/esm/index.js +26 -1
- package/lib/types/index.browser.d.ts +5 -1
- package/lib/types/index.d.ts +5 -1
- package/lib/types/index.native.d.ts +5 -1
- package/package.json +1 -1
- package/src/transact.ts +23 -0
package/.DS_Store
CHANGED
|
Binary file
|
package/lib/cjs/index.browser.js
CHANGED
|
@@ -827,6 +827,31 @@ function transact(callback, config) {
|
|
|
827
827
|
});
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
|
+
function transactRemote(callback, config) {
|
|
831
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
832
|
+
return startRemoteScenario(config).then((scenario) => {
|
|
833
|
+
return {
|
|
834
|
+
associationUrl: scenario.associationUrl,
|
|
835
|
+
result: scenario.wallet.then((wallet) => {
|
|
836
|
+
return callback(new Proxy(wallet, {
|
|
837
|
+
get(target, p) {
|
|
838
|
+
if (p == 'terminateSession') {
|
|
839
|
+
return function () {
|
|
840
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
841
|
+
scenario.close();
|
|
842
|
+
return;
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
else
|
|
847
|
+
return target[p];
|
|
848
|
+
},
|
|
849
|
+
}));
|
|
850
|
+
}),
|
|
851
|
+
};
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
}
|
|
830
855
|
function startRemoteScenario(config) {
|
|
831
856
|
return __awaiter(this, void 0, void 0, function* () {
|
|
832
857
|
assertSecureContext();
|
|
@@ -1073,3 +1098,4 @@ exports.SolanaSignInWithSolana = SolanaSignInWithSolana;
|
|
|
1073
1098
|
exports.SolanaSignTransactions = SolanaSignTransactions;
|
|
1074
1099
|
exports.startRemoteScenario = startRemoteScenario;
|
|
1075
1100
|
exports.transact = transact;
|
|
1101
|
+
exports.transactRemote = transactRemote;
|
package/lib/cjs/index.js
CHANGED
|
@@ -827,6 +827,31 @@ function transact(callback, config) {
|
|
|
827
827
|
});
|
|
828
828
|
});
|
|
829
829
|
}
|
|
830
|
+
function transactRemote(callback, config) {
|
|
831
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
832
|
+
return startRemoteScenario(config).then((scenario) => {
|
|
833
|
+
return {
|
|
834
|
+
associationUrl: scenario.associationUrl,
|
|
835
|
+
result: scenario.wallet.then((wallet) => {
|
|
836
|
+
return callback(new Proxy(wallet, {
|
|
837
|
+
get(target, p) {
|
|
838
|
+
if (p == 'terminateSession') {
|
|
839
|
+
return function () {
|
|
840
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
841
|
+
scenario.close();
|
|
842
|
+
return;
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
else
|
|
847
|
+
return target[p];
|
|
848
|
+
},
|
|
849
|
+
}));
|
|
850
|
+
}),
|
|
851
|
+
};
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
}
|
|
830
855
|
function startRemoteScenario(config) {
|
|
831
856
|
return __awaiter(this, void 0, void 0, function* () {
|
|
832
857
|
assertSecureContext();
|
|
@@ -1073,3 +1098,4 @@ exports.SolanaSignInWithSolana = SolanaSignInWithSolana;
|
|
|
1073
1098
|
exports.SolanaSignTransactions = SolanaSignTransactions;
|
|
1074
1099
|
exports.startRemoteScenario = startRemoteScenario;
|
|
1075
1100
|
exports.transact = transact;
|
|
1101
|
+
exports.transactRemote = transactRemote;
|
package/lib/esm/index.browser.js
CHANGED
|
@@ -823,6 +823,31 @@ function transact(callback, config) {
|
|
|
823
823
|
});
|
|
824
824
|
});
|
|
825
825
|
}
|
|
826
|
+
function transactRemote(callback, config) {
|
|
827
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
828
|
+
return startRemoteScenario(config).then((scenario) => {
|
|
829
|
+
return {
|
|
830
|
+
associationUrl: scenario.associationUrl,
|
|
831
|
+
result: scenario.wallet.then((wallet) => {
|
|
832
|
+
return callback(new Proxy(wallet, {
|
|
833
|
+
get(target, p) {
|
|
834
|
+
if (p == 'terminateSession') {
|
|
835
|
+
return function () {
|
|
836
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
837
|
+
scenario.close();
|
|
838
|
+
return;
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
else
|
|
843
|
+
return target[p];
|
|
844
|
+
},
|
|
845
|
+
}));
|
|
846
|
+
}),
|
|
847
|
+
};
|
|
848
|
+
});
|
|
849
|
+
});
|
|
850
|
+
}
|
|
826
851
|
function startRemoteScenario(config) {
|
|
827
852
|
return __awaiter(this, void 0, void 0, function* () {
|
|
828
853
|
assertSecureContext();
|
|
@@ -1060,4 +1085,4 @@ function startRemoteScenario(config) {
|
|
|
1060
1085
|
});
|
|
1061
1086
|
}
|
|
1062
1087
|
|
|
1063
|
-
export { SolanaCloneAuthorization, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaSignInWithSolana, SolanaSignTransactions, startRemoteScenario, transact };
|
|
1088
|
+
export { SolanaCloneAuthorization, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaSignInWithSolana, SolanaSignTransactions, startRemoteScenario, transact, transactRemote };
|
package/lib/esm/index.js
CHANGED
|
@@ -823,6 +823,31 @@ function transact(callback, config) {
|
|
|
823
823
|
});
|
|
824
824
|
});
|
|
825
825
|
}
|
|
826
|
+
function transactRemote(callback, config) {
|
|
827
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
828
|
+
return startRemoteScenario(config).then((scenario) => {
|
|
829
|
+
return {
|
|
830
|
+
associationUrl: scenario.associationUrl,
|
|
831
|
+
result: scenario.wallet.then((wallet) => {
|
|
832
|
+
return callback(new Proxy(wallet, {
|
|
833
|
+
get(target, p) {
|
|
834
|
+
if (p == 'terminateSession') {
|
|
835
|
+
return function () {
|
|
836
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
837
|
+
scenario.close();
|
|
838
|
+
return;
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
else
|
|
843
|
+
return target[p];
|
|
844
|
+
},
|
|
845
|
+
}));
|
|
846
|
+
}),
|
|
847
|
+
};
|
|
848
|
+
});
|
|
849
|
+
});
|
|
850
|
+
}
|
|
826
851
|
function startRemoteScenario(config) {
|
|
827
852
|
return __awaiter(this, void 0, void 0, function* () {
|
|
828
853
|
assertSecureContext();
|
|
@@ -1060,4 +1085,4 @@ function startRemoteScenario(config) {
|
|
|
1060
1085
|
});
|
|
1061
1086
|
}
|
|
1062
1087
|
|
|
1063
|
-
export { SolanaCloneAuthorization, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaSignInWithSolana, SolanaSignTransactions, startRemoteScenario, transact };
|
|
1088
|
+
export { SolanaCloneAuthorization, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterProtocolError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaSignInWithSolana, SolanaSignTransactions, startRemoteScenario, transact, transactRemote };
|
|
@@ -258,6 +258,10 @@ type RemoteScenario = Scenario & Readonly<{
|
|
|
258
258
|
associationUrl: URL;
|
|
259
259
|
}>;
|
|
260
260
|
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
261
|
+
declare function transactRemote<TReturn>(callback: (wallet: RemoteMobileWallet) => TReturn, config: RemoteWalletAssociationConfig): Promise<{
|
|
262
|
+
associationUrl: URL;
|
|
263
|
+
result: Promise<TReturn>;
|
|
264
|
+
}>;
|
|
261
265
|
declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<RemoteScenario>;
|
|
262
|
-
export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
|
|
266
|
+
export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, transactRemote, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
|
|
263
267
|
//# sourceMappingURL=index.browser.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -258,6 +258,10 @@ type RemoteScenario = Scenario & Readonly<{
|
|
|
258
258
|
associationUrl: URL;
|
|
259
259
|
}>;
|
|
260
260
|
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
261
|
+
declare function transactRemote<TReturn>(callback: (wallet: RemoteMobileWallet) => TReturn, config: RemoteWalletAssociationConfig): Promise<{
|
|
262
|
+
associationUrl: URL;
|
|
263
|
+
result: Promise<TReturn>;
|
|
264
|
+
}>;
|
|
261
265
|
declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<RemoteScenario>;
|
|
262
|
-
export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
|
|
266
|
+
export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, transactRemote, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
|
|
263
267
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -258,6 +258,10 @@ type RemoteScenario = Scenario & Readonly<{
|
|
|
258
258
|
associationUrl: URL;
|
|
259
259
|
}>;
|
|
260
260
|
declare function transact<TReturn>(callback: (wallet: MobileWallet) => TReturn, config?: WalletAssociationConfig): Promise<TReturn>;
|
|
261
|
+
declare function transactRemote<TReturn>(callback: (wallet: RemoteMobileWallet) => TReturn, config: RemoteWalletAssociationConfig): Promise<{
|
|
262
|
+
associationUrl: URL;
|
|
263
|
+
result: Promise<TReturn>;
|
|
264
|
+
}>;
|
|
261
265
|
declare function startRemoteScenario(config: RemoteWalletAssociationConfig): Promise<RemoteScenario>;
|
|
262
|
-
export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
|
|
266
|
+
export { SolanaMobileWalletAdapterErrorCode, SolanaMobileWalletAdapterError, SolanaMobileWalletAdapterProtocolErrorCode, SolanaMobileWalletAdapterProtocolError, transact, transactRemote, startRemoteScenario, Account, AppIdentity, AssociationKeypair, ProtocolVersion, SessionProperties, AuthorizationResult, AuthToken, Base64EncodedAddress, Base64EncodedTransaction, Cluster, Chain, Finality, WalletAssociationConfig, RemoteWalletAssociationConfig, AuthorizeAPI, CloneAuthorizationAPI, DeauthorizeAPI, GetCapabilitiesAPI, ReauthorizeAPI, SignMessagesAPI, SignTransactionsAPI, SignAndSendTransactionsAPI, MobileWallet, TerminateSessionAPI, RemoteMobileWallet, SolanaSignTransactions, SolanaCloneAuthorization, SolanaSignInWithSolana, SignInPayload, SignInPayloadWithRequiredFields, SignInResult, Scenario, RemoteScenario };
|
|
263
267
|
//# 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",
|
|
3
3
|
"description": "An implementation of the Solana Mobile Mobile Wallet Adapter protocol. Use this to open a session with a mobile wallet app, and to issue API calls to it.",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.8",
|
|
5
5
|
"author": "Steven Luscher <steven.luscher@solanamobile.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
package/src/transact.ts
CHANGED
|
@@ -330,6 +330,29 @@ export async function transact<TReturn>(
|
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
export async function transactRemote<TReturn>(
|
|
334
|
+
callback: (wallet: RemoteMobileWallet) => TReturn,
|
|
335
|
+
config: RemoteWalletAssociationConfig,
|
|
336
|
+
): Promise<{associationUrl: URL, result: Promise<TReturn>}> {
|
|
337
|
+
return startRemoteScenario(config).then((scenario) => {
|
|
338
|
+
return {
|
|
339
|
+
associationUrl: scenario.associationUrl,
|
|
340
|
+
result: scenario.wallet.then((wallet) =>{
|
|
341
|
+
return callback(new Proxy(wallet as RemoteMobileWallet, {
|
|
342
|
+
get<TMethodName extends keyof RemoteMobileWallet>(target: RemoteMobileWallet, p: TMethodName) {
|
|
343
|
+
if (p == 'terminateSession') {
|
|
344
|
+
return async function () {
|
|
345
|
+
scenario.close();
|
|
346
|
+
return;
|
|
347
|
+
};
|
|
348
|
+
} else return target[p];
|
|
349
|
+
},
|
|
350
|
+
}));
|
|
351
|
+
}),
|
|
352
|
+
};
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
333
356
|
export async function startRemoteScenario(
|
|
334
357
|
config: RemoteWalletAssociationConfig,
|
|
335
358
|
): Promise<RemoteScenario> {
|