Skip to content

Commit

Permalink
fix: wallet auth status event
Browse files Browse the repository at this point in the history
  • Loading branch information
irshadjsr21 committed Aug 7, 2024
1 parent 9ce87b0 commit 34202a6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 46 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ jobs:

steps:
- name: checkout code repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: next-8
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ jobs:

steps:
- name: Checkout Commit
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Install pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: next-8
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@cypherock/prettier-config": "workspace:*",
"husky": "^8.0.0",
"prettier": "^3.2.4",
"turbo": "latest"
"turbo": "^1.13.4"
},
"engines": {
"node": ">=18.0.0"
Expand Down
22 changes: 12 additions & 10 deletions packages/app-inheritance/src/operations/authWallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
OperationHelper,
logger as rootLogger,
} from '../../utils';
import { IAuthWalletParams, WALLET_ID_LENGTH } from './types';
import { IAuthWalletParams, WALLET_ID_LENGTH, WalletAuthEvent } from './types';
import { WalletAuthStatus } from '../../proto/generated/inheritance/wallet_auth';

export * from './types';
Expand All @@ -33,29 +33,31 @@ export const authWallet = async (

await sdk.checkAppCompatibility(APP_VERSION);

logger.info('Started', { ...params, onEvent: undefined });
const { forceStatusUpdate, onStatus } = createStatusListener({
enums: WalletAuthEvent,
operationEnums: WalletAuthStatus,
onEvent: params.onEvent,
logger,
});

const helper = new OperationHelper({
sdk,
queryKey: 'walletAuth',
resultKey: 'walletAuth',
});

logger.info('Started', { ...params, onEvent: undefined });
const { forceStatusUpdate } = createStatusListener({
enums: WalletAuthStatus,
onEvent: params.onEvent,
logger,
onStatus,
});

await helper.sendQuery({
initiate: params,
});

const result = await helper.waitForResult();
logger.verbose('walletAuthResponse', result);
logger.verbose('WalletAuthResponse', result);

assertOrThrowInvalidResult(result.result);

forceStatusUpdate(WalletAuthStatus.WALLET_AUTH_STATUS_CARD_TAPPED);
forceStatusUpdate(WalletAuthEvent.CARD_TAP);

logger.info('Completed');
return result.result;
Expand Down
7 changes: 5 additions & 2 deletions packages/app-inheritance/src/operations/authWallet/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { WalletAuthStatus } from '../../proto/generated/types';
export enum WalletAuthEvent {
INIT = 0,
CARD_TAP = 1,
}

export type AuthWalletEventHandler = (event: WalletAuthStatus) => void;
export type AuthWalletEventHandler = (event: WalletAuthEvent) => void;
export const WALLET_ID_LENGTH = 32;

export interface IAuthWalletParams {
Expand Down
46 changes: 23 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 34202a6

Please sign in to comment.