@portal-hq/utils
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "@portal-hq/utils", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"main": "lib/commonjs/index", | ||
@@ -29,3 +29,3 @@ "module": "lib/esm/index", | ||
}, | ||
"gitHead": "2ba5caccbaae676a2b207bab294bbd59cfc136ca" | ||
"gitHead": "fe11c271c1d85aca8f4e323a5a69b277483dbe89" | ||
} |
@@ -1,11 +0,97 @@ | ||
import { | ||
type ClientWithCustodianData, | ||
type Dapp, | ||
type DkgData, | ||
type Network, | ||
type ProgressCallback, | ||
import { HttpRequester } from '../requesters' | ||
import type { | ||
Balance, | ||
QuoteArgs, | ||
ClientWithCustodianData, | ||
Dapp, | ||
DkgData, | ||
Network, | ||
ProgressCallback, | ||
QuoteResponse, | ||
Transaction, | ||
NFT, | ||
} from '../../types' | ||
import PortalConnect from '@portal-hq/connect' | ||
export type EventHandler = (data: any) => void | ||
export interface Eip1559 { | ||
gasLimit?: string | ||
maxPriorityFeePerGas?: string | ||
maxFeePerGas?: string | ||
[key: string]: any | ||
} | ||
export interface LegacyTx { | ||
gasLimit?: string | ||
gasPrice?: string | ||
[key: string]: any | ||
} | ||
export interface RequestArguments { | ||
method: string | ||
params?: unknown[] | SigningRequestParams | ||
connect?: PortalConnect | ||
} | ||
export type SigningRequestParams = Eip1559 | LegacyTx | ||
export interface IPortalApi { | ||
apiKey: string | ||
apiUrl: string | ||
requests: HttpRequester | ||
getClient(): Promise<ClientWithCustodianData> | ||
getEnabledDapps(): Promise<Dapp[]> | ||
getNetworks(): Promise<Network[]> | ||
getNFTs(): Promise<NFT[]> | ||
getTransactions(): Promise<Transaction[]> | ||
getBalances(): Promise<Balance[]> | ||
getQuote(apiKey: string, args: QuoteArgs): Promise<QuoteResponse> | ||
getSources(apiKey: string): Promise<Record<string, string>> | ||
storedClientSigningShare(options?: { | ||
recoverSigning?: boolean | ||
}): Promise<void> | ||
storedClientBackupShareKey(backupMethod: string): Promise<void> | ||
storedClientBackupShare(success: boolean): Promise<void> | ||
identify(traits?: Record<string, any>): Promise<{ success: boolean }> | ||
track( | ||
event: string, | ||
properties?: Record<string, any>, | ||
): Promise<{ success: boolean }> | ||
} | ||
export interface IPortalConnect { | ||
connected: boolean | ||
connect(uri: string): Promise<void> | ||
deinit(): void | ||
disconnect(): void | ||
emit(event: string, data: any): PortalConnect | ||
on(event: string, callback: EventHandler): PortalConnect | ||
once(event: string, callback: EventHandler): PortalConnect | ||
removeEventListener(event: string, listenerToRemove?: EventHandler): void | ||
setChainId(chainId: number): Promise<void> | ||
} | ||
export interface IPortalProvider { | ||
apiKey: string | ||
autoApprove: boolean | ||
chainId: number | ||
log: Console | ||
gateway: HttpRequester | ||
address: Promise<string | undefined> | ||
gatewayUrl: string | ||
emit(event: string, data: any): IPortalProvider | ||
getGatewayUrl(): string | ||
on(event: string, callback: EventHandler): IPortalProvider | ||
once(event: string, callback: EventHandler): IPortalProvider | ||
removeEventListener(event: string, listenerToRemove?: EventHandler): void | ||
request(args: RequestArguments): Promise<any> | ||
setChainId(chainId: number, connect?: PortalConnect): Promise<IPortalProvider> | ||
} | ||
export abstract class KeychainAdapter { | ||
public api?: PortalApi | ||
public api?: IPortalApi | ||
@@ -68,10 +154,4 @@ deleteAddress(): Promise<boolean> { | ||
export declare class PortalApi { | ||
getClient(): Promise<ClientWithCustodianData> | ||
getEnabledDapps(): Promise<Dapp[]> | ||
getNetworks(): Promise<Network[]> | ||
} | ||
export abstract class Storage { | ||
public api?: PortalApi | ||
public api?: IPortalApi | ||
@@ -78,0 +158,0 @@ delete(): Promise<boolean> { |
@@ -11,5 +11,8 @@ export { | ||
export { | ||
type IPortalApi, | ||
type IPortalConnect, | ||
type IPortalProvider, | ||
KeychainAdapter, | ||
MpcStatuses, | ||
type PortalApi, | ||
type RequestArguments, | ||
Storage, | ||
@@ -16,0 +19,0 @@ } from './definitions' |
import { MpcStatuses } from './src/definitions' | ||
export type MpcMember = 'client' | 'server' | ||
export type OutgoingRequestData = MessageData | SignableTransactionData | ||
@@ -60,8 +62,16 @@ | ||
pubkey: Pubkey | ||
partialPubKey: Pubkey[] | ||
allY: Pubkey[] | ||
partialPubkey: { | ||
[key: MpcMember]: Pubkey | ||
} | ||
allY: { | ||
[key: MpcMember]: Pubkey | ||
} | ||
p: string | ||
q: string | ||
pederson: PedersonParams[] | ||
bks: Bk[] | ||
pederson: { | ||
[key: MpcMember]: PedersonParams | ||
} | ||
bks: { | ||
[key: MpcMember]: Bk | ||
} | ||
} | ||
@@ -127,2 +137,26 @@ | ||
export interface QuoteArgs { | ||
affiliateAddress?: string | ||
buyAmount?: number | ||
buyToken: string | ||
buyTokenPercentageFee?: number | ||
enableSlippageProtection?: boolean | ||
excludedSources?: string | ||
feeRecipient?: string | ||
gasPrice?: number | ||
includedSources?: string | ||
intentOnFilling?: boolean | ||
priceImpactProtectionPercentage?: number | ||
sellAmount?: number | ||
sellToken: string | ||
skipValidation?: boolean | ||
slippagePercentage?: number | ||
takerAddress?: string | ||
} | ||
export interface QuoteResponse { | ||
cost: string | ||
transaction: Eip1559 | LegacyTx | ||
} | ||
export interface RequesterOptions {} | ||
@@ -129,0 +163,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128383
3761