Skip to content

Commit

Permalink
fixup! Add wallet adapter for NuFi
Browse files Browse the repository at this point in the history
  • Loading branch information
gyorgy-kurucz-vacuum committed Jun 28, 2022
1 parent e635f13 commit 0202a2f
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions packages/wallets/nufi/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,74 +21,17 @@ interface NufiEvents {
disconnect(): void;
}

/** The type of the connector object injected by the NuFi extension.
*
* Note that the interface uses some objects from `@solana/web3.js`. It is
* guaranteed that NuFi uses at least version `1.42.0` of this library.
*/
interface NufiWallet {
/** This always has the value `true`. */
isNufi: boolean;

/** This is `undefined` if any only if {@link isConnected} is `false`. */
publicKey: undefined | { toBytes(): Uint8Array };

/** This signals whether the wallet is connected. A change in this value is
* always immediately followed by the {@link NufiEvents.connect} or the
* {@link NufiEvents.disconnect} event being emitted. */
isConnected: boolean;

/** Subscribe to an event. */
on: <T extends keyof NufiEvents>(event: T, fn: NufiEvents[T]) => void;

/** Unsubscribe from an event. */
off: <T extends keyof NufiEvents>(event: T, fn: NufiEvents[T]) => void;

/** Request the signing of a transaction. This might take a long time, as
* the user may be asked for their approval. If the promise is resolved, a
* new signed `Transaction` object is returned. If the promise is rejected,
* it can either mean that the user rejected the transaction, or any other
* error. It is unspecified what is returned on rejection.
* */
signTransaction(transaction: Transaction): Promise<Transaction>;

/**
* The behavior is identical to that of {@link signTransaction}, except
* that multiple transactions are requested to be signed. The promise is
* only resolved if all transactions have been signed.
*/
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;

/**
* The behavior is identical to that of {@link signTransaction}, except
* that if the transaction is succesfully signed, it is also submitted, and
* only its signature is returned.
*/
signAndSendTransaction(transaction: Transaction): Promise<{ signature: TransactionSignature }>;

/**
* Request the signing of a message. This might take a long time, as the user
* may be asked for their approval. If the promise is resolved, the signature
* is returned. If the promise is rejected, it can either mean that the user
* rejected the signing the message, or any other error. It is unspecified
* what is returned on rejection.
*/
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;

/**
* Request connecting to the wallet. This might take a long time, as the
* user may be asked for their consent. Before the promise resolves, the
* {@link NufiEvents.connect} event will be emitted. If the promise is
* rejected, it can either mean that the user rejected the connection, or
* any other error. It is unspecified what is returned on rejection.
*/
connect(): Promise<void>;

/**
* Request disconnecting from the wallet. Before the promise resolves, the
* {@link NufiEvents.disconnect} event will be emitted. The promise is
* guaranteed to always resolve.
*/
disconnect(): Promise<void>;
}

Expand Down

0 comments on commit 0202a2f

Please sign in to comment.