OMSWallet
OMSWallet
export declare class OMSWallet {
readonly wallet: OMSWalletClient;
readonly indexer: OMSIndexerClient;
constructor(_config: OMSWalletParams);
}
OMSWalletParams
export type OMSWalletParams = {
publishableKey: string;
};
Authentication and sessions
OMSWalletClient.getWalletAddress
getWalletAddress(): Promise<string | undefined>;
OMSWalletClient.getSession
getSession(): Promise<OMSWalletSessionState>;
OMSWalletClient.onSessionExpired
onSessionExpired(_listener: (event: OMSWalletSessionExpiredEvent) => void): EventSubscription;
OMSWalletClient.startEmailAuth
startEmailAuth(_params: StartEmailAuthParams): Promise<void>;
OMSWalletClient.completeEmailAuth
completeEmailAuth(_params: CompleteEmailAuthParams): Promise<CompleteAuthResult>;
OMSWalletClient.signInWithOidcIdToken
signInWithOidcIdToken(_params: SignInWithOidcIdTokenParams): Promise<CompleteAuthResult>;
OMSWalletClient.startOidcRedirectAuth
startOidcRedirectAuth(_params: StartOidcRedirectAuthParams): Promise<StartOidcRedirectAuthResult>;
OMSWalletClient.handleOidcRedirectCallback
handleOidcRedirectCallback(_params: HandleOidcRedirectCallbackParams): Promise<OidcRedirectAuthResult>;
OMSWalletClient.listWallets
listWallets(): Promise<WalletAccount[]>;
OMSWalletClient.useWallet
useWallet(_walletId: string): Promise<WalletActivationResult>;
OMSWalletClient.createWallet
createWallet(_params?: CreateWalletParams): Promise<WalletActivationResult>;
OMSWalletClient.signOut
signOut(): Promise<void>;
OMSWalletClient.getIdToken
getIdToken(_params?: GetIdTokenParams): Promise<string>;
OMSWalletClient.listAccess
listAccess(_params?: ListAccessParams): Promise<CredentialInfo[]>;
OMSWalletClient.listAccessPages
listAccessPages(_params?: ListAccessPagesParams): AsyncGenerator<ListAccessResponse, void, void>;
OMSWalletClient.listAccessPage
listAccessPage(_params?: ListAccessPageParams): Promise<ListAccessResponse>;
OMSWalletClient.revokeAccess
revokeAccess(_targetCredentialId: string): Promise<void>;
OmsRelayOidcProviders
export declare const OmsRelayOidcProviders: Readonly<{
google: OmsRelayOidcProvider;
apple: OmsRelayOidcProvider;
}>;
WalletType
export type WalletType = 'ethereum';
WalletSelectionBehavior
export type WalletSelectionBehavior = 'automatic' | 'manual';
OMSWalletEmailSessionAuth
export type OMSWalletEmailSessionAuth = {
type: 'email';
email: string;
};
OMSWalletOidcSessionAuthFlow
export type OMSWalletOidcSessionAuthFlow = 'redirect' | 'id-token';
OMSWalletOidcSessionAuth
export type OMSWalletOidcSessionAuth = {
type: 'oidc';
flow: OMSWalletOidcSessionAuthFlow;
issuer: string;
provider: string | undefined;
providerLabel: string | undefined;
email: string | undefined;
};
OMSWalletSessionAuth
export type OMSWalletSessionAuth = OMSWalletEmailSessionAuth | OMSWalletOidcSessionAuth;
OMSWalletSessionState
export type OMSWalletSessionState = {
walletAddress: string | undefined;
expiresAt: string | undefined;
auth: OMSWalletSessionAuth | undefined;
};
OMSWalletSessionExpiredEvent
export type OMSWalletSessionExpiredEvent = {
session: OMSWalletSessionState;
expiredAt: string;
};
WalletAccount
export type WalletAccount = {
id: string;
type: WalletType;
address: string;
reference?: string;
};
WalletActivationResult
export type WalletActivationResult = {
walletAddress: string;
wallet: WalletAccount;
};
CredentialInfo
export type CredentialInfo = {
credentialId: string;
expiresAt: string;
isCaller: boolean;
};
PendingWalletSelection
export type PendingWalletSelection = {
walletType: WalletType;
wallets: WalletAccount[];
credential: CredentialInfo;
selectWallet(walletId: string): Promise<WalletActivationResult>;
createAndSelectWallet(reference?: string): Promise<WalletActivationResult>;
};
CompleteAuthResult
export type CompleteAuthResult = {
type: 'walletSelected';
walletAddress: string;
wallet: WalletAccount;
wallets: WalletAccount[];
credential: CredentialInfo;
pendingSelection?: undefined;
} | {
type: 'walletSelection';
walletAddress: undefined;
wallet: undefined;
wallets: WalletAccount[];
credential: CredentialInfo;
pendingSelection: PendingWalletSelection;
};
StartEmailAuthParams
export type StartEmailAuthParams = {
email: string;
sessionLifetimeSeconds?: number;
};
CompleteEmailAuthParams
export type CompleteEmailAuthParams = {
code: string;
walletSelection?: WalletSelectionBehavior;
walletType?: WalletType;
};
SignInWithOidcIdTokenParams
export type SignInWithOidcIdTokenParams = {
idToken: string;
issuer: string;
audience: string;
walletSelection?: WalletSelectionBehavior;
walletType?: WalletType;
sessionLifetimeSeconds?: number;
provider?: string;
providerLabel?: string;
};
OidcAuthMode
export type OidcAuthMode = 'auth-code' | 'auth-code-pkce';
OmsRelayOidcProvider
An opaque SDK-owned registry value. It must come from
OmsRelayOidcProviders; object literals are invalid.
export type OmsRelayOidcProvider = {
readonly provider: 'google' | 'apple';
};
CustomOidcProviderConfig
export type CustomOidcProviderConfig = {
issuer: string;
clientId: string;
authorizationUrl: string;
providerRedirectUri: string;
provider?: string;
providerLabel?: string;
scopes?: string[];
authorizeParams?: Record<string, string>;
authMode?: OidcAuthMode;
};
OidcProviderConfig
export type OidcProviderConfig = OmsRelayOidcProvider | CustomOidcProviderConfig;
StartOidcRedirectAuthParams
export type StartOidcRedirectAuthParams = {
walletType?: WalletType;
walletSelection?: WalletSelectionBehavior;
sessionLifetimeSeconds?: number;
loginHint?: string;
} & ({
provider: OmsRelayOidcProvider;
omsRelayReturnUri: string;
authorizeParams?: never;
} | {
provider: CustomOidcProviderConfig;
omsRelayReturnUri?: never;
authorizeParams?: Record<string, string>;
});
StartOidcRedirectAuthResult
export type StartOidcRedirectAuthResult = {
authorizationUrl: string;
};
HandleOidcRedirectCallbackParams
export type HandleOidcRedirectCallbackParams = {
callbackUrl: string;
walletSelection?: WalletSelectionBehavior;
sessionLifetimeSeconds?: number;
};
OidcRedirectAuthResult
export type OidcRedirectAuthResult = {
type: 'completed';
result: CompleteAuthResult;
} | {
type: 'notOidcRedirectCallback' | 'noPendingAuth';
result?: undefined;
};
CreateWalletParams
export type CreateWalletParams = {
walletType?: WalletType;
reference?: string;
};
GetIdTokenParams
export type GetIdTokenParams = {
ttlSeconds?: number;
customClaims?: Record<string, unknown>;
};
AccessPage
export type AccessPage = {
limit?: number;
cursor?: string;
};
ListAccessResponse
export type ListAccessResponse = {
credentials: CredentialInfo[];
page?: AccessPage;
};
ListAccessParams
export type ListAccessParams = {
pageSize?: number;
};
ListAccessPagesParams
export type ListAccessPagesParams = {
pageSize?: number;
};
ListAccessPageParams
export type ListAccessPageParams = {
pageSize?: number;
cursor?: string;
};
Transactions and signing
OMSWalletClient.signMessage
signMessage(_params: SignMessageParams): Promise<string>;
OMSWalletClient.signTypedData
signTypedData(_params: SignTypedDataParams): Promise<string>;
OMSWalletClient.sendTransaction
sendTransaction(_params: SendTransactionParams): Promise<SendTransactionResponse>;
OMSWalletClient.callContract
callContract(_params: CallContractParams): Promise<SendTransactionResponse>;
OMSWalletClient.getTransactionStatus
getTransactionStatus(_txnId: string): Promise<TransactionStatusResponse>;
OMSWalletClient.isValidMessageSignature
isValidMessageSignature(_params: IsValidMessageSignatureParams): Promise<boolean>;
OMSWalletClient.isValidTypedDataSignature
isValidTypedDataSignature(_params: IsValidTypedDataSignatureParams): Promise<boolean>;
FeeOptionSelectors
export declare const FeeOptionSelectors: Readonly<{
firstAvailable: FeeOptionSelector;
}>;
SignMessageParams
export type SignMessageParams = {
network: Network;
message: string;
};
SignTypedDataParams
export type SignTypedDataParams = {
network: Network;
typedData: unknown;
};
IsValidMessageSignatureParams
export type IsValidMessageSignatureParams = {
network: Network;
message: string;
signature: string;
};
IsValidTypedDataSignatureParams
export type IsValidTypedDataSignatureParams = {
network: Network;
typedData: unknown;
signature: string;
};
CallContractArg
export type CallContractArg = {
type: string;
value: unknown;
};
TransactionMode
export type TransactionMode = 'native' | 'relayer';
TransactionStatus
export type TransactionStatus = 'quoted' | 'pending' | 'executed' | 'failed' | 'unknown';
TransactionStatusResolution
export type TransactionStatusResolution = 'not-requested' | 'resolved' | 'timed-out';
TransactionStatusPollingOptions
export type TransactionStatusPollingOptions = {
timeoutMs?: number;
intervalMs?: number;
fastIntervalMs?: number;
fastPollCount?: number;
};
SendTransactionResponse
export type SendTransactionResponse = {
txnId: string;
status: TransactionStatus;
txnHash?: string;
statusResolution: TransactionStatusResolution;
};
TransactionStatusResponse
export type TransactionStatusResponse = {
status: TransactionStatus;
txnHash?: string;
};
FeeToken
export type FeeToken = {
network: string;
name: string;
symbol: string;
type: string;
decimals?: number;
logoUrl?: string;
contractAddress?: string;
tokenId?: string;
};
FeeOption
export type FeeOption = {
token: FeeToken;
value: string;
displayValue: string;
};
FeeOptionSelection
export type FeeOptionSelection = {
token: string;
};
FeeOptionWithBalance
export type FeeOptionWithBalance = {
feeOption: FeeOption;
selection: FeeOptionSelection;
balance?: TokenBalance;
available?: string;
availableRaw?: string;
decimals?: number;
};
FeeOptionSelector
export type FeeOptionSelector = (feeOptions: FeeOptionWithBalance[]) => FeeOptionSelection | undefined | Promise<FeeOptionSelection | undefined>;
SendTransactionParams
export type SendTransactionParams = {
network: Network;
to: string;
value: string;
data?: string;
mode?: TransactionMode;
selectFeeOption?: FeeOptionSelector;
waitForStatus?: boolean;
statusPolling?: TransactionStatusPollingOptions;
};
CallContractParams
export type CallContractParams = {
network: Network;
contractAddress: string;
method: string;
args?: CallContractArg[];
mode?: TransactionMode;
selectFeeOption?: FeeOptionSelector;
waitForStatus?: boolean;
statusPolling?: TransactionStatusPollingOptions;
};
Indexer
OMSIndexerClient.getBalances
getBalances(_params: GetBalancesParams): Promise<BalancesResult>;
OMSIndexerClient.getTransactionHistory
getTransactionHistory(_params: GetTransactionHistoryParams): Promise<TransactionHistoryResult>;
IndexerNetworkType
export type IndexerNetworkType = 'MAINNETS' | 'TESTNETS' | 'ALL';
ContractVerificationStatus
export type ContractVerificationStatus = 'VERIFIED' | 'UNVERIFIED' | 'ALL';
MetadataOptions
export type MetadataOptions = {
verifiedOnly?: boolean;
unverifiedOnly?: boolean;
includeContracts?: string[];
};
TokenBalancesPageRequest
export type TokenBalancesPageRequest = {
page?: number;
pageSize?: number;
};
TokenBalancesPage
export type TokenBalancesPage = {
page: number;
pageSize: number;
more: boolean;
};
TokenContractInfo
export type TokenContractInfo = {
chainId: number;
address: string;
source: string;
name: string;
type: string;
symbol: string;
decimals?: number;
logoURI?: string;
deployed: boolean;
bytecodeHash: string;
extensions: Record<string, unknown>;
updatedAt: string;
queuedAt?: string;
status: string;
};
TokenMetadataAsset
export type TokenMetadataAsset = {
id?: number;
collectionId?: number;
tokenId?: string;
url?: string;
metadataField?: string;
name?: string;
filesize?: number;
mimeType?: string;
width?: number;
height?: number;
updatedAt?: string;
};
TokenMetadata
export type TokenMetadata = {
chainId?: number;
contractAddress?: string;
tokenId: string;
source: string;
name: string;
description?: string;
image?: string;
video?: string;
audio?: string;
properties?: Record<string, unknown>;
attributes: Record<string, unknown>[];
imageData?: string;
externalUrl?: string;
backgroundColor?: string;
animationUrl?: string;
decimals?: number;
updatedAt?: string;
assets?: TokenMetadataAsset[];
status: string;
queuedAt?: string;
lastFetched?: string;
};
NativeTokenBalance
export type NativeTokenBalance = {
contractType: 'NATIVE';
contractAddress?: undefined;
accountAddress: string;
tokenId?: undefined;
name: string;
symbol: string;
balance: string;
chainId: number;
balanceUSD?: string;
priceUSD?: string;
priceUpdatedAt?: string;
};
ContractTokenBalance
export type ContractTokenBalance = {
contractType: string;
contractAddress: string;
accountAddress: string;
tokenId: string;
balance: string;
blockHash: string;
blockNumber: number;
chainId: number;
balanceUSD?: string;
priceUSD?: string;
priceUpdatedAt?: string;
uniqueCollectibles?: string;
isSummary?: boolean;
contractInfo?: TokenContractInfo;
tokenMetadata?: TokenMetadata;
};
TokenBalance
export type TokenBalance = NativeTokenBalance | ContractTokenBalance;
BalancesResult
export type BalancesResult = {
status: number;
page?: TokenBalancesPage;
nativeBalances: NativeTokenBalance[];
balances: ContractTokenBalance[];
};
GetBalancesParams
export type GetBalancesParams = {
walletAddress: string;
networks?: Network[];
networkType?: IndexerNetworkType;
contractAddresses?: string[];
includeMetadata?: boolean;
omitPrices?: boolean;
tokenIds?: string[];
contractStatus?: ContractVerificationStatus;
page?: TokenBalancesPageRequest;
};
TransactionTransfer
export type TransactionTransfer = {
transferType: string;
contractAddress: string;
contractType: string;
from: string;
to: string;
tokenIds?: string[];
amounts: string[];
logIndex: number;
amountsUSD?: string[];
pricesUSD?: string[];
contractInfo?: TokenContractInfo;
tokenMetadata?: Record<string, TokenMetadata>;
};
Transaction
export type Transaction = {
txnHash: string;
blockNumber: number;
blockHash: string;
chainId: number;
metaTxnId?: string;
transfers: TransactionTransfer[];
timestamp: string;
};
TransactionHistoryResult
export type TransactionHistoryResult = {
status: number;
page?: TokenBalancesPage;
transactions: Transaction[];
};
GetTransactionHistoryParams
export type GetTransactionHistoryParams = {
walletAddress: string;
networks?: Network[];
networkType?: IndexerNetworkType;
contractAddresses?: string[];
transactionHashes?: string[];
metaTransactionIds?: string[];
fromBlock?: number;
toBlock?: number;
tokenId?: string;
includeMetadata?: boolean;
omitPrices?: boolean;
metadataOptions?: MetadataOptions;
page?: TokenBalancesPageRequest;
};
Networks, types, and errors
Network
An opaque SDK-owned registry value. It must come from Networks; object
literals are invalid.
export interface Network {
readonly id: number;
readonly name: string;
readonly nativeTokenSymbol: string;
readonly explorerUrl: string;
readonly displayName: string;
}
Networks
export declare const Networks: Readonly<{
mainnet: Readonly<{
readonly id: 1;
readonly name: "mainnet";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://etherscan.io";
readonly displayName: "Ethereum";
}> & Network;
sepolia: Readonly<{
readonly id: 11155111;
readonly name: "sepolia";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://sepolia.etherscan.io";
readonly displayName: "Sepolia";
}> & Network;
polygon: Readonly<{
readonly id: 137;
readonly name: "polygon";
readonly nativeTokenSymbol: "POL";
readonly explorerUrl: "https://polygonscan.com";
readonly displayName: "Polygon";
}> & Network;
amoy: Readonly<{
readonly id: 80002;
readonly name: "amoy";
readonly nativeTokenSymbol: "POL";
readonly explorerUrl: "https://amoy.polygonscan.com";
readonly displayName: "Polygon Amoy";
}> & Network;
arbitrum: Readonly<{
readonly id: 42161;
readonly name: "arbitrum";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://arbiscan.io";
readonly displayName: "Arbitrum";
}> & Network;
arbitrumSepolia: Readonly<{
readonly id: 421614;
readonly name: "arbitrum-sepolia";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://sepolia.arbiscan.io";
readonly displayName: "Arbitrum Sepolia";
}> & Network;
optimism: Readonly<{
readonly id: 10;
readonly name: "optimism";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://optimistic.etherscan.io";
readonly displayName: "Optimism";
}> & Network;
optimismSepolia: Readonly<{
readonly id: 11155420;
readonly name: "optimism-sepolia";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://sepolia-optimism.etherscan.io";
readonly displayName: "Optimism Sepolia";
}> & Network;
base: Readonly<{
readonly id: 8453;
readonly name: "base";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://basescan.org";
readonly displayName: "Base";
}> & Network;
baseSepolia: Readonly<{
readonly id: 84532;
readonly name: "base-sepolia";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://sepolia.basescan.org";
readonly displayName: "Base Sepolia";
}> & Network;
bsc: Readonly<{
readonly id: 56;
readonly name: "bsc";
readonly nativeTokenSymbol: "BNB";
readonly explorerUrl: "https://bscscan.com";
readonly displayName: "BSC";
}> & Network;
bscTestnet: Readonly<{
readonly id: 97;
readonly name: "bsc-testnet";
readonly nativeTokenSymbol: "BNB";
readonly explorerUrl: "https://testnet.bscscan.com";
readonly displayName: "BSC Testnet";
}> & Network;
arbitrumNova: Readonly<{
readonly id: 42170;
readonly name: "arbitrum-nova";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://nova.arbiscan.io";
readonly displayName: "Arbitrum Nova";
}> & Network;
avalanche: Readonly<{
readonly id: 43114;
readonly name: "avalanche";
readonly nativeTokenSymbol: "AVAX";
readonly explorerUrl: "https://subnets.avax.network/c-chain";
readonly displayName: "Avalanche";
}> & Network;
avalancheTestnet: Readonly<{
readonly id: 43113;
readonly name: "avalanche-testnet";
readonly nativeTokenSymbol: "AVAX";
readonly explorerUrl: "https://subnets-test.avax.network/c-chain";
readonly displayName: "Avalanche Testnet";
}> & Network;
katana: Readonly<{
readonly id: 747474;
readonly name: "katana";
readonly nativeTokenSymbol: "ETH";
readonly explorerUrl: "https://katanascan.com";
readonly displayName: "Katana";
}> & Network;
}>;
findNetworkById
export declare function findNetworkById(chainId: number): Network | undefined;
findNetworkByName
export declare function findNetworkByName(name: string): Network | undefined;
ParseUnitsRoundingMode
export type ParseUnitsRoundingMode = 'reject' | 'nearest';
ParseUnitsOptions
export type ParseUnitsOptions = {
/**
* `nearest` matches the native SDK helpers by rounding over-precision to the
* nearest base unit. Use `reject` to fail on non-zero excess precision.
*/
roundingMode?: ParseUnitsRoundingMode;
};
parseUnits
export declare function parseUnits(value: string, decimals?: number, options?: ParseUnitsOptions): string;
formatUnits
export declare function formatUnits(value: string | bigint, decimals?: number): string;
OMSWalletErrorCode
export type OMSWalletErrorCode = 'OMS_HTTP_ERROR' | 'OMS_INVALID_RESPONSE' | 'OMS_REQUEST_FAILED' | 'OMS_AUTH_COMMITMENT_CONSUMED' | 'OMS_SESSION_MISSING' | 'OMS_SESSION_EXPIRED' | 'OMS_WALLET_SELECTION_STALE' | 'OMS_WALLET_SELECTION_UNAVAILABLE' | 'OMS_WALLET_SELECTION_IN_FLIGHT' | 'OMS_TRANSACTION_EXECUTION_UNCONFIRMED' | 'OMS_TRANSACTION_STATUS_LOOKUP_FAILED' | 'OMS_VALIDATION_ERROR' | 'OMS_STORAGE_ERROR';
OMSWalletUpstreamError
export type OMSWalletUpstreamError = {
service: 'waas' | 'indexer';
name?: string;
code?: string;
message?: string;
status?: number;
};
OMSWalletErrorDetails
export type OMSWalletErrorDetails = {
operation?: string;
status?: number;
txnId?: string;
retryable?: boolean;
upstreamError?: OMSWalletUpstreamError;
};
OMSWalletError
export declare class OMSWalletError extends Error {
readonly code: OMSWalletErrorCode;
readonly operation?: string;
readonly status?: number;
readonly txnId?: string;
readonly retryable?: boolean;
readonly upstreamError?: OMSWalletUpstreamError;
constructor(code: OMSWalletErrorCode, message: string, details?: Partial<OMSWalletErrorDetails>, options?: ErrorOptions);
}
isOMSWalletError
export declare function isOMSWalletError(error: unknown): error is OMSWalletError;