@dubsdotapp/expo 0.2.9 → 0.2.10
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/dist/index.d.mts +0 -12
- package/dist/index.d.ts +0 -12
- package/dist/index.js +2 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useAuth.ts +2 -13
- package/src/wallet/mwa-adapter.ts +0 -31
- package/src/wallet/types.ts +0 -6
package/dist/index.d.mts
CHANGED
|
@@ -438,12 +438,6 @@ interface WalletAdapter {
|
|
|
438
438
|
connect?(): Promise<void>;
|
|
439
439
|
/** Optional: Disconnect the wallet */
|
|
440
440
|
disconnect?(): void | Promise<void>;
|
|
441
|
-
/**
|
|
442
|
-
* Optional: Connect and sign a message in one step.
|
|
443
|
-
* For MWA wallets, this runs authorize + signMessage in a single transact() session
|
|
444
|
-
* (avoids the double-open problem with Phantom on regular Android).
|
|
445
|
-
*/
|
|
446
|
-
connectAndSignMessage?(message: Uint8Array): Promise<Uint8Array>;
|
|
447
441
|
}
|
|
448
442
|
|
|
449
443
|
interface RegistrationScreenProps {
|
|
@@ -568,12 +562,6 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
568
562
|
disconnect(): void;
|
|
569
563
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
570
564
|
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
571
|
-
/**
|
|
572
|
-
* Connect (authorize) and sign a message in a single MWA transact() session.
|
|
573
|
-
* This avoids the double-open problem with Phantom on regular Android where
|
|
574
|
-
* two rapid transact() calls cause the second one to be auto-declined.
|
|
575
|
-
*/
|
|
576
|
-
connectAndSignMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
577
565
|
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
578
566
|
}
|
|
579
567
|
|
package/dist/index.d.ts
CHANGED
|
@@ -438,12 +438,6 @@ interface WalletAdapter {
|
|
|
438
438
|
connect?(): Promise<void>;
|
|
439
439
|
/** Optional: Disconnect the wallet */
|
|
440
440
|
disconnect?(): void | Promise<void>;
|
|
441
|
-
/**
|
|
442
|
-
* Optional: Connect and sign a message in one step.
|
|
443
|
-
* For MWA wallets, this runs authorize + signMessage in a single transact() session
|
|
444
|
-
* (avoids the double-open problem with Phantom on regular Android).
|
|
445
|
-
*/
|
|
446
|
-
connectAndSignMessage?(message: Uint8Array): Promise<Uint8Array>;
|
|
447
441
|
}
|
|
448
442
|
|
|
449
443
|
interface RegistrationScreenProps {
|
|
@@ -568,12 +562,6 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
568
562
|
disconnect(): void;
|
|
569
563
|
signTransaction(transaction: Transaction): Promise<Transaction>;
|
|
570
564
|
signMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
571
|
-
/**
|
|
572
|
-
* Connect (authorize) and sign a message in a single MWA transact() session.
|
|
573
|
-
* This avoids the double-open problem with Phantom on regular Android where
|
|
574
|
-
* two rapid transact() calls cause the second one to be auto-declined.
|
|
575
|
-
*/
|
|
576
|
-
connectAndSignMessage(message: Uint8Array): Promise<Uint8Array>;
|
|
577
565
|
signAndSendTransaction(transaction: Transaction): Promise<string>;
|
|
578
566
|
}
|
|
579
567
|
|
package/dist/index.js
CHANGED
|
@@ -637,29 +637,6 @@ var MwaWalletAdapter = class {
|
|
|
637
637
|
});
|
|
638
638
|
return sig instanceof Uint8Array ? sig : new Uint8Array(sig);
|
|
639
639
|
}
|
|
640
|
-
/**
|
|
641
|
-
* Connect (authorize) and sign a message in a single MWA transact() session.
|
|
642
|
-
* This avoids the double-open problem with Phantom on regular Android where
|
|
643
|
-
* two rapid transact() calls cause the second one to be auto-declined.
|
|
644
|
-
*/
|
|
645
|
-
async connectAndSignMessage(message) {
|
|
646
|
-
const sig = await this.transact(async (wallet) => {
|
|
647
|
-
const authResult = this._authToken ? await wallet.reauthorize({ auth_token: this._authToken }) : await wallet.authorize({
|
|
648
|
-
identity: this.config.appIdentity,
|
|
649
|
-
cluster: this.config.cluster || "mainnet-beta"
|
|
650
|
-
});
|
|
651
|
-
this._publicKey = toPublicKey(authResult.accounts[0].address);
|
|
652
|
-
this._authToken = authResult.auth_token;
|
|
653
|
-
this._connected = true;
|
|
654
|
-
this.config.onAuthTokenChange?.(this._authToken);
|
|
655
|
-
const result = await wallet.signMessages({
|
|
656
|
-
addresses: [this._publicKey.toBytes()],
|
|
657
|
-
payloads: [message]
|
|
658
|
-
});
|
|
659
|
-
return result[0];
|
|
660
|
-
});
|
|
661
|
-
return sig instanceof Uint8Array ? sig : new Uint8Array(sig);
|
|
662
|
-
}
|
|
663
640
|
async signAndSendTransaction(transaction) {
|
|
664
641
|
if (!this._connected) throw new Error("Wallet not connected");
|
|
665
642
|
const signature = await this.transact(async (wallet) => {
|
|
@@ -1350,7 +1327,7 @@ function useAuth() {
|
|
|
1350
1327
|
if (!wallet.publicKey) {
|
|
1351
1328
|
throw new Error("Wallet not connected");
|
|
1352
1329
|
}
|
|
1353
|
-
if (!wallet.signMessage
|
|
1330
|
+
if (!wallet.signMessage) {
|
|
1354
1331
|
throw new Error("Wallet does not support signMessage");
|
|
1355
1332
|
}
|
|
1356
1333
|
setStatus("authenticating");
|
|
@@ -1359,14 +1336,7 @@ function useAuth() {
|
|
|
1359
1336
|
const { nonce, message } = await client.getNonce(walletAddress);
|
|
1360
1337
|
setStatus("signing");
|
|
1361
1338
|
const messageBytes = new TextEncoder().encode(message);
|
|
1362
|
-
|
|
1363
|
-
if (wallet.connectAndSignMessage) {
|
|
1364
|
-
signatureBytes = await wallet.connectAndSignMessage(messageBytes);
|
|
1365
|
-
} else if (wallet.signMessage) {
|
|
1366
|
-
signatureBytes = await wallet.signMessage(messageBytes);
|
|
1367
|
-
} else {
|
|
1368
|
-
throw new Error("Wallet does not support signMessage");
|
|
1369
|
-
}
|
|
1339
|
+
const signatureBytes = await wallet.signMessage(messageBytes);
|
|
1370
1340
|
const signature = import_bs58.default.encode(signatureBytes);
|
|
1371
1341
|
setStatus("verifying");
|
|
1372
1342
|
const result = await client.authenticate({ walletAddress, signature, nonce });
|