Skip to content

Commit

Permalink
add: sendOrdinal, signPsbt, psbt confirm keystone transport
Browse files Browse the repository at this point in the history
  • Loading branch information
keystoneGithub committed Nov 4, 2024
1 parent 22a350d commit 296ff8c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/app/screens/sendOrdinal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import { useResetUserFlow } from '@hooks/useResetUserFlow';
import useSelectedAccount from '@hooks/useSelectedAccount';
import useTransactionContext from '@hooks/useTransactionContext';
import useWalletSelector from '@hooks/useWalletSelector';
import { TransportWebUSB } from '@keystonehq/hw-transport-webusb';
import type { TransactionSummary } from '@screens/sendBtc/helpers';
import { AnalyticsEvents, btcTransaction, type Transport } from '@secretkeylabs/xverse-core';
import {
AnalyticsEvents,
btcTransaction,
type AccountType,
type Transport,
} from '@secretkeylabs/xverse-core';
import { removeAccountAvatarAction } from '@stores/wallet/actions/actionCreators';
import { isInOptions, isLedgerAccount } from '@utils/helper';
import { trackMixPanel } from '@utils/mixpanel';
Expand Down Expand Up @@ -150,10 +156,18 @@ function SendOrdinalScreen() {
return undefined;
};

const handleSubmit = async (ledgerTransport?: Transport) => {
const handleSubmit = async (type?: AccountType, transport?: Transport | TransportWebUSB) => {
try {
setIsSubmitting(true);
const txnId = await transaction?.broadcast({ ledgerTransport, rbfEnabled: true });
const txnId = await transaction?.broadcast({
...(type === 'ledger' && {
ledgerTransport: transport as Transport,
}),
...(type === 'keystone' && {
keystoneTransport: transport as TransportWebUSB,
}),
rbfEnabled: true,
});

trackMixPanel(AnalyticsEvents.TransactionConfirmed, {
protocol: 'ordinals',
Expand Down
3 changes: 3 additions & 0 deletions src/app/screens/signPsbtRequest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ function SignPsbtRequest() {
...(accountType === 'ledger' && {
ledgerTransport: transport as Transport,
}),
...(accountType === 'keystone' && {
keystoneTransport: transport as TransportWebUSB,
}),
});
const response = await confirmSignPsbt(signedPsbt);
trackMixPanel(AnalyticsEvents.TransactionConfirmed, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ export default function PsbtConfirmation({
...(accountType === 'ledger' && {
ledgerTransport: transport as Transport,
}),
...(accountType === 'keystone' && {
keystoneTransport: transport as TransportWebUSB,
}),
});

if (!signedPsbt) {
Expand Down

0 comments on commit 296ff8c

Please sign in to comment.