diff --git a/libs/wallet/project.json b/libs/wallet/project.json index ed86b5bd5..f4debfba1 100644 --- a/libs/wallet/project.json +++ b/libs/wallet/project.json @@ -45,6 +45,13 @@ "options": { "command": "yarn tsc --project ./libs/wallet/tsconfig.spec.json" } + }, + "generate": { + "executor": "nx:run-commands", + "outputs": [], + "options": { + "command": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./libs/wallet/src/__generated__ $WALLET_TRANSACTIONS_SOURCE --proto_path=$WALLET_TRANSACTIONS_ROOT --ts_proto_opt=onlyTypes=true" + } } } } diff --git a/libs/wallet/src/__generated__/google/protobuf/struct.ts b/libs/wallet/src/__generated__/google/protobuf/struct.ts new file mode 100644 index 000000000..b86247ffe --- /dev/null +++ b/libs/wallet/src/__generated__/google/protobuf/struct.ts @@ -0,0 +1,78 @@ +/* eslint-disable */ + +export const protobufPackage = "google.protobuf"; + +/** + * `NullValue` is a singleton enumeration to represent the null value for the + * `Value` type union. + * + * The JSON representation for `NullValue` is JSON `null`. + */ +export enum NullValue { + /** NULL_VALUE - Null value. */ + NULL_VALUE = 0, + UNRECOGNIZED = -1, +} + +/** + * `Struct` represents a structured data value, consisting of fields + * which map to dynamically typed values. In some languages, `Struct` + * might be supported by a native representation. For example, in + * scripting languages like JS a struct is represented as an + * object. The details of that representation are described together + * with the proto support for the language. + * + * The JSON representation for `Struct` is JSON object. + */ +export interface Struct { + /** Unordered map of dynamically typed values. */ + fields: { [key: string]: any | undefined }; +} + +export interface Struct_FieldsEntry { + key: string; + value: any | undefined; +} + +/** + * `Value` represents a dynamically typed value which can be either + * null, a number, a string, a boolean, a recursive struct value, or a + * list of values. A producer of value is expected to set one of these + * variants. Absence of any variant indicates an error. + * + * The JSON representation for `Value` is JSON value. + */ +export interface Value { + /** Represents a null value. */ + nullValue?: + | NullValue + | undefined; + /** Represents a double value. */ + numberValue?: + | number + | undefined; + /** Represents a string value. */ + stringValue?: + | string + | undefined; + /** Represents a boolean value. */ + boolValue?: + | boolean + | undefined; + /** Represents a structured value. */ + structValue?: + | { [key: string]: any } + | undefined; + /** Represents a repeated `Value`. */ + listValue?: Array | undefined; +} + +/** + * `ListValue` is a wrapper around a repeated field of values. + * + * The JSON representation for `ListValue` is JSON array. + */ +export interface ListValue { + /** Repeated field of dynamically typed values. */ + values: any[]; +} diff --git a/libs/wallet/src/__generated__/vega/assets.ts b/libs/wallet/src/__generated__/vega/assets.ts new file mode 100644 index 000000000..9310031ca --- /dev/null +++ b/libs/wallet/src/__generated__/vega/assets.ts @@ -0,0 +1,93 @@ +/* eslint-disable */ + +export const protobufPackage = "vega"; + +/** Vega representation of an external asset */ +export interface Asset { + /** Internal identifier of the asset. */ + id: string; + /** Definition of the external source for this asset. */ + details: + | AssetDetails + | undefined; + /** Status of the asset. */ + status: Asset_Status; +} + +export enum Asset_Status { + /** STATUS_UNSPECIFIED - Default value, always invalid */ + STATUS_UNSPECIFIED = 0, + /** STATUS_PROPOSED - Asset is proposed and under vote */ + STATUS_PROPOSED = 1, + /** STATUS_REJECTED - Asset has been rejected from governance */ + STATUS_REJECTED = 2, + /** STATUS_PENDING_LISTING - Asset is pending listing from the bridge */ + STATUS_PENDING_LISTING = 3, + /** STATUS_ENABLED - Asset is fully usable in the network */ + STATUS_ENABLED = 4, + UNRECOGNIZED = -1, +} + +/** Vega representation of an external asset */ +export interface AssetDetails { + /** Name of the asset (e.g: Great British Pound). */ + name: string; + /** Symbol of the asset (e.g: GBP). */ + symbol: string; + /** Number of decimal / precision handled by this asset. */ + decimals: number; + /** Minimum economically meaningful amount in the asset. */ + quantum: string; + /** Vega built-in asset. */ + builtinAsset?: + | BuiltinAsset + | undefined; + /** Ethereum ERC20 asset. */ + erc20?: ERC20 | undefined; +} + +/** Vega internal asset */ +export interface BuiltinAsset { + /** Maximum amount that can be requested by a party through the built-in asset faucet at a time. */ + maxFaucetAmountMint: string; +} + +/** ERC20 token based asset, living on the ethereum network */ +export interface ERC20 { + /** Address of the contract for the token, on the ethereum network. */ + contractAddress: string; + /** + * Lifetime limits deposit per address + * note: this is a temporary measure that can be changed by governance. + */ + lifetimeLimit: string; + /** + * Maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay. + * There’s no limit on the size of a withdrawal + * note: this is a temporary measure that can be changed by governance. + */ + withdrawThreshold: string; +} + +/** Changes to apply on an existing asset. */ +export interface AssetDetailsUpdate { + /** Minimum economically meaningful amount in the asset. */ + quantum: string; + /** Ethereum ERC20 asset update. */ + erc20?: ERC20Update | undefined; +} + +export interface ERC20Update { + /** + * Lifetime limits deposit per address. + * This will be interpreted against the asset decimals. + * note: this is a temporary measure that can be changed by governance. + */ + lifetimeLimit: string; + /** + * Maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay. + * There’s no limit on the size of a withdrawal + * note: this is a temporary measure that can be changed by governance. + */ + withdrawThreshold: string; +} diff --git a/libs/wallet/src/__generated__/vega/chain_events.ts b/libs/wallet/src/__generated__/vega/chain_events.ts new file mode 100644 index 000000000..3e143913c --- /dev/null +++ b/libs/wallet/src/__generated__/vega/chain_events.ts @@ -0,0 +1,234 @@ +/* eslint-disable */ + +export const protobufPackage = "vega"; + +/** Result of calling an arbitrary Ethereum contract method */ +export interface EthContractCallEvent { + /** ID of the data source spec that triggered this contract call. */ + specId: string; + /** Ethereum block height. */ + blockHeight: number; + /** Ethereum block time in Unix seconds. */ + blockTime: number; + /** Result of contract call, packed according to the ABI stored in the associated data source spec. */ + result: Uint8Array; +} + +/** Deposit for a Vega built-in asset */ +export interface BuiltinAssetDeposit { + /** Vega network internal asset ID. */ + vegaAssetId: string; + /** Vega party ID i.e. public key. */ + partyId: string; + /** Amount to be deposited. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; +} + +/** Withdrawal for a Vega built-in asset */ +export interface BuiltinAssetWithdrawal { + /** Vega network internal asset ID. */ + vegaAssetId: string; + /** Vega network party ID i.e. public key. */ + partyId: string; + /** The amount to be withdrawn. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; +} + +/** Event related to a Vega built-in asset */ +export interface BuiltinAssetEvent { + /** Built-in asset deposit. */ + deposit?: + | BuiltinAssetDeposit + | undefined; + /** Built-in asset withdrawal. */ + withdrawal?: BuiltinAssetWithdrawal | undefined; +} + +/** Asset allow-listing for an ERC20 token */ +export interface ERC20AssetList { + /** Vega network internal asset ID. */ + vegaAssetId: string; + /** Ethereum address of the asset. */ + assetSource: string; +} + +/** Asset deny-listing for an ERC20 token */ +export interface ERC20AssetDelist { + /** Vega network internal asset ID. */ + vegaAssetId: string; +} + +export interface ERC20AssetLimitsUpdated { + /** Vega network internal asset ID. */ + vegaAssetId: string; + /** Ethereum wallet that initiated the deposit. */ + sourceEthereumAddress: string; + /** Updated lifetime limits. */ + lifetimeLimits: string; + /** Updated withdrawal threshold. */ + withdrawThreshold: string; +} + +/** Asset deposit for an ERC20 token */ +export interface ERC20Deposit { + /** Vega network internal asset ID. */ + vegaAssetId: string; + /** Ethereum wallet that initiated the deposit. */ + sourceEthereumAddress: string; + /** Vega party ID i.e. public key that is the target of the deposit. */ + targetPartyId: string; + /** Amount to be deposited. */ + amount: string; +} + +/** Asset withdrawal for an ERC20 token */ +export interface ERC20Withdrawal { + /** Vega network internal asset ID. */ + vegaAssetId: string; + /** Target Ethereum wallet address. */ + targetEthereumAddress: string; + /** Reference nonce used for the transaction. */ + referenceNonce: string; +} + +/** Event related to an ERC20 token */ +export interface ERC20Event { + /** Index of the log in the transaction. */ + index: number; + /** Block in which the transaction was added. */ + block: number; + /** List an ERC20 asset. */ + assetList?: + | ERC20AssetList + | undefined; + /** De-list an ERC20 asset. */ + assetDelist?: + | ERC20AssetDelist + | undefined; + /** Deposit ERC20 asset. */ + deposit?: + | ERC20Deposit + | undefined; + /** Withdraw ERC20 asset. */ + withdrawal?: + | ERC20Withdrawal + | undefined; + /** Update an ERC20 asset. */ + assetLimitsUpdated?: + | ERC20AssetLimitsUpdated + | undefined; + /** Bridge operations has been stopped. */ + bridgeStopped?: + | boolean + | undefined; + /** Bridge operations has been resumed. */ + bridgeResumed?: boolean | undefined; +} + +/** New signer added to the ERC20 bridge */ +export interface ERC20SignerAdded { + /** Ethereum address of the new signer */ + newSigner: string; + /** Nonce created by the Vega network used for this new signer */ + nonce: string; + /** + * Time at which the block was produced + * will be used to inform the core at what time + * the stake was made unavailable. + */ + blockTime: number; +} + +/** Signer removed from the ERC20 bridge */ +export interface ERC20SignerRemoved { + /** Ethereum address of the old signer */ + oldSigner: string; + /** Nonce created by the Vega network used for this old signer */ + nonce: string; + /** + * Time at which the block was produced. + * Will be used to inform the core at what time + * the stake was made unavailable. + */ + blockTime: number; +} + +/** Threshold has been updated on the multisig control */ +export interface ERC20ThresholdSet { + /** New threshold value to set */ + newThreshold: number; + /** Nonce created by the Vega network */ + nonce: string; + /** + * Time at which the block was produced. + * Will be used to inform the core at what time + * the stake was made unavailable. + */ + blockTime: number; +} + +/** Event related to the ERC20 MultiSig */ +export interface ERC20MultiSigEvent { + /** Index of the log in the transaction */ + index: number; + /** Block in which the transaction was added */ + block: number; + /** Add a signer to the erc20 bridge */ + signerAdded?: + | ERC20SignerAdded + | undefined; + /** Remove a signer from the erc20 bridge */ + signerRemoved?: + | ERC20SignerRemoved + | undefined; + /** Threshold set */ + thresholdSet?: ERC20ThresholdSet | undefined; +} + +/** Event related to staking on the Vega network. */ +export interface StakingEvent { + /** Index of the log in the transaction. */ + index: number; + /** Block in which the transaction was added. */ + block: number; + stakeDeposited?: StakeDeposited | undefined; + stakeRemoved?: StakeRemoved | undefined; + totalSupply?: StakeTotalSupply | undefined; +} + +export interface StakeDeposited { + /** Ethereum Address of the user depositing stake (hex encode with 0x prefix) */ + ethereumAddress: string; + /** Hex encoded public key of the party receiving the stake deposit. */ + vegaPublicKey: string; + /** Amount deposited as an unsigned base 10 integer scaled to the asset's decimal places. */ + amount: string; + /** + * Time at which the block was produced. + * Will be used to inform the core at what time + * the stake started to be available. + */ + blockTime: number; +} + +export interface StakeRemoved { + /** Ethereum address of the user removing stake. This should be hex encoded with 0x prefix. */ + ethereumAddress: string; + /** Hex encoded public key of the party from which to remove stake. */ + vegaPublicKey: string; + /** Amount removed as a base 10 unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** + * The time at which the block was produced + * will be used to inform the core at what time + * the stake was made unavailable. + */ + blockTime: number; +} + +export interface StakeTotalSupply { + /** Address of the staking asset */ + tokenAddress: string; + /** Total supply observed for the token as an unsigned based 10 integer scaled to the asset's decimal places. */ + totalSupply: string; +} diff --git a/libs/wallet/src/__generated__/vega/commands/v1/commands.ts b/libs/wallet/src/__generated__/vega/commands/v1/commands.ts new file mode 100644 index 000000000..ba8fd8b17 --- /dev/null +++ b/libs/wallet/src/__generated__/vega/commands/v1/commands.ts @@ -0,0 +1,288 @@ +/* eslint-disable */ +import type { ProposalRationale, ProposalTerms, Vote_Value } from "../../governance"; +import type { + AccountType, + DispatchStrategy, + LiquidityOrder, + Order_TimeInForce, + Order_Type, + PeggedOrder, + PeggedReference, + Side, + WithdrawExt, +} from "../../vega"; +import type { NodeSignatureKind } from "./validator_commands"; + +export const protobufPackage = "vega.commands.v1"; + +/** + * Batch of order instructions. + * This command accepts only the following batches of commands + * and will be processed in the following order: + * - OrderCancellation + * - OrderAmendment + * - OrderSubmission + * The total amount of commands in the batch across all three lists of + * instructions is restricted by the following network parameter: + * "spam.protection.max.batchSize" + */ +export interface BatchMarketInstructions { + /** List of order cancellations to be processed sequentially. */ + cancellations: OrderCancellation[]; + /** List of order amendments to be processed sequentially. */ + amendments: OrderAmendment[]; + /** List of order submissions to be processed sequentially. */ + submissions: OrderSubmission[]; +} + +/** Order submission is a request to submit or create a new order on Vega */ +export interface OrderSubmission { + /** Market ID for the order, required field. */ + marketId: string; + /** + * Price for the order, the price is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places, + * required field for limit orders, however it is not required for market orders. + * This field is an unsigned integer scaled to the market's decimal places. + */ + price: string; + /** Size for the order, for example, in a futures market the size equals the number of units, cannot be negative. */ + size: number; + /** Side for the order, e.g. SIDE_BUY or SIDE_SELL, required field. */ + side: Side; + /** Time in force indicates how long an order will remain active before it is executed or expires, required field. */ + timeInForce: Order_TimeInForce; + /** + * Timestamp in Unix nanoseconds for when the order will expire, + * required field only for `Order.TimeInForce`.TIME_IN_FORCE_GTT`. + */ + expiresAt: number; + /** Type for the order, required field - See `Order.Type`. */ + type: Order_Type; + /** + * Reference given for the order, this is typically used to retrieve an order submitted through consensus, currently + * set internally by the node to return a unique reference ID for the order submission. + */ + reference: string; + /** Used to specify the details for a pegged order. */ + peggedOrder: + | PeggedOrder + | undefined; + /** Only valid for Limit orders. Cannot be True at the same time as Reduce-Only. */ + postOnly: boolean; + /** + * Only valid for Non-Persistent orders. Cannot be True at the same time as Post-Only. + * If set, order will only be executed if the outcome of the trade moves the trader's position closer to 0. + */ + reduceOnly: boolean; + /** Parameters used to specify an iceberg order. */ + icebergOpts?: IcebergOpts | undefined; +} + +/** Iceberg order options */ +export interface IcebergOpts { + /** Size of the order that is initially made visible and can cause a trade within a single transaction. */ + initialPeakSize: number; + /** Threshold at which the order's visible remaining size will be refreshed back to its initial peak size. */ + minimumPeakSize: number; +} + +/** Order cancellation is a request to cancel an existing order on Vega */ +export interface OrderCancellation { + /** Unique ID for the order. This is set by the system after consensus. Required field. */ + orderId: string; + /** Market ID for the order, required field. */ + marketId: string; +} + +/** An order amendment is a request to amend or update an existing order on Vega */ +export interface OrderAmendment { + /** Order ID, this is required to find the order and will not be updated, required field. */ + orderId: string; + /** Market ID, this is required to find the order and will not be updated. */ + marketId: string; + /** + * Amend the price for the order if the price value is set, otherwise price will remain unchanged. + * This field is an unsigned integer scaled to the market's decimal places. + */ + price?: + | string + | undefined; + /** + * Amend the size for the order by the delta specified: + * - To reduce the size from the current value set a negative integer value + * - To increase the size from the current value, set a positive integer value + * - To leave the size unchanged set a value of zero + * This field needs to be scaled using the market's position decimal places. + */ + sizeDelta: number; + /** Amend the expiry time for the order, if the Timestamp value is set, otherwise expiry time will remain unchanged. */ + expiresAt?: + | number + | undefined; + /** Amend the time in force for the order, set to TIME_IN_FORCE_UNSPECIFIED to remain unchanged. */ + timeInForce: Order_TimeInForce; + /** Amend the pegged order offset for the order. This field is an unsigned integer scaled to the market's decimal places. */ + peggedOffset: string; + /** Amend the pegged order reference for the order. */ + peggedReference: PeggedReference; +} + +/** A liquidity provision submitted for a given market */ +export interface LiquidityProvisionSubmission { + /** Market ID for the order. */ + marketId: string; + /** + * Specified as a unitless number that represents the amount of settlement asset of the market. + * This field is an unsigned integer scaled using the asset's decimal places. + */ + commitmentAmount: string; + /** Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market, as per setting fees and rewarding liquidity providers. */ + fee: string; + /** Set of liquidity sell orders to meet the liquidity provision obligation. */ + sells: LiquidityOrder[]; + /** Set of liquidity buy orders to meet the liquidity provision obligation. */ + buys: LiquidityOrder[]; + /** Reference to be added to every order created out of this liquidity provision submission. */ + reference: string; +} + +/** Cancel a liquidity provision request */ +export interface LiquidityProvisionCancellation { + /** Unique ID for the market with the liquidity provision to be cancelled. */ + marketId: string; +} + +/** Amend a liquidity provision request */ +export interface LiquidityProvisionAmendment { + /** Unique ID for the market with the liquidity provision to be amended. */ + marketId: string; + /** From here at least one of the following is required to consider the command valid. */ + commitmentAmount: string; + /** empty strings means no change */ + fee: string; + /** empty slice means no change */ + sells: LiquidityOrder[]; + /** empty slice means no change */ + buys: LiquidityOrder[]; + /** empty string means no change */ + reference: string; +} + +/** Represents the submission request to withdraw funds for a party on Vega */ +export interface WithdrawSubmission { + /** Amount to be withdrawn. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Asset to be withdrawn. */ + asset: string; + /** Foreign chain specifics. */ + ext: WithdrawExt | undefined; +} + +/** + * Command to submit a new proposal for the + * Vega network governance + */ +export interface ProposalSubmission { + /** Reference identifying the proposal. */ + reference: string; + /** Proposal configuration and the actual change that is meant to be executed when proposal is enacted. */ + terms: + | ProposalTerms + | undefined; + /** Rationale behind a proposal. */ + rationale: ProposalRationale | undefined; +} + +/** Command to submit a new vote for a governance proposal. */ +export interface VoteSubmission { + /** Submit vote for the specified proposal ID. */ + proposalId: string; + /** Actual value of the vote. */ + value: Vote_Value; +} + +/** Command to submit an instruction to delegate some stake to a node */ +export interface DelegateSubmission { + /** Delegate to the specified node ID. */ + nodeId: string; + /** Amount of stake to delegate. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; +} + +export interface UndelegateSubmission { + /** Node ID to delegate to. */ + nodeId: string; + /** + * Optional, if not specified = ALL. + * If provided, this field must be an unsigned integer passed as a string + * and needs to be scaled using the asset decimal places for the token. + */ + amount: string; + /** Method of delegation. */ + method: UndelegateSubmission_Method; +} + +export enum UndelegateSubmission_Method { + METHOD_UNSPECIFIED = 0, + METHOD_NOW = 1, + METHOD_AT_END_OF_EPOCH = 2, + UNRECOGNIZED = -1, +} + +/** Transfer initiated by a party */ +export interface Transfer { + /** + * Account type from which the funds of the party + * should be taken. + */ + fromAccountType: AccountType; + /** Public key of the destination account. */ + to: string; + /** Type of the destination account. */ + toAccountType: AccountType; + /** Asset ID of the asset to be transferred. */ + asset: string; + /** Amount to be taken from the source account. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Reference to be attached to the transfer. */ + reference: string; + oneOff?: OneOffTransfer | undefined; + recurring?: RecurringTransfer | undefined; +} + +/** Specific details for a one off transfer */ +export interface OneOffTransfer { + /** Timestamp in Unix nanoseconds for when the transfer should be delivered into the receiver's account. */ + deliverOn: number; +} + +/** Specific details for a recurring transfer */ +export interface RecurringTransfer { + /** First epoch from which this transfer shall be paid. */ + startEpoch: number; + /** Last epoch at which this transfer shall be paid. */ + endEpoch?: + | number + | undefined; + /** Factor needs to be > 0. */ + factor: string; + /** Optional parameter defining how a transfer is dispatched. */ + dispatchStrategy: DispatchStrategy | undefined; +} + +/** Request for cancelling a recurring transfer */ +export interface CancelTransfer { + /** Transfer ID of the transfer to cancel. */ + transferId: string; +} + +/** Transaction for a validator to submit signatures to a smart contract */ +export interface IssueSignatures { + /** Ethereum address which will submit the signatures to the smart contract. */ + submitter: string; + /** What kind of signatures to generate, namely for whether a signer is being added or removed. */ + kind: NodeSignatureKind; + /** Node ID of the validator node that will be signed in or out of the smart contract. */ + validatorNodeId: string; +} diff --git a/libs/wallet/src/__generated__/vega/commands/v1/signature.ts b/libs/wallet/src/__generated__/vega/commands/v1/signature.ts new file mode 100644 index 000000000..a4d465ebb --- /dev/null +++ b/libs/wallet/src/__generated__/vega/commands/v1/signature.ts @@ -0,0 +1,16 @@ +/* eslint-disable */ + +export const protobufPackage = "vega.commands.v1"; + +/** + * Signature to authenticate a transaction and to be verified by the Vega + * network. + */ +export interface Signature { + /** Hex encoded bytes of the signature. */ + value: string; + /** Algorithm used to create the signature. */ + algo: string; + /** Version of the signature used to create the signature. */ + version: number; +} diff --git a/libs/wallet/src/__generated__/vega/commands/v1/validator_commands.ts b/libs/wallet/src/__generated__/vega/commands/v1/validator_commands.ts new file mode 100644 index 000000000..614f1a504 --- /dev/null +++ b/libs/wallet/src/__generated__/vega/commands/v1/validator_commands.ts @@ -0,0 +1,202 @@ +/* eslint-disable */ +import type { + BuiltinAssetEvent, + ERC20Event, + ERC20MultiSigEvent, + EthContractCallEvent, + StakingEvent, +} from "../../chain_events"; +import type { StateValueProposal } from "../../vega"; +import type { Signature } from "./signature"; + +export const protobufPackage = "vega.commands.v1"; + +/** Kind of signature created by a node, for example, allow-listing a new asset, withdrawal etc */ +export enum NodeSignatureKind { + /** NODE_SIGNATURE_KIND_UNSPECIFIED - Represents an unspecified or missing value from the input */ + NODE_SIGNATURE_KIND_UNSPECIFIED = 0, + /** NODE_SIGNATURE_KIND_ASSET_NEW - Represents a signature for a new asset allow-listing */ + NODE_SIGNATURE_KIND_ASSET_NEW = 1, + /** NODE_SIGNATURE_KIND_ASSET_WITHDRAWAL - Represents a signature for an asset withdrawal */ + NODE_SIGNATURE_KIND_ASSET_WITHDRAWAL = 2, + /** NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_ADDED - Represents a signature for a new signer added to the erc20 multisig contract */ + NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_ADDED = 3, + /** NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_REMOVED - Represents a signature for a signer removed from the erc20 multisig contract */ + NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_REMOVED = 4, + /** NODE_SIGNATURE_KIND_ASSET_UPDATE - Represents a signature for an asset update allow-listing */ + NODE_SIGNATURE_KIND_ASSET_UPDATE = 5, + UNRECOGNIZED = -1, +} + +/** + * Message from a validator signalling they are still online and validating blocks + * or ready to validate blocks when they are still a pending validator + */ +export interface ValidatorHeartbeat { + /** Node ID of the validator emitting the heartbeat. */ + nodeId: string; + /** Signature from the validator made using the ethereum wallet. */ + ethereumSignature: + | Signature + | undefined; + /** Signature from the validator made using the vega wallet. */ + vegaSignature: + | Signature + | undefined; + /** Message which has been signed. */ + message: string; +} + +/** Used to announce a node as a new pending validator */ +export interface AnnounceNode { + /** Vega public key, required field. */ + vegaPubKey: string; + /** Ethereum public key, required field. */ + ethereumAddress: string; + /** Public key for the blockchain, required field. */ + chainPubKey: string; + /** URL with more info on the node. */ + infoUrl: string; + /** Country code (ISO 3166-1 alpha-2) for the location of the node. */ + country: string; + /** Node ID of the validator, i.e. the node's public master key. */ + id: string; + /** Name of the validator. */ + name: string; + /** AvatarURL of the validator. */ + avatarUrl: string; + /** Vega public key derivation index. */ + vegaPubKeyIndex: number; + /** + * Epoch from which the validator is expected + * to be ready to validate blocks. + */ + fromEpoch: number; + /** Signature from the validator made using the ethereum wallet. */ + ethereumSignature: + | Signature + | undefined; + /** Signature from the validator made using the Vega wallet. */ + vegaSignature: + | Signature + | undefined; + /** Ethereum public key to use as a submitter to allow automatic signature generation. */ + submitterAddress: string; +} + +/** + * Used when a node votes for validating that a given resource exists or is valid, + * for example, an ERC20 deposit is valid and exists on ethereum. + */ +export interface NodeVote { + /** Reference identifying the resource making the vote, required field. */ + reference: string; + /** Type of NodeVote, also required. */ + type: NodeVote_Type; +} + +export enum NodeVote_Type { + /** TYPE_UNSPECIFIED - Represents an unspecified or missing value from the input */ + TYPE_UNSPECIFIED = 0, + /** TYPE_STAKE_DEPOSITED - Node vote for a new stake deposit */ + TYPE_STAKE_DEPOSITED = 1, + /** TYPE_STAKE_REMOVED - Node vote for a new stake removed event */ + TYPE_STAKE_REMOVED = 2, + /** TYPE_FUNDS_DEPOSITED - Node vote for a new collateral deposit */ + TYPE_FUNDS_DEPOSITED = 3, + /** TYPE_SIGNER_ADDED - Node vote for a new signer added to the erc20 bridge */ + TYPE_SIGNER_ADDED = 4, + /** TYPE_SIGNER_REMOVED - Node vote for a signer removed from the erc20 bridge */ + TYPE_SIGNER_REMOVED = 5, + /** TYPE_BRIDGE_STOPPED - Node vote for a bridge stopped event */ + TYPE_BRIDGE_STOPPED = 6, + /** TYPE_BRIDGE_RESUMED - Node vote for a bridge resumed event */ + TYPE_BRIDGE_RESUMED = 7, + /** TYPE_ASSET_LISTED - Node vote for a newly listed asset */ + TYPE_ASSET_LISTED = 8, + /** TYPE_LIMITS_UPDATED - Node vote for an asset limits update */ + TYPE_LIMITS_UPDATED = 9, + /** TYPE_STAKE_TOTAL_SUPPLY - Node vote to share the total supply of the staking token */ + TYPE_STAKE_TOTAL_SUPPLY = 10, + /** TYPE_SIGNER_THRESHOLD_SET - Node vote to update the threshold of the signer set for the multisig contract */ + TYPE_SIGNER_THRESHOLD_SET = 11, + /** TYPE_GOVERNANCE_VALIDATE_ASSET - Node vote to validate a new assert governance proposal */ + TYPE_GOVERNANCE_VALIDATE_ASSET = 12, + UNRECOGNIZED = -1, +} + +/** Represents a signature from a validator, to be used by a foreign chain in order to recognise a decision taken by the Vega network */ +export interface NodeSignature { + /** ID of the resource being signed. */ + id: string; + /** The signature generated by the signer. */ + sig: Uint8Array; + /** Kind of resource being signed. */ + kind: NodeSignatureKind; +} + +/** Event forwarded to the Vega network to provide information on events happening on other networks */ +export interface ChainEvent { + /** Transaction ID of the transaction in which the events happened, usually a hash. */ + txId: string; + /** Arbitrary one-time integer used to prevent replay attacks. */ + nonce: number; + /** Built-in asset event. */ + builtin?: + | BuiltinAssetEvent + | undefined; + /** Ethereum ERC20 event. */ + erc20?: + | ERC20Event + | undefined; + /** Ethereum Staking event. */ + stakingEvent?: + | StakingEvent + | undefined; + /** Ethereum ERC20 multisig event. */ + erc20Multisig?: + | ERC20MultiSigEvent + | undefined; + /** Arbitrary contract call */ + contractCall?: EthContractCallEvent | undefined; +} + +/** Transaction to allow a validator to rotate their Vega keys */ +export interface KeyRotateSubmission { + /** New Vega public key derivation index. */ + newPubKeyIndex: number; + /** Target block at which the key rotation will take effect on. */ + targetBlock: number; + /** New public key to rotate to. */ + newPubKey: string; + /** Hash of currently used public key. */ + currentPubKeyHash: string; +} + +/** Transaction to allow a validator to rotate their ethereum keys */ +export interface EthereumKeyRotateSubmission { + /** Target block at which the key rotation will take effect on. */ + targetBlock: number; + /** New address to rotate to. */ + newAddress: string; + /** Currently used public address. */ + currentAddress: string; + /** Ethereum public key to use as a submitter to allow automatic signature generation. */ + submitterAddress: string; + /** Signature that can be verified using the new ethereum address. */ + ethereumSignature: Signature | undefined; +} + +/** Transaction for a validator to submit a floating point value */ +export interface StateVariableProposal { + /** State value proposal details. */ + proposal: StateValueProposal | undefined; +} + +/** Transaction for a validator to suggest a protocol upgrade */ +export interface ProtocolUpgradeProposal { + /** Block height at which to perform the upgrade. */ + upgradeBlockHeight: number; + /** Release tag for the Vega binary. */ + vegaReleaseTag: string; +} diff --git a/libs/wallet/src/__generated__/vega/data/v1/data.ts b/libs/wallet/src/__generated__/vega/data/v1/data.ts new file mode 100644 index 000000000..75061f439 --- /dev/null +++ b/libs/wallet/src/__generated__/vega/data/v1/data.ts @@ -0,0 +1,60 @@ +/* eslint-disable */ + +export const protobufPackage = "vega.data.v1"; + +export interface ETHAddress { + address: string; +} + +/** + * PubKey is the public key that signed this data. + * Different public keys coming from different sources will be further separated. + */ +export interface PubKey { + key: string; +} + +export interface Signer { + /** + * List of authorized public keys that signed the data for this + * source. All the public keys in the data should be contained in these + * public keys. + */ + pubKey?: + | PubKey + | undefined; + /** In case of an open oracle - Ethereum address will be submitted. */ + ethAddress?: ETHAddress | undefined; +} + +/** Property describes one property of data spec with a key with its value. */ +export interface Property { + /** Name of the property. */ + name: string; + /** Value of the property. */ + value: string; +} + +/** + * Data describes valid source data that has been received by the node. + * It represents both matched and unmatched data. + */ +export interface Data { + signers: Signer[]; + /** Data holds all the properties of the data */ + data: Property[]; + /** + * `matched_specs_ids` lists all the specs that matched this data. + * When the array is empty, it means no spec matched this data. + */ + matchedSpecIds: string[]; + /** + * Timestamp in Unix nanoseconds for when the data was broadcast to the markets + * with a matching spec. It has no value when the data did not match any spec. + */ + broadcastAt: number; +} + +export interface ExternalData { + data: Data | undefined; +} diff --git a/libs/wallet/src/__generated__/vega/data/v1/spec.ts b/libs/wallet/src/__generated__/vega/data/v1/spec.ts new file mode 100644 index 000000000..093408304 --- /dev/null +++ b/libs/wallet/src/__generated__/vega/data/v1/spec.ts @@ -0,0 +1,85 @@ +/* eslint-disable */ + +export const protobufPackage = "vega.data.v1"; + +/** + * Filter describes the conditions under which a data source data is considered of + * interest or not. + */ +export interface Filter { + /** Data source's data property key targeted by the filter. */ + key: + | PropertyKey + | undefined; + /** + * Conditions that should be matched by the data to be + * considered of interest. + */ + conditions: Condition[]; +} + +/** PropertyKey describes the property key contained in data source data. */ +export interface PropertyKey { + /** Name of the property. */ + name: string; + /** Data type of the property. */ + type: PropertyKey_Type; + /** + * Optional decimal place to be be applied on the provided value + * valid only for PropertyType of type DECIMAL and INTEGER + */ + numberDecimalPlaces?: number | undefined; +} + +/** + * Type describes the data type of properties that are supported by the data source + * engine. + */ +export enum PropertyKey_Type { + /** TYPE_UNSPECIFIED - The default value. */ + TYPE_UNSPECIFIED = 0, + /** TYPE_EMPTY - Any type. */ + TYPE_EMPTY = 1, + /** TYPE_INTEGER - Integer type. */ + TYPE_INTEGER = 2, + /** TYPE_STRING - String type. */ + TYPE_STRING = 3, + /** TYPE_BOOLEAN - Boolean type. */ + TYPE_BOOLEAN = 4, + /** TYPE_DECIMAL - Any floating point decimal type. */ + TYPE_DECIMAL = 5, + /** TYPE_TIMESTAMP - Timestamp date type. */ + TYPE_TIMESTAMP = 6, + UNRECOGNIZED = -1, +} + +/** Condition describes the condition that must be validated by the network */ +export interface Condition { + /** Type of comparison to make on the value. */ + operator: Condition_Operator; + /** Value to be compared with by the operator. */ + value: string; +} + +/** Operator describes the type of comparison. */ +export enum Condition_Operator { + /** OPERATOR_UNSPECIFIED - The default value */ + OPERATOR_UNSPECIFIED = 0, + /** OPERATOR_EQUALS - Verify if the property values are strictly equal or not. */ + OPERATOR_EQUALS = 1, + /** OPERATOR_GREATER_THAN - Verify if the data source data value is greater than the Condition value. */ + OPERATOR_GREATER_THAN = 2, + /** + * OPERATOR_GREATER_THAN_OR_EQUAL - Verify if the data source data value is greater than or equal to the Condition + * value. + */ + OPERATOR_GREATER_THAN_OR_EQUAL = 3, + /** OPERATOR_LESS_THAN - Verify if the data source data value is less than the Condition value. */ + OPERATOR_LESS_THAN = 4, + /** + * OPERATOR_LESS_THAN_OR_EQUAL - Verify if the data source data value is less or equal to than the Condition + * value. + */ + OPERATOR_LESS_THAN_OR_EQUAL = 5, + UNRECOGNIZED = -1, +} diff --git a/libs/wallet/src/__generated__/vega/data_source.ts b/libs/wallet/src/__generated__/vega/data_source.ts new file mode 100644 index 000000000..89654fe1e --- /dev/null +++ b/libs/wallet/src/__generated__/vega/data_source.ts @@ -0,0 +1,131 @@ +/* eslint-disable */ +import type { Signer } from "./data/v1/data"; +import type { Condition, Filter } from "./data/v1/spec"; + +export const protobufPackage = "vega"; + +/** + * DataSourceDefinition represents the top level object that deals with data sources. + * DataSourceDefinition can be external or internal, with whatever number of data sources are defined + * for each type in the child objects below. + */ +export interface DataSourceDefinition { + internal?: DataSourceDefinitionInternal | undefined; + external?: DataSourceDefinitionExternal | undefined; +} + +/** DataSourceSpecConfigurationTime is the internal data source used for emitting timestamps. */ +export interface DataSourceSpecConfigurationTime { + /** Conditions that the timestamps should meet in order to be considered. */ + conditions: Condition[]; +} + +/** + * DataSourceDefinitionInternal is the top level object used for all internal data sources. + * It contains one of any of the defined `SourceType` variants. + */ +export interface DataSourceDefinitionInternal { + time?: DataSourceSpecConfigurationTime | undefined; +} + +/** + * DataSourceDefinitionExternal is the top level object used for all external data sources. + * It contains one of any of the defined `SourceType` variants. + */ +export interface DataSourceDefinitionExternal { + oracle?: DataSourceSpecConfiguration | undefined; + ethCall?: EthCallSpec | undefined; +} + +/** + * All types of external data sources use the same configuration set for meeting requirements + * in order for the data to be useful for Vega - valid signatures and matching filters. + */ +export interface DataSourceSpecConfiguration { + /** + * Signers is the list of authorized signatures that signed the data for this + * source. All the signatures in the data source data should be contained in this + * external source. All the signatures in the data should be contained in this list. + */ + signers: Signer[]; + /** + * Filters describes which source data are considered of interest or not for + * the product (or the risk model). + */ + filters: Filter[]; +} + +/** Specifies a data source that derives its content from calling a read method on an Ethereum contract. */ +export interface EthCallSpec { + /** Ethereum address of the contract to call. */ + address: string; + /** The ABI of that contract. */ + abi: + | Array + | undefined; + /** Name of the method on the contract to call. */ + method: string; + /** + * List of arguments to pass to method call. + * Protobuf 'Value' wraps an arbitrary JSON type that is mapped to an Ethereum type according to the ABI. + */ + args: any[]; + /** Conditions for determining when to call the contract method. */ + trigger: EthCallTrigger | undefined; +} + +/** Determines when the contract method should be called. */ +export interface EthCallTrigger { + timeTrigger?: EthTimeTrigger | undefined; +} + +/** Trigger for an Ethereum call based on the Ethereum block timestamp. Can be one-off or repeating. */ +export interface EthTimeTrigger { + /** Trigger when the Ethereum time is greater or equal to this time, in Unix seconds. */ + initial?: + | number + | undefined; + /** Repeat the call every n seconds after the inital call. If no time for initial call was specified, begin repeating immediately. */ + every?: + | number + | undefined; + /** If repeating, stop once Ethereum time is greater than this time, in Unix seconds. If not set, then repeat indefinitely. */ + until?: number | undefined; +} + +/** + * Data source spec describes the data source base that a product or a risk model + * wants to get from the data source engine. + * This message contains additional information used by the API. + */ +export interface DataSourceSpec { + /** Hash generated from the DataSpec data. */ + id: string; + /** Creation date and time */ + createdAt: number; + /** Last Updated timestamp */ + updatedAt: number; + data: + | DataSourceDefinition + | undefined; + /** Status describes the status of the data source spec */ + status: DataSourceSpec_Status; +} + +/** Status describe the status of the data source spec */ +export enum DataSourceSpec_Status { + /** STATUS_UNSPECIFIED - Default value. */ + STATUS_UNSPECIFIED = 0, + /** STATUS_ACTIVE - STATUS_ACTIVE describes an active data source spec. */ + STATUS_ACTIVE = 1, + /** + * STATUS_DEACTIVATED - STATUS_DEACTIVATED describes an data source spec that is not listening to data + * anymore. + */ + STATUS_DEACTIVATED = 2, + UNRECOGNIZED = -1, +} + +export interface ExternalDataSourceSpec { + spec: DataSourceSpec | undefined; +} diff --git a/libs/wallet/src/__generated__/vega/governance.ts b/libs/wallet/src/__generated__/vega/governance.ts new file mode 100644 index 000000000..68ceaeabe --- /dev/null +++ b/libs/wallet/src/__generated__/vega/governance.ts @@ -0,0 +1,642 @@ +/* eslint-disable */ +import type { AssetDetails, AssetDetailsUpdate } from "./assets"; +import type { DataSourceDefinition } from "./data_source"; +import type { + DataSourceSpecToFutureBinding, + LiquidityMonitoringParameters, + LogNormalRiskModel, + PriceMonitoringParameters, + SimpleModelParams, + TargetStakeParameters, +} from "./markets"; +import type { AccountType, NetworkParameter } from "./vega"; + +export const protobufPackage = "vega"; + +/** List of possible errors that can cause a proposal to be in state rejected or failed */ +export enum ProposalError { + /** PROPOSAL_ERROR_UNSPECIFIED - Default value */ + PROPOSAL_ERROR_UNSPECIFIED = 0, + /** PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON - Specified close time is too early based on network parameters */ + PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 1, + /** PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE - Specified close time is too late based on network parameters */ + PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 2, + /** PROPOSAL_ERROR_ENACT_TIME_TOO_SOON - Specified enactment time is too early based on network parameters */ + PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 3, + /** PROPOSAL_ERROR_ENACT_TIME_TOO_LATE - Specified enactment time is too late based on network parameters */ + PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = 4, + /** PROPOSAL_ERROR_INSUFFICIENT_TOKENS - Proposer for this proposal has insufficient tokens */ + PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 5, + /** PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY - Instrument quote name and base name were the same */ + PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 6, + /** PROPOSAL_ERROR_NO_PRODUCT - Proposal has no product */ + PROPOSAL_ERROR_NO_PRODUCT = 7, + /** PROPOSAL_ERROR_UNSUPPORTED_PRODUCT - Specified product is not supported */ + PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 8, + /** PROPOSAL_ERROR_NO_TRADING_MODE - Proposal has no trading mode */ + PROPOSAL_ERROR_NO_TRADING_MODE = 11, + /** PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE - Proposal has an unsupported trading mode */ + PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 12, + /** PROPOSAL_ERROR_NODE_VALIDATION_FAILED - Proposal failed node validation */ + PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 13, + /** PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD - Field is missing in a builtin asset source */ + PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 14, + /** PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS - Contract address is missing in the ERC20 asset source */ + PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 15, + /** PROPOSAL_ERROR_INVALID_ASSET - Asset ID is invalid or does not exist on the Vega network */ + PROPOSAL_ERROR_INVALID_ASSET = 16, + /** PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS - Proposal terms timestamps are not compatible (Validation < Closing < Enactment) */ + PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 17, + /** PROPOSAL_ERROR_NO_RISK_PARAMETERS - No risk parameters were specified */ + PROPOSAL_ERROR_NO_RISK_PARAMETERS = 18, + /** PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY - Invalid key in update network parameter proposal */ + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 19, + /** PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE - Invalid value in update network parameter proposal */ + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 20, + /** PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED - Validation failed for network parameter proposal */ + PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 21, + /** PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL - Opening auction duration is less than the network minimum opening auction time */ + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 22, + /** PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE - Opening auction duration is more than the network minimum opening auction time */ + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = 23, + /** PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET - Market proposal market could not be instantiated in execution */ + PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 25, + /** PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT - Market proposal market contained invalid product definition */ + PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 26, + /** PROPOSAL_ERROR_INVALID_RISK_PARAMETER - Market proposal has invalid risk parameter */ + PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 30, + /** PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED - Proposal was declined because vote didn't reach the majority threshold required */ + PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 31, + /** PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED - Proposal declined because the participation threshold was not reached */ + PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 32, + /** PROPOSAL_ERROR_INVALID_ASSET_DETAILS - Asset proposal has invalid asset details */ + PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 33, + /** PROPOSAL_ERROR_UNKNOWN_TYPE - Proposal is an unknown type */ + PROPOSAL_ERROR_UNKNOWN_TYPE = 34, + /** PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE - Proposal has an unknown risk parameter type */ + PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = 35, + /** PROPOSAL_ERROR_INVALID_FREEFORM - Validation failed for freeform proposal */ + PROPOSAL_ERROR_INVALID_FREEFORM = 36, + /** + * PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE - Party doesn't have enough equity-like share to propose an update on the market + * targeted by the proposal + */ + PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 37, + /** PROPOSAL_ERROR_INVALID_MARKET - Market targeted by the proposal does not exist or is not eligible for modification */ + PROPOSAL_ERROR_INVALID_MARKET = 38, + /** PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES - Market proposal decimal place is higher than the market settlement asset decimal places */ + PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = 39, + /** PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS - Market proposal contains too many price monitoring triggers */ + PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 40, + /** PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE - Market proposal contains too many price monitoring triggers */ + PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE = 41, + /** PROPOSAL_ERROR_LP_PRICE_RANGE_NONPOSITIVE - LP price range must be larger than 0 */ + PROPOSAL_ERROR_LP_PRICE_RANGE_NONPOSITIVE = 42, + /** PROPOSAL_ERROR_LP_PRICE_RANGE_TOO_LARGE - LP price range must not be larger than 100 */ + PROPOSAL_ERROR_LP_PRICE_RANGE_TOO_LARGE = 43, + /** PROPOSAL_ERROR_LINEAR_SLIPPAGE_FACTOR_OUT_OF_RANGE - Linear slippage factor is out of range, either negative or too large */ + PROPOSAL_ERROR_LINEAR_SLIPPAGE_FACTOR_OUT_OF_RANGE = 44, + /** PROPOSAL_ERROR_QUADRATIC_SLIPPAGE_FACTOR_OUT_OF_RANGE - Quadratic slippage factor is out of range, either negative or too large */ + PROPOSAL_ERROR_QUADRATIC_SLIPPAGE_FACTOR_OUT_OF_RANGE = 45, + /** PROPOSAL_ERROR_INVALID_SPOT - Validation failed for spot proposal */ + PROPOSAL_ERROR_INVALID_SPOT = 46, + /** PROPOSAL_ERROR_SPOT_PRODUCT_DISABLED - Spot trading not enabled */ + PROPOSAL_ERROR_SPOT_PRODUCT_DISABLED = 47, + /** PROPOSAL_ERROR_INVALID_SUCCESSOR_MARKET - Market proposal is invalid, either invalid insurance pool fraction, or it specifies a parent market that it can't succeed. */ + PROPOSAL_ERROR_INVALID_SUCCESSOR_MARKET = 48, + /** PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_FAILED - Governance transfer proposal is invalid */ + PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_FAILED = 49, + /** PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_INVALID - Governance transfer proposal failed */ + PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_INVALID = 50, + /** PROPOSAL_ERROR_GOVERNANCE_CANCEL_TRANSFER_PROPOSAL_INVALID - Proposal for cancelling transfer is invalid, check proposal ID */ + PROPOSAL_ERROR_GOVERNANCE_CANCEL_TRANSFER_PROPOSAL_INVALID = 51, + UNRECOGNIZED = -1, +} + +export enum GovernanceTransferType { + GOVERNANCE_TRANSFER_TYPE_UNSPECIFIED = 0, + GOVERNANCE_TRANSFER_TYPE_ALL_OR_NOTHING = 1, + GOVERNANCE_TRANSFER_TYPE_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +/** Spot product configuration */ +export interface SpotProduct { + /** Base asset ID. */ + baseAsset: string; + /** Quote asset ID. */ + quoteAsset: string; + /** Product name. */ + name: string; +} + +/** Future product configuration */ +export interface FutureProduct { + /** Asset ID for the product's settlement asset. */ + settlementAsset: string; + /** Product quote name. */ + quoteName: string; + /** Data source spec describing the data source for settlement. */ + dataSourceSpecForSettlementData: + | DataSourceDefinition + | undefined; + /** The external data source spec describing the data source of trading termination. */ + dataSourceSpecForTradingTermination: + | DataSourceDefinition + | undefined; + /** Binding between the data source spec and the settlement data. */ + dataSourceSpecBinding: DataSourceSpecToFutureBinding | undefined; +} + +/** Instrument configuration */ +export interface InstrumentConfiguration { + /** Instrument name. */ + name: string; + /** Instrument code, human-readable shortcode used to describe the instrument. */ + code: string; + /** Future. */ + future?: + | FutureProduct + | undefined; + /** Spot. */ + spot?: SpotProduct | undefined; +} + +/** Configuration for a new spot market on Vega */ +export interface NewSpotMarketConfiguration { + /** New spot market instrument configuration. */ + instrument: + | InstrumentConfiguration + | undefined; + /** Decimal places used for the new spot market, sets the smallest price increment on the book. */ + decimalPlaces: number; + /** Optional new spot market metadata, tags. */ + metadata: string[]; + /** Price monitoring parameters. */ + priceMonitoringParameters: + | PriceMonitoringParameters + | undefined; + /** Specifies parameters related to target stake calculation. */ + targetStakeParameters: + | TargetStakeParameters + | undefined; + /** Simple risk model parameters, valid only if MODEL_SIMPLE is selected. */ + simple?: + | SimpleModelParams + | undefined; + /** Log normal risk model parameters, valid only if MODEL_LOG_NORMAL is selected. */ + logNormal?: + | LogNormalRiskModel + | undefined; + /** Decimal places for order sizes, sets what size the smallest order / position on the spot market can be. */ + positionDecimalPlaces: number; +} + +/** Configuration for a new futures market on Vega */ +export interface NewMarketConfiguration { + /** New futures market instrument configuration. */ + instrument: + | InstrumentConfiguration + | undefined; + /** Decimal places used for the new futures market, sets the smallest price increment on the book. */ + decimalPlaces: number; + /** Optional new futures market metadata, tags. */ + metadata: string[]; + /** Price monitoring parameters. */ + priceMonitoringParameters: + | PriceMonitoringParameters + | undefined; + /** Liquidity monitoring parameters. */ + liquidityMonitoringParameters: + | LiquidityMonitoringParameters + | undefined; + /** Simple risk model parameters, valid only if MODEL_SIMPLE is selected. */ + simple?: + | SimpleModelParams + | undefined; + /** Log normal risk model parameters, valid only if MODEL_LOG_NORMAL is selected. */ + logNormal?: + | LogNormalRiskModel + | undefined; + /** Decimal places for order sizes, sets what size the smallest order / position on the futures market can be. */ + positionDecimalPlaces: number; + /** + * Percentage move up and down from the mid price which specifies the range of + * price levels over which automated liquidity provision orders will be deployed. + */ + lpPriceRange: string; + /** Linear slippage factor is used to cap the slippage component of maintenance margin - it is applied to the slippage volume. */ + linearSlippageFactor: string; + /** Quadratic slippage factor is used to cap the slippage component of maintenance margin - it is applied to the square of the slippage volume. */ + quadraticSlippageFactor: string; + /** Successor configuration. If this proposal is meant to succeed a given market, then this should be set. */ + successor?: SuccessorConfiguration | undefined; +} + +/** New spot market on Vega */ +export interface NewSpotMarket { + /** Configuration of the new spot market. */ + changes: NewSpotMarketConfiguration | undefined; +} + +/** Configuration required to turn a new market proposal in to a successor market proposal. */ +export interface SuccessorConfiguration { + /** ID of the market that the successor should take over from. */ + parentMarketId: string; + /** A decimal value between or equal to 0 and 1, specifying the fraction of the insurance pool balance that is carried over from the parent market to the successor. */ + insurancePoolFraction: string; +} + +/** New market on Vega */ +export interface NewMarket { + /** Configuration of the new market. */ + changes: NewMarketConfiguration | undefined; +} + +/** Update an existing market on Vega */ +export interface UpdateMarket { + /** Market ID the update is for. */ + marketId: string; + /** Updated configuration of the futures market. */ + changes: UpdateMarketConfiguration | undefined; +} + +/** Update an existing spot market on Vega */ +export interface UpdateSpotMarket { + /** Market ID the update is for. */ + marketId: string; + /** Updated configuration of the spot market. */ + changes: UpdateSpotMarketConfiguration | undefined; +} + +/** Configuration to update a futures market on Vega */ +export interface UpdateMarketConfiguration { + /** Updated futures market instrument configuration. */ + instrument: + | UpdateInstrumentConfiguration + | undefined; + /** Optional futures market metadata, tags. */ + metadata: string[]; + /** Price monitoring parameters. */ + priceMonitoringParameters: + | PriceMonitoringParameters + | undefined; + /** Liquidity monitoring parameters. */ + liquidityMonitoringParameters: + | LiquidityMonitoringParameters + | undefined; + /** Simple risk model parameters, valid only if MODEL_SIMPLE is selected. */ + simple?: + | SimpleModelParams + | undefined; + /** Log normal risk model parameters, valid only if MODEL_LOG_NORMAL is selected. */ + logNormal?: + | LogNormalRiskModel + | undefined; + /** + * Percentage move up and down from the mid price which specifies the range of + * price levels over which automated liquidity provision orders will be deployed. + */ + lpPriceRange: string; + /** Linear slippage factor is used to cap the slippage component of maintenance margin - it is applied to the slippage volume. */ + linearSlippageFactor: string; + /** Quadratic slippage factor is used to cap the slippage component of maintenance margin - it is applied to the square of the slippage volume. */ + quadraticSlippageFactor: string; +} + +/** Configuration to update a spot market on Vega */ +export interface UpdateSpotMarketConfiguration { + /** Optional spot market metadata, tags. */ + metadata: string[]; + /** Price monitoring parameters. */ + priceMonitoringParameters: + | PriceMonitoringParameters + | undefined; + /** Specifies parameters related to target stake calculation. */ + targetStakeParameters: + | TargetStakeParameters + | undefined; + /** Simple risk model parameters, valid only if MODEL_SIMPLE is selected. */ + simple?: + | SimpleModelParams + | undefined; + /** Log normal risk model parameters, valid only if MODEL_LOG_NORMAL is selected. */ + logNormal?: LogNormalRiskModel | undefined; +} + +/** Instrument configuration */ +export interface UpdateInstrumentConfiguration { + /** Instrument code, human-readable shortcode used to describe the instrument. */ + code: string; + /** Future. */ + future?: UpdateFutureProduct | undefined; +} + +/** Future product configuration */ +export interface UpdateFutureProduct { + /** Human-readable name/abbreviation of the quote name. */ + quoteName: string; + /** The data source spec describing the data of settlement data. */ + dataSourceSpecForSettlementData: + | DataSourceDefinition + | undefined; + /** The data source spec describing the data source for trading termination. */ + dataSourceSpecForTradingTermination: + | DataSourceDefinition + | undefined; + /** The binding between the data source spec and the settlement data. */ + dataSourceSpecBinding: DataSourceSpecToFutureBinding | undefined; +} + +/** Update network configuration on Vega */ +export interface UpdateNetworkParameter { + /** The network parameter to update. */ + changes: NetworkParameter | undefined; +} + +/** New asset on Vega */ +export interface NewAsset { + /** Configuration of the new asset. */ + changes: AssetDetails | undefined; +} + +/** Update an existing asset on Vega */ +export interface UpdateAsset { + /** Asset ID the update is for. */ + assetId: string; + /** Changes to apply on an existing asset. */ + changes: AssetDetailsUpdate | undefined; +} + +/** + * Freeform proposal + * This message is just used as a placeholder to sort out the nature of the + * proposal once parsed. + */ +export interface NewFreeform { +} + +/** Terms for a governance proposal on Vega */ +export interface ProposalTerms { + /** + * Timestamp as Unix time in seconds when voting closes for this proposal, + * constrained by `minClose` and `maxClose` network parameters. + */ + closingTimestamp: number; + /** + * Timestamp as Unix time in seconds when proposal gets enacted if passed, + * constrained by `minEnact` and `maxEnact` network parameters. + */ + enactmentTimestamp: number; + /** Validation timestamp as Unix time in seconds. */ + validationTimestamp: number; + /** Proposal change for modifying an existing futures market on Vega. */ + updateMarket?: + | UpdateMarket + | undefined; + /** Proposal change for creating new futures market on Vega. */ + newMarket?: + | NewMarket + | undefined; + /** Proposal change for updating Vega network parameters. */ + updateNetworkParameter?: + | UpdateNetworkParameter + | undefined; + /** Proposal change for creating new assets on Vega. */ + newAsset?: + | NewAsset + | undefined; + /** + * Proposal change for a freeform request, which can be voted on but does not change the behaviour of the system, + * and can be used to gauge community sentiment. + */ + newFreeform?: + | NewFreeform + | undefined; + /** Proposal change for updating an asset. */ + updateAsset?: + | UpdateAsset + | undefined; + /** Proposal change for creating new spot market on Vega. */ + newSpotMarket?: + | NewSpotMarket + | undefined; + /** Proposal change for modifying an existing spot market on Vega. */ + updateSpotMarket?: + | UpdateSpotMarket + | undefined; + /** Proposal change for a governance transfer. */ + newTransfer?: + | NewTransfer + | undefined; + /** Cancel a governance transfer. */ + cancelTransfer?: CancelTransfer | undefined; +} + +/** Rationale behind a proposal. */ +export interface ProposalRationale { + /** + * Description to show a short title / something in case the link goes offline. + * This is to be between 0 and 20k unicode characters. + * This is mandatory for all proposals. + */ + description: string; + /** + * Title to be used to give a short description of the proposal in lists. + * This is to be between 0 and 100 unicode characters. + * This is mandatory for all proposals. + */ + title: string; +} + +/** Governance data */ +export interface GovernanceData { + /** Governance proposal that is being voted on. */ + proposal: + | Proposal + | undefined; + /** All YES votes in favour of the proposal above. */ + yes: Vote[]; + /** All NO votes against the proposal above. */ + no: Vote[]; + /** + * All latest YES votes by party which is guaranteed to be unique, + * where key (string) is the party ID i.e. public key and + * value (Vote) is the vote cast by the given party. + */ + yesParty: { [key: string]: Vote }; + /** + * All latest NO votes by party which is guaranteed to be unique, + * where key (string) is the party ID i.e. public key and + * value (Vote) is the vote cast by the given party. + */ + noParty: { [key: string]: Vote }; +} + +export interface GovernanceData_YesPartyEntry { + key: string; + value: Vote | undefined; +} + +export interface GovernanceData_NoPartyEntry { + key: string; + value: Vote | undefined; +} + +/** Governance proposal */ +export interface Proposal { + /** Unique proposal ID. */ + id: string; + /** Proposal reference. */ + reference: string; + /** Party ID i.e. public key of the party submitting the proposal. */ + partyId: string; + /** Current state of the proposal, i.e. open, passed, failed etc. */ + state: Proposal_State; + /** Proposal timestamp for date and time as Unix time in nanoseconds when proposal was submitted to the network. */ + timestamp: number; + /** Proposal configuration and the actual change that is meant to be executed when proposal is enacted. */ + terms: + | ProposalTerms + | undefined; + /** Reason for the current state of the proposal, this may be set in case of REJECTED and FAILED statuses. */ + reason?: + | ProposalError + | undefined; + /** Detailed error associated to the reason. */ + errorDetails?: + | string + | undefined; + /** Rationale behind a proposal. */ + rationale: + | ProposalRationale + | undefined; + /** Required vote participation for this proposal. */ + requiredParticipation: string; + /** Required majority for this proposal. */ + requiredMajority: string; + /** Required participation from liquidity providers, optional but is required for market update proposal. */ + requiredLiquidityProviderParticipation?: + | string + | undefined; + /** Required majority from liquidity providers, optional but is required for market update proposal. */ + requiredLiquidityProviderMajority?: string | undefined; +} + +/** + * Proposal state transition: + * Open -> + * - Passed -> Enacted. + * - Passed -> Failed. + * - Declined + * Rejected + * Proposal can enter Failed state from any other state + */ +export enum Proposal_State { + /** STATE_UNSPECIFIED - Default value, always invalid */ + STATE_UNSPECIFIED = 0, + /** STATE_FAILED - Proposal enactment has failed - even though proposal has passed, its execution could not be performed */ + STATE_FAILED = 1, + /** STATE_OPEN - Proposal is open for voting */ + STATE_OPEN = 2, + /** STATE_PASSED - Proposal has gained enough support to be executed */ + STATE_PASSED = 3, + /** STATE_REJECTED - Proposal wasn't accepted i.e. proposal terms failed validation due to wrong configuration or failed to meet network requirements. */ + STATE_REJECTED = 4, + /** STATE_DECLINED - Proposal didn't get enough votes, e.g. either failed to gain required participation or majority level. */ + STATE_DECLINED = 5, + /** STATE_ENACTED - Proposal enacted */ + STATE_ENACTED = 6, + /** STATE_WAITING_FOR_NODE_VOTE - Waiting for node validation of the proposal */ + STATE_WAITING_FOR_NODE_VOTE = 7, + UNRECOGNIZED = -1, +} + +/** Governance vote */ +export interface Vote { + /** Voter's party ID. */ + partyId: string; + /** Which way the party voted. */ + value: Vote_Value; + /** Proposal ID being voted on. */ + proposalId: string; + /** Timestamp in Unix nanoseconds when the vote was acknowledged by the network. */ + timestamp: number; + /** Total number of governance token for the party that cast the vote. */ + totalGovernanceTokenBalance: string; + /** The weight of this vote based on the total number of governance tokens. */ + totalGovernanceTokenWeight: string; + /** The weight of the vote compared to the total amount of equity-like share on the market. */ + totalEquityLikeShareWeight: string; +} + +/** Vote value */ +export enum Vote_Value { + /** VALUE_UNSPECIFIED - Default value, always invalid */ + VALUE_UNSPECIFIED = 0, + /** VALUE_NO - Vote against the proposal */ + VALUE_NO = 1, + /** VALUE_YES - Vote in favour of the proposal */ + VALUE_YES = 2, + UNRECOGNIZED = -1, +} + +export interface CancelTransfer { + /** Configuration for cancellation of a governance-initiated transfer */ + changes: CancelTransferConfiguration | undefined; +} + +export interface CancelTransferConfiguration { + /** ID of the governance transfer proposal. */ + transferId: string; +} + +/** New governance transfer */ +export interface NewTransfer { + /** Configuration for a new transfer. */ + changes: NewTransferConfiguration | undefined; +} + +export interface NewTransferConfiguration { + /** Source account type, such as network treasury, market insurance pool */ + sourceType: AccountType; + /** If network treasury, field is empty, otherwise uses the market ID */ + source: string; + /** + * "All or nothing" or "best effort": + * All or nothing: Transfers the specified amount or does not transfer anything + * Best effort: Transfers the specified amount or the max allowable amount if this is less than the specified amount + */ + transferType: GovernanceTransferType; + /** Maximum amount to transfer */ + amount: string; + /** ID of asset to transfer */ + asset: string; + /** Maximum fraction of the source account's balance to transfer as a decimal - i.e. 0.1 = 10% of the balance */ + fractionOfBalance: string; + /** Specifies the account type to transfer to: reward pool, party, network insurance pool, market insurance pool */ + destinationType: AccountType; + /** + * Specifies the account to transfer to, depending on the account type: + * Network treasury: leave empty + * Party: party's public key + * Market insurance pool: market ID + */ + destination: string; + oneOff?: OneOffTransfer | undefined; + recurring?: RecurringTransfer | undefined; +} + +/** Specific details for a one off transfer */ +export interface OneOffTransfer { + /** Timestamp in Unix nanoseconds for when the transfer should be delivered into the receiver's account. */ + deliverOn: number; +} + +/** Specific details for a recurring transfer */ +export interface RecurringTransfer { + /** First epoch from which this transfer shall be paid. */ + startEpoch: number; + /** Last epoch at which this transfer shall be paid. */ + endEpoch?: number | undefined; +} diff --git a/libs/wallet/src/__generated__/vega/markets.ts b/libs/wallet/src/__generated__/vega/markets.ts new file mode 100644 index 000000000..e1b35afe0 --- /dev/null +++ b/libs/wallet/src/__generated__/vega/markets.ts @@ -0,0 +1,361 @@ +/* eslint-disable */ +import type { DataSourceSpec } from "./data_source"; + +export const protobufPackage = "vega"; + +/** + * Auction duration is used to configure 3 auction periods: + * 1. `duration > 0`, `volume == 0`: + * The auction will last for at least N seconds + * 2. `duration == 0`, `volume > 0`: + * The auction will end once the given volume will match at uncrossing + * 3. `duration > 0`, `volume > 0`: + * The auction will take at least N seconds, but can end sooner if the market can trade a certain volume + */ +export interface AuctionDuration { + /** Duration of the auction in seconds. */ + duration: number; + /** Target uncrossing trading volume. */ + volume: number; +} + +/** Spot product definition */ +export interface Spot { + /** Asset ID of the underlying base asset for the spot product. */ + baseAsset: string; + /** Asset ID of the underlying quote asset for the spot product. */ + quoteAsset: string; + /** Name of the instrument. */ + name: string; +} + +/** Future product definition */ +export interface Future { + /** Underlying asset for the future. */ + settlementAsset: string; + /** Quote name of the instrument. */ + quoteName: string; + /** Data source specification that describes the settlement data source filter. */ + dataSourceSpecForSettlementData: + | DataSourceSpec + | undefined; + /** Data source specification that describes the trading termination data source filter. */ + dataSourceSpecForTradingTermination: + | DataSourceSpec + | undefined; + /** Binding between the data spec and the data source. */ + dataSourceSpecBinding: DataSourceSpecToFutureBinding | undefined; +} + +/** + * DataSourceSpecToFutureBinding describes which property of the data source data is to be + * used as settlement data and which to use as the trading terminated trigger + */ +export interface DataSourceSpecToFutureBinding { + /** + * Name of the property in the source data that should be used as settlement data. + * If it is set to "prices.BTC.value", then the Future will use the value of + * this property as settlement data. + */ + settlementDataProperty: string; + /** Name of the property in the data source data that signals termination of trading. */ + tradingTerminationProperty: string; +} + +/** Instrument metadata definition */ +export interface InstrumentMetadata { + /** List of 0 or more tags. */ + tags: string[]; +} + +/** Instrument definition */ +export interface Instrument { + /** Unique instrument ID. */ + id: string; + /** Code for the instrument. */ + code: string; + /** Name of the instrument. */ + name: string; + /** Collection of instrument meta-data. */ + metadata: + | InstrumentMetadata + | undefined; + /** Future. */ + future?: + | Future + | undefined; + /** Spot. */ + spot?: Spot | undefined; +} + +/** Risk model for log normal */ +export interface LogNormalRiskModel { + /** Risk Aversion Parameter. */ + riskAversionParameter: number; + /** + * Tau parameter of the risk model, projection horizon measured as a year fraction used in the expected shortfall + * calculation to obtain the maintenance margin, must be a strictly non-negative real number. + */ + tau: number; + /** Risk model parameters for log normal. */ + params: LogNormalModelParams | undefined; +} + +/** Risk model parameters for log normal */ +export interface LogNormalModelParams { + /** Mu parameter, annualised growth rate of the underlying asset. */ + mu: number; + /** R parameter, annualised growth rate of the risk-free asset, used for discounting of future cash flows, can be any real number. */ + r: number; + /** Sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number. */ + sigma: number; +} + +/** Risk model for simple modelling */ +export interface SimpleRiskModel { + /** Risk model params for simple modelling. */ + params: SimpleModelParams | undefined; +} + +/** Risk model parameters for simple modelling */ +export interface SimpleModelParams { + /** Pre-defined risk factor value for long. */ + factorLong: number; + /** Pre-defined risk factor value for short. */ + factorShort: number; + /** Pre-defined maximum price move up that the model considers as valid. */ + maxMoveUp: number; + /** Pre-defined minimum price move down that the model considers as valid. */ + minMoveDown: number; + /** Pre-defined constant probability of trading. */ + probabilityOfTrading: number; +} + +/** Scaling Factors (for use in margin calculation) */ +export interface ScalingFactors { + /** + * Collateral search level. If collateral dips below this value, + * the system will search for collateral to release. + */ + searchLevel: number; + /** + * Initial margin level. This is the minimum amount of collateral + * required to open a position in a market that requires margin. + */ + initialMargin: number; + /** + * Collateral release level. If a trader has collateral above this level, + * the system will release collateral to a trader's general collateral account + * for the asset. + */ + collateralRelease: number; +} + +/** Margin Calculator definition */ +export interface MarginCalculator { + /** Scaling factors for margin calculation. */ + scalingFactors: ScalingFactors | undefined; +} + +/** Tradable Instrument definition */ +export interface TradableInstrument { + /** Details for the underlying instrument. */ + instrument: + | Instrument + | undefined; + /** Margin calculator for the instrument. */ + marginCalculator: + | MarginCalculator + | undefined; + /** Log normal. */ + logNormalRiskModel?: + | LogNormalRiskModel + | undefined; + /** Simple. */ + simpleRiskModel?: SimpleRiskModel | undefined; +} + +/** Fee factors definition */ +export interface FeeFactors { + /** Market maker fee charged network wide. */ + makerFee: string; + /** Infrastructure fee charged network wide for staking and governance. */ + infrastructureFee: string; + /** Liquidity fee applied per market for market making. */ + liquidityFee: string; +} + +/** Fees definition */ +export interface Fees { + /** Fee factors. */ + factors: FeeFactors | undefined; +} + +/** PriceMonitoringTrigger holds together price projection horizon τ, probability level p, and auction extension duration */ +export interface PriceMonitoringTrigger { + /** Price monitoring projection horizon τ in seconds. */ + horizon: number; + /** Price monitoring probability level p. */ + probability: string; + /** + * Price monitoring auction extension duration in seconds should the price + * breach its theoretical level over the specified horizon at the specified + * probability level. + */ + auctionExtension: number; +} + +/** PriceMonitoringParameters contains a collection of triggers to be used for a given market */ +export interface PriceMonitoringParameters { + triggers: PriceMonitoringTrigger[]; +} + +/** PriceMonitoringSettings contains the settings for price monitoring */ +export interface PriceMonitoringSettings { + /** Specifies price monitoring parameters to be used for price monitoring purposes. */ + parameters: PriceMonitoringParameters | undefined; +} + +/** LiquidityMonitoringParameters contains settings used for liquidity monitoring */ +export interface LiquidityMonitoringParameters { + /** Specifies parameters related to target stake calculation. */ + targetStakeParameters: + | TargetStakeParameters + | undefined; + /** Specifies the triggering ratio for entering liquidity auction. */ + triggeringRatio: string; + /** Specifies by how many seconds an auction should be extended if leaving the auction were to trigger a liquidity auction. */ + auctionExtension: number; +} + +/** TargetStakeParameters contains parameters used in target stake calculation */ +export interface TargetStakeParameters { + /** Specifies length of time window expressed in seconds for target stake calculation. */ + timeWindow: number; + /** Specifies scaling factors used in target stake calculation. */ + scalingFactor: number; +} + +/** Market definition */ +export interface Market { + /** Unique ID for the market. */ + id: string; + /** Tradable instrument configuration. */ + tradableInstrument: + | TradableInstrument + | undefined; + /** + * Number of decimal places that a price must be shifted by in order to get a + * correct price denominated in the currency of the market, for example: + * `realPrice = price / 10^decimalPlaces`. + */ + decimalPlaces: number; + /** Fees configuration that apply to the market. */ + fees: + | Fees + | undefined; + /** + * Auction duration specifies how long the opening auction will run (minimum + * duration and optionally a minimum traded volume). + */ + openingAuction: + | AuctionDuration + | undefined; + /** PriceMonitoringSettings for the market. */ + priceMonitoringSettings: + | PriceMonitoringSettings + | undefined; + /** LiquidityMonitoringParameters for the market. */ + liquidityMonitoringParameters: + | LiquidityMonitoringParameters + | undefined; + /** Current mode of execution of the market. */ + tradingMode: Market_TradingMode; + /** Current state of the market. */ + state: Market_State; + /** Timestamps for when the market state changes. */ + marketTimestamps: + | MarketTimestamps + | undefined; + /** The number of decimal places for a position. */ + positionDecimalPlaces: number; + /** + * Percentage move up and down from the mid price which specifies the range of + * price levels over which automated liquidity provision orders will be deployed. + */ + lpPriceRange: string; + /** Linear slippage factor is used to cap the slippage component of maintenance margin - it is applied to the slippage volume. */ + linearSlippageFactor: string; + /** Quadratic slippage factor is used to cap the slippage component of maintenance margin - it is applied to the square of the slippage volume. */ + quadraticSlippageFactor: string; + /** ID of the market this market succeeds */ + parentMarketId?: + | string + | undefined; + /** The fraction of the parent market's insurance pool that this market inherits; range 0 through 1. */ + insurancePoolFraction?: + | string + | undefined; + /** ID of the market that succeeds this market if it exists. This will be populated by the system when the successor market is enabled. */ + successorMarketId?: string | undefined; +} + +/** Current state of the market */ +export enum Market_State { + /** STATE_UNSPECIFIED - Default value, invalid */ + STATE_UNSPECIFIED = 0, + /** STATE_PROPOSED - Governance proposal valid and accepted */ + STATE_PROPOSED = 1, + /** STATE_REJECTED - Outcome of governance votes is to reject the market */ + STATE_REJECTED = 2, + /** STATE_PENDING - Governance vote passes/wins */ + STATE_PENDING = 3, + /** + * STATE_CANCELLED - Market triggers cancellation condition or governance + * votes to close before market becomes Active + */ + STATE_CANCELLED = 4, + /** STATE_ACTIVE - Enactment date reached and usual auction exit checks pass */ + STATE_ACTIVE = 5, + /** STATE_SUSPENDED - Price monitoring or liquidity monitoring trigger */ + STATE_SUSPENDED = 6, + /** STATE_CLOSED - Governance vote to close (Not currently implemented) */ + STATE_CLOSED = 7, + /** + * STATE_TRADING_TERMINATED - Defined by the product (i.e. from a product parameter, + * specified in market definition, giving close date/time) + */ + STATE_TRADING_TERMINATED = 8, + /** STATE_SETTLED - Settlement triggered and completed as defined by product */ + STATE_SETTLED = 9, + UNRECOGNIZED = -1, +} + +/** Trading mode the market is currently running, also referred to as 'market state' */ +export enum Market_TradingMode { + /** TRADING_MODE_UNSPECIFIED - Default value, this is invalid */ + TRADING_MODE_UNSPECIFIED = 0, + /** TRADING_MODE_CONTINUOUS - Normal trading */ + TRADING_MODE_CONTINUOUS = 1, + /** TRADING_MODE_BATCH_AUCTION - Auction trading (FBA) */ + TRADING_MODE_BATCH_AUCTION = 2, + /** TRADING_MODE_OPENING_AUCTION - Opening auction */ + TRADING_MODE_OPENING_AUCTION = 3, + /** TRADING_MODE_MONITORING_AUCTION - Auction triggered by monitoring */ + TRADING_MODE_MONITORING_AUCTION = 4, + /** TRADING_MODE_NO_TRADING - No trading is allowed */ + TRADING_MODE_NO_TRADING = 5, + UNRECOGNIZED = -1, +} + +/** Time stamps for important times about creating, enacting etc the market */ +export interface MarketTimestamps { + /** Time when the market is first proposed. */ + proposed: number; + /** Time when the market has been voted in and began its opening auction. */ + pending: number; + /** Time when the market has left the opening auction and is ready to accept trades. */ + open: number; + /** Time when the market closed. */ + close: number; +} diff --git a/libs/wallet/src/__generated__/vega/vega.ts b/libs/wallet/src/__generated__/vega/vega.ts new file mode 100644 index 000000000..a897d9f47 --- /dev/null +++ b/libs/wallet/src/__generated__/vega/vega.ts @@ -0,0 +1,1498 @@ +/* eslint-disable */ +import type { Market_State, Market_TradingMode, PriceMonitoringTrigger } from "./markets"; + +export const protobufPackage = "vega"; + +/** Side relates to the direction of an order, to Buy, or Sell */ +export enum Side { + /** SIDE_UNSPECIFIED - Default value, always invalid */ + SIDE_UNSPECIFIED = 0, + /** SIDE_BUY - Buy order */ + SIDE_BUY = 1, + /** SIDE_SELL - Sell order */ + SIDE_SELL = 2, + UNRECOGNIZED = -1, +} + +/** Represents a set of time intervals that are used when querying for candle-stick data */ +export enum Interval { + /** INTERVAL_UNSPECIFIED - Default value, always invalid */ + INTERVAL_UNSPECIFIED = 0, + /** INTERVAL_BLOCK - Block interval is not a fixed amount of time, rather it is used to indicate grouping of events that occur in a single block. It is usually about a second. */ + INTERVAL_BLOCK = -1, + /** INTERVAL_I1M - 1 minute. */ + INTERVAL_I1M = 60, + /** INTERVAL_I5M - 5 minutes. */ + INTERVAL_I5M = 300, + /** INTERVAL_I15M - 15 minutes. */ + INTERVAL_I15M = 900, + /** INTERVAL_I1H - 1 hour. */ + INTERVAL_I1H = 3600, + /** INTERVAL_I6H - 6 hours. */ + INTERVAL_I6H = 21600, + /** INTERVAL_I1D - 1 day. */ + INTERVAL_I1D = 86400, + UNRECOGNIZED = -1, +} + +/** Represents the status of a position */ +export enum PositionStatus { + POSITION_STATUS_UNSPECIFIED = 0, + POSITION_STATUS_ORDERS_CLOSED = 1, + POSITION_STATUS_CLOSED_OUT = 2, + POSITION_STATUS_DISTRESSED = 4, + UNRECOGNIZED = -1, +} + +/** Auction triggers indicate what condition triggered an auction (if market is in auction mode) */ +export enum AuctionTrigger { + /** AUCTION_TRIGGER_UNSPECIFIED - Default value for AuctionTrigger, no auction triggered */ + AUCTION_TRIGGER_UNSPECIFIED = 0, + /** AUCTION_TRIGGER_BATCH - Batch auction */ + AUCTION_TRIGGER_BATCH = 1, + /** AUCTION_TRIGGER_OPENING - Opening auction */ + AUCTION_TRIGGER_OPENING = 2, + /** AUCTION_TRIGGER_PRICE - Price monitoring trigger */ + AUCTION_TRIGGER_PRICE = 3, + /** AUCTION_TRIGGER_LIQUIDITY - Deprecated */ + AUCTION_TRIGGER_LIQUIDITY = 4, + /** AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET - Liquidity auction due to not enough committed liquidity */ + AUCTION_TRIGGER_LIQUIDITY_TARGET_NOT_MET = 5, + /** AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS - Liquidity auction due to not being able to deploy LP orders because there's nothing to peg on one or both sides of the book */ + AUCTION_TRIGGER_UNABLE_TO_DEPLOY_LP_ORDERS = 6, + UNRECOGNIZED = -1, +} + +/** + * Pegged reference defines which price point a pegged order is linked to - meaning + * the price for a pegged order is calculated from the value of the reference price point + */ +export enum PeggedReference { + /** PEGGED_REFERENCE_UNSPECIFIED - Default value for PeggedReference, no reference given */ + PEGGED_REFERENCE_UNSPECIFIED = 0, + /** PEGGED_REFERENCE_MID - Mid price reference */ + PEGGED_REFERENCE_MID = 1, + /** PEGGED_REFERENCE_BEST_BID - Best bid price reference */ + PEGGED_REFERENCE_BEST_BID = 2, + /** PEGGED_REFERENCE_BEST_ASK - Best ask price reference */ + PEGGED_REFERENCE_BEST_ASK = 3, + UNRECOGNIZED = -1, +} + +/** + * OrderError codes are returned in the Order.reason field - If there is an issue + * with an order during its life-cycle, it will be marked with `status.ORDER_STATUS_REJECTED` + */ +export enum OrderError { + /** ORDER_ERROR_UNSPECIFIED - Default value, no error reported */ + ORDER_ERROR_UNSPECIFIED = 0, + /** ORDER_ERROR_INVALID_MARKET_ID - Order was submitted for a market that does not exist */ + ORDER_ERROR_INVALID_MARKET_ID = 1, + /** ORDER_ERROR_INVALID_ORDER_ID - Order was submitted with an invalid ID */ + ORDER_ERROR_INVALID_ORDER_ID = 2, + /** ORDER_ERROR_OUT_OF_SEQUENCE - Order was amended with a sequence number that was not previous version + 1 */ + ORDER_ERROR_OUT_OF_SEQUENCE = 3, + /** ORDER_ERROR_INVALID_REMAINING_SIZE - Order was amended with an invalid remaining size (e.g. remaining greater than total size) */ + ORDER_ERROR_INVALID_REMAINING_SIZE = 4, + /** ORDER_ERROR_TIME_FAILURE - Node was unable to get Vega (blockchain) time */ + ORDER_ERROR_TIME_FAILURE = 5, + /** ORDER_ERROR_REMOVAL_FAILURE - Failed to remove an order from the book */ + ORDER_ERROR_REMOVAL_FAILURE = 6, + /** + * ORDER_ERROR_INVALID_EXPIRATION_DATETIME - Order with `TimeInForce.TIME_IN_FORCE_GTT` was submitted or amended + * with an expiration that was badly formatted or otherwise invalid + */ + ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 7, + /** ORDER_ERROR_INVALID_ORDER_REFERENCE - Order was submitted or amended with an invalid reference field */ + ORDER_ERROR_INVALID_ORDER_REFERENCE = 8, + /** ORDER_ERROR_EDIT_NOT_ALLOWED - Order amend was submitted for an order field that cannot not be amended (e.g. order ID) */ + ORDER_ERROR_EDIT_NOT_ALLOWED = 9, + /** ORDER_ERROR_AMEND_FAILURE - Amend failure because amend details do not match original order */ + ORDER_ERROR_AMEND_FAILURE = 10, + /** ORDER_ERROR_NOT_FOUND - Order not found in an order book or store */ + ORDER_ERROR_NOT_FOUND = 11, + /** ORDER_ERROR_INVALID_PARTY_ID - Order was submitted with an invalid or missing party ID */ + ORDER_ERROR_INVALID_PARTY_ID = 12, + /** ORDER_ERROR_MARKET_CLOSED - Order was submitted for a market that has closed */ + ORDER_ERROR_MARKET_CLOSED = 13, + /** ORDER_ERROR_MARGIN_CHECK_FAILED - Order was submitted, but the party did not have enough collateral to cover the order */ + ORDER_ERROR_MARGIN_CHECK_FAILED = 14, + /** ORDER_ERROR_MISSING_GENERAL_ACCOUNT - Order was submitted, but the party did not have an account for this asset */ + ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 15, + /** ORDER_ERROR_INTERNAL_ERROR - Unspecified internal error */ + ORDER_ERROR_INTERNAL_ERROR = 16, + /** ORDER_ERROR_INVALID_SIZE - Order was submitted with an invalid or missing size (e.g. 0) */ + ORDER_ERROR_INVALID_SIZE = 17, + /** ORDER_ERROR_INVALID_PERSISTENCE - Order was submitted with an invalid persistence for its type */ + ORDER_ERROR_INVALID_PERSISTENCE = 18, + /** ORDER_ERROR_INVALID_TYPE - Order was submitted with an invalid type field */ + ORDER_ERROR_INVALID_TYPE = 19, + /** ORDER_ERROR_SELF_TRADING - Order was stopped as it would have traded with another order submitted from the same party */ + ORDER_ERROR_SELF_TRADING = 20, + /** ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES - Order was submitted, but the party did not have enough collateral to cover the fees for the order */ + ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 21, + /** ORDER_ERROR_INCORRECT_MARKET_TYPE - Order was submitted with an incorrect or invalid market type */ + ORDER_ERROR_INCORRECT_MARKET_TYPE = 22, + /** ORDER_ERROR_INVALID_TIME_IN_FORCE - Order was submitted with invalid time in force */ + ORDER_ERROR_INVALID_TIME_IN_FORCE = 23, + /** ORDER_ERROR_CANNOT_SEND_GFN_ORDER_DURING_AN_AUCTION - Good For Normal order has reached the market when it is in auction mode */ + ORDER_ERROR_CANNOT_SEND_GFN_ORDER_DURING_AN_AUCTION = 24, + /** ORDER_ERROR_CANNOT_SEND_GFA_ORDER_DURING_CONTINUOUS_TRADING - Good For Auction order has reached the market when it is in continuous trading mode */ + ORDER_ERROR_CANNOT_SEND_GFA_ORDER_DURING_CONTINUOUS_TRADING = 25, + /** ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT - Attempt to amend order to GTT without ExpiryAt */ + ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 26, + /** ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT - Attempt to amend ExpiryAt to a value before CreatedAt */ + ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 27, + /** ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT - Attempt to amend to GTC without an ExpiryAt value */ + ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 28, + /** ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC - Amending to FOK or IOC is invalid */ + ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 29, + /** ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN - Amending to GFA or GFN is invalid */ + ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 30, + /** ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN - Amending from GFA or GFN is invalid */ + ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 31, + /** ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION - IOC orders are not allowed during auction */ + ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 32, + /** ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION - FOK orders are not allowed during auction */ + ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 33, + /** ORDER_ERROR_MUST_BE_LIMIT_ORDER - Pegged orders must be LIMIT orders */ + ORDER_ERROR_MUST_BE_LIMIT_ORDER = 34, + /** ORDER_ERROR_MUST_BE_GTT_OR_GTC - Pegged orders can only have TIF GTC or GTT */ + ORDER_ERROR_MUST_BE_GTT_OR_GTC = 35, + /** ORDER_ERROR_WITHOUT_REFERENCE_PRICE - Pegged order must have a reference price */ + ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 36, + /** ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE - Buy pegged order cannot reference best ask price */ + ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 37, + /** ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO - Pegged order offset must be >= 0 */ + ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 40, + /** ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE - Sell pegged order cannot reference best bid price */ + ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 41, + /** ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO - Pegged order offset must be > zero */ + ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 42, + /** + * ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE - Party has an insufficient balance, or does not have + * a general account to submit the order (no deposits made + * for the required asset) + */ + ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 43, + /** ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER - Cannot amend details of a non pegged details */ + ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 44, + /** ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER - Could not re-price a pegged order because a market price is unavailable */ + ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 45, + /** ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER - It is not possible to amend the price of an existing pegged order */ + ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 46, + /** ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS - FOK, IOC, or GFN order was rejected because it resulted in trades outside the price bounds */ + ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 47, + /** ORDER_ERROR_TOO_MANY_PEGGED_ORDERS - Unable to submit pegged order, temporarily too many pegged orders across all markets */ + ORDER_ERROR_TOO_MANY_PEGGED_ORDERS = 48, + /** ORDER_ERROR_POST_ONLY_ORDER_WOULD_TRADE - Post order would trade */ + ORDER_ERROR_POST_ONLY_ORDER_WOULD_TRADE = 49, + /** ORDER_ERROR_REDUCE_ONLY_ORDER_WOULD_NOT_REDUCE_POSITION - Post order would trade */ + ORDER_ERROR_REDUCE_ONLY_ORDER_WOULD_NOT_REDUCE_POSITION = 50, + UNRECOGNIZED = -1, +} + +/** Vega blockchain status as reported by the node the caller is connected to */ +export enum ChainStatus { + /** CHAIN_STATUS_UNSPECIFIED - Default value, always invalid */ + CHAIN_STATUS_UNSPECIFIED = 0, + /** CHAIN_STATUS_DISCONNECTED - Blockchain is disconnected */ + CHAIN_STATUS_DISCONNECTED = 1, + /** CHAIN_STATUS_REPLAYING - Blockchain is replaying historic transactions */ + CHAIN_STATUS_REPLAYING = 2, + /** CHAIN_STATUS_CONNECTED - Blockchain is connected and receiving transactions */ + CHAIN_STATUS_CONNECTED = 3, + UNRECOGNIZED = -1, +} + +/** Various collateral/account types as used by Vega */ +export enum AccountType { + /** ACCOUNT_TYPE_UNSPECIFIED - Default value */ + ACCOUNT_TYPE_UNSPECIFIED = 0, + /** ACCOUNT_TYPE_INSURANCE - Insurance pool accounts contain insurance pool funds for a market */ + ACCOUNT_TYPE_INSURANCE = 1, + /** ACCOUNT_TYPE_SETTLEMENT - Settlement accounts exist only during settlement or mark-to-market */ + ACCOUNT_TYPE_SETTLEMENT = 2, + /** + * ACCOUNT_TYPE_MARGIN - Margin accounts contain funds set aside for the margin needed to support a party's open positions. + * Each party will have a margin account for each market they have traded in. + * Required initial margin is allocated to each market from user's general account. + * Collateral in the margin account can't be withdrawn or used as margin on another market until + * it is released back to the general account. + * Vega protocol uses an internal accounting system to segregate funds held as + * margin from other funds to ensure they are never lost or 'double spent' + * + * Margin account funds will vary as margin requirements on positions change + */ + ACCOUNT_TYPE_MARGIN = 3, + /** + * ACCOUNT_TYPE_GENERAL - General accounts contain the collateral for a party that is not otherwise allocated. A party will + * have multiple general accounts, one for each asset they want + * to trade with + * + * General accounts are where funds are initially deposited or withdrawn from, + * it is also the account where funds are taken to fulfil fees and initial margin requirements + */ + ACCOUNT_TYPE_GENERAL = 4, + /** ACCOUNT_TYPE_FEES_INFRASTRUCTURE - Infrastructure accounts contain fees earned by providing infrastructure on Vega */ + ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 5, + /** ACCOUNT_TYPE_FEES_LIQUIDITY - Liquidity accounts contain fees earned by providing liquidity on Vega markets */ + ACCOUNT_TYPE_FEES_LIQUIDITY = 6, + /** + * ACCOUNT_TYPE_FEES_MAKER - This account is created to hold fees earned by placing orders that sit on the book + * and are then matched with an incoming order to create a trade - These fees reward parties + * who provide the best priced liquidity that actually allows trading to take place + */ + ACCOUNT_TYPE_FEES_MAKER = 7, + /** ACCOUNT_TYPE_BOND - This account is created to maintain liquidity providers funds commitments */ + ACCOUNT_TYPE_BOND = 9, + /** ACCOUNT_TYPE_EXTERNAL - External account represents an external source (deposit/withdrawal) */ + ACCOUNT_TYPE_EXTERNAL = 10, + /** ACCOUNT_TYPE_GLOBAL_INSURANCE - Global insurance account for the asset */ + ACCOUNT_TYPE_GLOBAL_INSURANCE = 11, + /** ACCOUNT_TYPE_GLOBAL_REWARD - Global reward account for the asset */ + ACCOUNT_TYPE_GLOBAL_REWARD = 12, + /** ACCOUNT_TYPE_PENDING_TRANSFERS - Per asset account used to store pending transfers (if any) */ + ACCOUNT_TYPE_PENDING_TRANSFERS = 13, + /** ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES - Per asset reward account for fees paid to makers */ + ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES = 14, + /** ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES - Per asset reward account for fees received by makers */ + ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 15, + /** ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES - Per asset reward account for fees received by liquidity providers */ + ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 16, + /** ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS - Per asset reward account for market proposers when the market goes above some trading threshold */ + ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 17, + /** ACCOUNT_TYPE_HOLDING - Per asset account for holding in-flight unfilled orders' funds */ + ACCOUNT_TYPE_HOLDING = 18, + UNRECOGNIZED = -1, +} + +/** Transfers can occur between parties on Vega, these are the types that indicate why a transfer took place */ +export enum TransferType { + /** TRANSFER_TYPE_UNSPECIFIED - Default value, always invalid */ + TRANSFER_TYPE_UNSPECIFIED = 0, + /** TRANSFER_TYPE_LOSS - Funds deducted after final settlement loss */ + TRANSFER_TYPE_LOSS = 1, + /** TRANSFER_TYPE_WIN - Funds added to general account after final settlement gain */ + TRANSFER_TYPE_WIN = 2, + /** TRANSFER_TYPE_MTM_LOSS - Funds deducted from margin account after mark to market loss */ + TRANSFER_TYPE_MTM_LOSS = 4, + /** TRANSFER_TYPE_MTM_WIN - Funds added to margin account after mark to market gain */ + TRANSFER_TYPE_MTM_WIN = 5, + /** TRANSFER_TYPE_MARGIN_LOW - Funds transferred from general account to meet margin requirement */ + TRANSFER_TYPE_MARGIN_LOW = 6, + /** TRANSFER_TYPE_MARGIN_HIGH - Excess margin amount returned to general account */ + TRANSFER_TYPE_MARGIN_HIGH = 7, + /** TRANSFER_TYPE_MARGIN_CONFISCATED - Margin confiscated from margin account to fulfil closeout */ + TRANSFER_TYPE_MARGIN_CONFISCATED = 8, + /** TRANSFER_TYPE_MAKER_FEE_PAY - Maker fee paid from general account */ + TRANSFER_TYPE_MAKER_FEE_PAY = 9, + /** TRANSFER_TYPE_MAKER_FEE_RECEIVE - Maker fee received into general account */ + TRANSFER_TYPE_MAKER_FEE_RECEIVE = 10, + /** TRANSFER_TYPE_INFRASTRUCTURE_FEE_PAY - Infrastructure fee paid from general account */ + TRANSFER_TYPE_INFRASTRUCTURE_FEE_PAY = 11, + /** TRANSFER_TYPE_INFRASTRUCTURE_FEE_DISTRIBUTE - Infrastructure fee received into general account */ + TRANSFER_TYPE_INFRASTRUCTURE_FEE_DISTRIBUTE = 12, + /** TRANSFER_TYPE_LIQUIDITY_FEE_PAY - Liquidity fee paid from general account */ + TRANSFER_TYPE_LIQUIDITY_FEE_PAY = 13, + /** TRANSFER_TYPE_LIQUIDITY_FEE_DISTRIBUTE - Liquidity fee received into general account */ + TRANSFER_TYPE_LIQUIDITY_FEE_DISTRIBUTE = 14, + /** TRANSFER_TYPE_BOND_LOW - Bond account funded from general account to meet required bond amount */ + TRANSFER_TYPE_BOND_LOW = 15, + /** TRANSFER_TYPE_BOND_HIGH - Bond returned to general account after liquidity commitment was reduced */ + TRANSFER_TYPE_BOND_HIGH = 16, + /** TRANSFER_TYPE_WITHDRAW - Funds withdrawn from general account */ + TRANSFER_TYPE_WITHDRAW = 18, + /** TRANSFER_TYPE_DEPOSIT - Funds deposited to general account */ + TRANSFER_TYPE_DEPOSIT = 19, + /** TRANSFER_TYPE_BOND_SLASHING - Bond account penalised when liquidity commitment not met */ + TRANSFER_TYPE_BOND_SLASHING = 20, + /** TRANSFER_TYPE_REWARD_PAYOUT - Reward payout received */ + TRANSFER_TYPE_REWARD_PAYOUT = 21, + /** TRANSFER_TYPE_TRANSFER_FUNDS_SEND - Internal Vega network instruction for the collateral engine to move funds from a user's general account into the pending transfers pool */ + TRANSFER_TYPE_TRANSFER_FUNDS_SEND = 22, + /** TRANSFER_TYPE_TRANSFER_FUNDS_DISTRIBUTE - Internal Vega network instruction for the collateral engine to move funds from the pending transfers pool account into the destination account */ + TRANSFER_TYPE_TRANSFER_FUNDS_DISTRIBUTE = 23, + /** TRANSFER_TYPE_CLEAR_ACCOUNT - Market-related accounts emptied because market has closed */ + TRANSFER_TYPE_CLEAR_ACCOUNT = 24, + /** TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE - Balances restored after network restart */ + TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = 25, + /** TRANSFER_TYPE_SPOT - Spot trade delivery */ + TRANSFER_TYPE_SPOT = 26, + /** TRANSFER_TYPE_HOLDING_LOCK - An internal instruction to transfer a quantity corresponding to an active spot order from a general account into a party holding account. */ + TRANSFER_TYPE_HOLDING_LOCK = 27, + /** TRANSFER_TYPE_HOLDING_RELEASE - An internal instruction to transfer an excess quantity corresponding to an active spot order from a holding account into a party general account. */ + TRANSFER_TYPE_HOLDING_RELEASE = 28, + /** TRANSFER_TYPE_SUCCESSOR_INSURANCE_FRACTION - Insurance pool fraction transfer from parent to successor market. */ + TRANSFER_TYPE_SUCCESSOR_INSURANCE_FRACTION = 29, + UNRECOGNIZED = -1, +} + +export enum DispatchMetric { + DISPATCH_METRIC_UNSPECIFIED = 0, + /** DISPATCH_METRIC_MAKER_FEES_PAID - Dispatch metric that is using the total maker fees paid in the market */ + DISPATCH_METRIC_MAKER_FEES_PAID = 1, + /** DISPATCH_METRIC_MAKER_FEES_RECEIVED - Dispatch metric that is using the total maker fees received in the market */ + DISPATCH_METRIC_MAKER_FEES_RECEIVED = 2, + /** DISPATCH_METRIC_LP_FEES_RECEIVED - Dispatch metric that is using the total LP fees received in the market */ + DISPATCH_METRIC_LP_FEES_RECEIVED = 3, + /** DISPATCH_METRIC_MARKET_VALUE - Dispatch metric that is using total value of the market if above the required threshold and not paid given proposer bonus yet */ + DISPATCH_METRIC_MARKET_VALUE = 4, + UNRECOGNIZED = -1, +} + +/** Node status type */ +export enum NodeStatus { + NODE_STATUS_UNSPECIFIED = 0, + /** NODE_STATUS_VALIDATOR - Node is a validating node */ + NODE_STATUS_VALIDATOR = 1, + /** NODE_STATUS_NON_VALIDATOR - Node is a non-validating node */ + NODE_STATUS_NON_VALIDATOR = 2, + UNRECOGNIZED = -1, +} + +/** What epoch action has occurred */ +export enum EpochAction { + EPOCH_ACTION_UNSPECIFIED = 0, + /** EPOCH_ACTION_START - Epoch update is for a new epoch. */ + EPOCH_ACTION_START = 1, + /** EPOCH_ACTION_END - Epoch update is for the end of an epoch. */ + EPOCH_ACTION_END = 2, + UNRECOGNIZED = -1, +} + +/** Validation status of the node */ +export enum ValidatorNodeStatus { + VALIDATOR_NODE_STATUS_UNSPECIFIED = 0, + /** VALIDATOR_NODE_STATUS_TENDERMINT - Node is a tendermint validator */ + VALIDATOR_NODE_STATUS_TENDERMINT = 1, + /** VALIDATOR_NODE_STATUS_ERSATZ - Node is an ersatz validator */ + VALIDATOR_NODE_STATUS_ERSATZ = 2, + /** VALIDATOR_NODE_STATUS_PENDING - Node is a pending validator */ + VALIDATOR_NODE_STATUS_PENDING = 3, + UNRECOGNIZED = -1, +} + +/** Party represents an entity who wishes to trade on or query a Vega network */ +export interface Party { + /** Unique ID for the party, typically represented by a public key. */ + id: string; +} + +/** Risk factors are used to calculate the current risk associated with orders trading on a given market */ +export interface RiskFactor { + /** Market ID that relates to this risk factor. */ + market: string; + /** Short Risk factor value. */ + short: string; + /** Long Risk factor value. */ + long: string; +} + +/** + * Pegged orders are limit orders where the price is specified in the form REFERENCE +/- OFFSET + * They can be used for any limit order that is valid during continuous trading + */ +export interface PeggedOrder { + /** Price point the order is linked to. */ + reference: PeggedReference; + /** Offset from the price reference. */ + offset: string; +} + +/** Details of an iceberg order */ +export interface IcebergOrder { + /** Size of the order that will be made visible if the iceberg order is refreshed at the end of a transaction. */ + initialPeakSize: number; + /** Threshold at which the order's visible remaining size will be refreshed back to its initial peak size. */ + minimumPeakSize: number; + /** Size of the order that is reserved and used to restore the iceberg's peak when it is refreshed. */ + reservedRemaining: number; +} + +/** Orders can be submitted, amended and cancelled on Vega in an attempt to make trades with other parties */ +export interface Order { + /** Unique ID generated for the order. */ + id: string; + /** Market ID for the order. */ + marketId: string; + /** Party ID for the order. */ + partyId: string; + /** Side for the order, e.g. SIDE_BUY or SIDE_SELL. */ + side: Side; + /** + * Price for the order, the price is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + price: string; + /** Size for the order, for example, in a futures market the size equals the number of contracts. */ + size: number; + /** Size remaining, when this reaches 0 then the order is fully filled and status becomes STATUS_FILLED. */ + remaining: number; + /** + * Time in force indicates how long an order will remain active before it is executed or expires. + * - See OrderTimeInForce + */ + timeInForce: Order_TimeInForce; + /** Type for the order. */ + type: Order_Type; + /** Timestamp for when the order was created at, in nanoseconds. */ + createdAt: number; + /** Current status of the order. */ + status: Order_Status; + /** Timestamp in Unix nanoseconds for when the order will expire. */ + expiresAt: number; + /** Reference given for the order. */ + reference: string; + /** Futher details for why an order with status `STATUS_REJECTED` was rejected. */ + reason?: + | OrderError + | undefined; + /** Timestamp in Unix nanoseconds for when the order was last updated. */ + updatedAt: number; + /** Version for the order, initial value is version 1 and is incremented after each successful amend. */ + version: number; + /** + * Batch ID for the order, used internally for orders submitted during auctions + * to keep track of the auction batch this order falls under. Required for fees calculation. + */ + batchId: number; + /** Pegged order details, used only if the order represents a pegged order. */ + peggedOrder: + | PeggedOrder + | undefined; + /** Set if the order was created as part of a liquidity provision, will be empty if not. */ + liquidityProvisionId: string; + /** Only valid for Limit orders. Cannot be True at the same time as Reduce-Only. */ + postOnly: boolean; + /** + * Only valid for Non-Persistent orders. Cannot be True at the same time as Post-Only. + * If set, order will only be executed if the outcome of the trade moves the trader's position closer to 0. + */ + reduceOnly: boolean; + /** Details of an iceberg order */ + icebergOrder?: IcebergOrder | undefined; +} + +/** Time In Force for an order */ +export enum Order_TimeInForce { + /** TIME_IN_FORCE_UNSPECIFIED - Default value for TimeInForce, can be valid for an amend */ + TIME_IN_FORCE_UNSPECIFIED = 0, + /** + * TIME_IN_FORCE_GTC - Good until cancelled, the order trades any amount and as much as possible + * and remains on the book until it either trades completely or is cancelled + */ + TIME_IN_FORCE_GTC = 1, + /** + * TIME_IN_FORCE_GTT - Good until specified time, this order type trades any amount and as much as possible + * and remains on the book until it either trades completely, is cancelled, or expires at a set time + * NOTE: this may in future be multiple types or have sub types for orders that provide different ways of specifying expiry + */ + TIME_IN_FORCE_GTT = 2, + /** + * TIME_IN_FORCE_IOC - Immediate or cancel, the order trades any amount and as much as possible + * but does not remain on the book (whether it trades or not) + */ + TIME_IN_FORCE_IOC = 3, + /** + * TIME_IN_FORCE_FOK - Fill or kill, the order either trades completely i.e. remainingSize == 0 after adding, + * or not at all, and does not remain on the book if it doesn't trade + */ + TIME_IN_FORCE_FOK = 4, + /** TIME_IN_FORCE_GFA - Good for auction, this order is only accepted during an auction period */ + TIME_IN_FORCE_GFA = 5, + /** TIME_IN_FORCE_GFN - Good for normal, this order is only accepted during normal trading (that can be continuous trading or frequent batched auctions) */ + TIME_IN_FORCE_GFN = 6, + UNRECOGNIZED = -1, +} + +/** Type values for an order */ +export enum Order_Type { + /** TYPE_UNSPECIFIED - Default value, always invalid */ + TYPE_UNSPECIFIED = 0, + /** TYPE_LIMIT - Used for Limit orders */ + TYPE_LIMIT = 1, + /** TYPE_MARKET - Used for Market orders */ + TYPE_MARKET = 2, + /** TYPE_NETWORK - Used for orders where the initiating party is the network (with distressed parties) */ + TYPE_NETWORK = 3, + UNRECOGNIZED = -1, +} + +/** Status values for an order */ +export enum Order_Status { + /** STATUS_UNSPECIFIED - Default value, always invalid */ + STATUS_UNSPECIFIED = 0, + /** STATUS_ACTIVE - Used for active unfilled or partially filled orders */ + STATUS_ACTIVE = 1, + /** STATUS_EXPIRED - Used for expired GTT orders */ + STATUS_EXPIRED = 2, + /** STATUS_CANCELLED - Used for orders cancelled by the party that created the order */ + STATUS_CANCELLED = 3, + /** STATUS_STOPPED - Used for unfilled FOK or IOC orders, and for orders that were stopped by the network */ + STATUS_STOPPED = 4, + /** STATUS_FILLED - Used for closed fully filled orders */ + STATUS_FILLED = 5, + /** STATUS_REJECTED - Used for orders when not enough collateral was available to fill the margin requirements */ + STATUS_REJECTED = 6, + /** STATUS_PARTIALLY_FILLED - Used for closed partially filled IOC orders */ + STATUS_PARTIALLY_FILLED = 7, + /** + * STATUS_PARKED - Order has been removed from the order book and has been parked, + * this applies to pegged orders and liquidity orders (orders created from a liquidity provision shape) + */ + STATUS_PARKED = 8, + UNRECOGNIZED = -1, +} + +/** Used when cancelling an order */ +export interface OrderCancellationConfirmation { + /** Order that was cancelled. */ + order: Order | undefined; +} + +/** Used when confirming an order */ +export interface OrderConfirmation { + /** Order that was confirmed. */ + order: + | Order + | undefined; + /** 0 or more trades that were emitted. */ + trades: Trade[]; + /** 0 or more passive orders that were affected. */ + passiveOrdersAffected: Order[]; +} + +/** AuctionIndicativeState is used to emit an event with the indicative price/volume per market during an auction */ +export interface AuctionIndicativeState { + /** Market ID for which this state relates to. */ + marketId: string; + /** Indicative uncrossing price is the price at which all trades would occur if the auction uncrossed now. */ + indicativePrice: string; + /** Indicative uncrossing volume is the volume available at the indicative crossing price if the auction uncrossed now. */ + indicativeVolume: number; + /** Timestamp at which the auction started. */ + auctionStart: number; + /** Timestamp at which the auction is meant to stop. */ + auctionEnd: number; +} + +/** A trade occurs when an aggressive order crosses one or more passive orders on the order book for a market on Vega */ +export interface Trade { + /** Unique ID for the trade. */ + id: string; + /** Market ID on which the trade occurred. */ + marketId: string; + /** + * Price for the trade, the price is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + price: string; + /** Size filled for the trade. */ + size: number; + /** Unique party ID for the buyer. */ + buyer: string; + /** Unique party ID for the seller. */ + seller: string; + /** Direction of the aggressive party e.g. SIDE_BUY or SIDE_SELL. */ + aggressor: Side; + /** Identifier of the order from the buy side. */ + buyOrder: string; + /** Identifier of the order from the sell side. */ + sellOrder: string; + /** Timestamp in Unix nanoseconds for when the trade occurred. */ + timestamp: number; + /** Type for the trade. */ + type: Trade_Type; + /** Fee amount charged to the buyer party for the trade. */ + buyerFee: + | Fee + | undefined; + /** Fee amount charged to the seller party for the trade. */ + sellerFee: + | Fee + | undefined; + /** Auction batch number that the buy side order was placed in. */ + buyerAuctionBatch: number; + /** Auction batch number that the sell side order was placed in. */ + sellerAuctionBatch: number; +} + +/** Type values for a trade */ +export enum Trade_Type { + /** TYPE_UNSPECIFIED - Default value, always invalid */ + TYPE_UNSPECIFIED = 0, + /** TYPE_DEFAULT - Normal trading between two parties */ + TYPE_DEFAULT = 1, + /** + * TYPE_NETWORK_CLOSE_OUT_GOOD - Trading initiated by the network with another party on the book, + * which helps to zero-out the positions of one or more distressed parties + */ + TYPE_NETWORK_CLOSE_OUT_GOOD = 2, + /** + * TYPE_NETWORK_CLOSE_OUT_BAD - Trading initiated by the network with another party off the book, + * with a distressed party in order to zero-out the position of the party + */ + TYPE_NETWORK_CLOSE_OUT_BAD = 3, + UNRECOGNIZED = -1, +} + +/** Represents any fees paid by a party, resulting from a trade */ +export interface Fee { + /** Fee amount paid to the non-aggressive party of the trade. This field is an unsigned integer scaled to the asset's decimal places. */ + makerFee: string; + /** Fee amount paid for maintaining the Vega infrastructure. This field is an unsigned integer scaled using the asset's decimal places. */ + infrastructureFee: string; + /** Fee amount paid to market makers. This field is an unsigned integer scaled to the asset's decimal places. */ + liquidityFee: string; +} + +export interface TradeSet { + /** Set of one or more trades. */ + trades: Trade[]; +} + +/** + * Represents the high, low, open, and closing prices for an interval of trading, + * referred to commonly as a candlestick or candle + */ +export interface Candle { + /** Timestamp in Unix nanoseconds for the point in time when the candle was initially created/opened. */ + timestamp: number; + /** ISO-8601 datetime with nanosecond precision for when the candle was last updated. */ + datetime: string; + /** Highest price for trading during the candle interval. This field is an unsigned integer scaled to the market's decimal places. */ + high: string; + /** Lowest price for trading during the candle interval. This field is an unsigned integer scaled to the market's decimal places. */ + low: string; + /** Open trade price. This field is an unsigned integer scaled to the market's decimal places. */ + open: string; + /** Closing trade price. This field is an unsigned integer scaled to the market's decimal places. */ + close: string; + /** Total trading volume during the candle interval. */ + volume: number; + /** Time interval for the candle. */ + interval: Interval; +} + +/** Represents a price level from market depth or order book data */ +export interface PriceLevel { + /** + * Price for the price level, the price is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. This field + * is an unsigned integer passed as a string and needs to be scaled using the market's decimal places. + */ + price: string; + /** Number of orders at the price level. */ + numberOfOrders: number; + /** Volume at the price level. */ + volume: number; +} + +/** Represents market depth or order book data for the specified market on Vega */ +export interface MarketDepth { + /** Market ID for which the depth levels apply. */ + marketId: string; + /** Collection of price levels for the buy side of the book. */ + buy: PriceLevel[]; + /** Collection of price levels for the sell side of the book. */ + sell: PriceLevel[]; + /** Sequence number for the market depth data returned. */ + sequenceNumber: number; +} + +/** Represents the changed market depth since the last update */ +export interface MarketDepthUpdate { + /** Market ID for which the market depth updates are for. */ + marketId: string; + /** Collection of updated price levels for the buy side of the book. */ + buy: PriceLevel[]; + /** Collection of updated price levels for the sell side of the book. */ + sell: PriceLevel[]; + /** Sequence number for the market depth update data returned. It is increasing but not monotonic. */ + sequenceNumber: number; + /** Sequence number of the previous market depth update, for checking there are no gaps. */ + previousSequenceNumber: number; +} + +/** Represents position data for a party on the specified market on Vega */ +export interface Position { + /** Market ID in which the position is held. */ + marketId: string; + /** Party ID holding the position. */ + partyId: string; + /** Open volume for the position, value is signed +ve for long and -ve for short. */ + openVolume: number; + /** + * Realised profit and loss for the position, value is signed +ve for long and -ve for short. + * This field is a signed integer scaled to the market's decimal places. + */ + realisedPnl: string; + /** + * Unrealised profit and loss for the position, value is signed +ve for long and -ve for short. + * This field is a signed integer scaled to the market's decimal places. + */ + unrealisedPnl: string; + /** + * Average entry price for the position, the price is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + averageEntryPrice: string; + /** Timestamp for the latest time the position was updated. */ + updatedAt: number; + /** Sum of profit that could not be paid due to loss socialisation. */ + lossSocialisationAmount: string; + /** Position status, indicating whether the party was distressed and had orders cancelled or was closed out. */ + positionStatus: PositionStatus; +} + +export interface PositionTrade { + /** Volume for the position trade, value is signed +ve for long and -ve for short. */ + volume: number; + /** + * Price for the position trade, the price is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + price: string; +} + +/** Deposit on to the Vega network */ +export interface Deposit { + /** Unique ID for the deposit. */ + id: string; + /** Status of the deposit. */ + status: Deposit_Status; + /** Party ID of the user initiating the deposit. */ + partyId: string; + /** Vega asset targeted by this deposit. */ + asset: string; + /** Amount to be deposited. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Hash of the transaction from the foreign chain. */ + txHash: string; + /** Timestamp for when the Vega account was updated with the deposit. */ + creditedTimestamp: number; + /** Timestamp for when the deposit was created on the Vega network. */ + createdTimestamp: number; +} + +/** Status of the deposit */ +export enum Deposit_Status { + /** STATUS_UNSPECIFIED - Default value, always invalid */ + STATUS_UNSPECIFIED = 0, + /** STATUS_OPEN - Deposit is being processed by the network */ + STATUS_OPEN = 1, + /** STATUS_CANCELLED - Deposit has been cancelled by the network */ + STATUS_CANCELLED = 2, + /** STATUS_FINALIZED - Deposit has been finalised and accounts have been updated */ + STATUS_FINALIZED = 3, + UNRECOGNIZED = -1, +} + +/** Withdrawal from the Vega network */ +export interface Withdrawal { + /** Unique ID for the withdrawal. */ + id: string; + /** Unique party ID of the user initiating the withdrawal. */ + partyId: string; + /** Amount to be withdrawn. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Asset to withdraw funds from. */ + asset: string; + /** Status of the withdrawal. */ + status: Withdrawal_Status; + /** + * Reference which is used by the foreign chain + * to refer to this withdrawal. + */ + ref: string; + /** Hash of the foreign chain for this transaction. */ + txHash: string; + /** Timestamp for when the network started to process this withdrawal. */ + createdTimestamp: number; + /** Timestamp for when the withdrawal was finalised by the network. */ + withdrawnTimestamp: number; + /** Foreign chain specifics. */ + ext: WithdrawExt | undefined; +} + +/** Status of the withdrawal */ +export enum Withdrawal_Status { + /** STATUS_UNSPECIFIED - Default value, always invalid */ + STATUS_UNSPECIFIED = 0, + /** STATUS_OPEN - Withdrawal is open and being processed by the network */ + STATUS_OPEN = 1, + /** STATUS_REJECTED - Withdrawal have been cancelled */ + STATUS_REJECTED = 2, + /** + * STATUS_FINALIZED - Withdrawal went through and is fully finalised, the funds are removed from the + * Vega network and are unlocked on the foreign chain bridge, for example, on the Ethereum network + */ + STATUS_FINALIZED = 3, + UNRECOGNIZED = -1, +} + +/** Withdrawal external details */ +export interface WithdrawExt { + /** ERC20 withdrawal details. */ + erc20?: Erc20WithdrawExt | undefined; +} + +/** Extension of data required for the withdraw submissions */ +export interface Erc20WithdrawExt { + /** Address into which the bridge will release the funds. */ + receiverAddress: string; +} + +/** Represents an account for an asset on Vega for a particular owner or party */ +export interface Account { + /** Unique account ID, used internally by Vega. */ + id: string; + /** + * Party that the account belongs to, special values include `network`, which represents the Vega network and is + * most commonly seen during liquidation of distressed trading positions. + */ + owner: string; + /** + * Balance of the asset, the balance is an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places + * and importantly balances cannot be negative. + */ + balance: string; + /** Asset ID for the account. */ + asset: string; + /** Market ID for the account, if `AccountType.ACCOUNT_TYPE_GENERAL` this will be empty. */ + marketId: string; + /** Account type related to this account. */ + type: AccountType; +} + +/** Asset value information used within a transfer */ +export interface FinancialAmount { + /** Unsigned integer amount of asset scaled to the asset's decimal places. */ + amount: string; + /** Asset ID the amount applies to. */ + asset: string; +} + +/** Represents a financial transfer within Vega */ +export interface Transfer { + /** Party ID for the owner of the transfer. */ + owner: string; + /** Financial amount of an asset to transfer. */ + amount: + | FinancialAmount + | undefined; + /** Type of transfer, gives the reason for the transfer. */ + type: TransferType; + /** Minimum amount. This field is an unsigned integer scaled to the asset's decimal places. */ + minAmount: string; + /** Market ID the transfer is for */ + marketId: string; +} + +export interface DispatchStrategy { + /** Asset to use for metric. */ + assetForMetric: string; + /** Metric to apply. */ + metric: DispatchMetric; + /** Optional markets in scope. */ + markets: string[]; +} + +/** Represents a request to transfer from one set of accounts to another */ +export interface TransferRequest { + /** One or more accounts to transfer from. */ + fromAccount: Account[]; + /** One or more accounts to transfer to. */ + toAccount: Account[]; + /** Amount to transfer for the asset. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** + * Minimum amount that needs to be transferred for the transfer request. If this minimum isn't reached, it will error. + * This field is an unsigned integer scaled to the asset's decimal places. + */ + minAmount: string; + /** Asset ID of the asset being transferred. */ + asset: string; + /** Type of the request for transfer. */ + type: TransferType; +} + +export interface AccountDetails { + /** Asset ID of the asset for this account. */ + assetId: string; + /** Type of the account. */ + type: AccountType; + /** Not specified if network account. */ + owner?: + | string + | undefined; + /** Not specified if account is not related to a market. */ + marketId?: string | undefined; +} + +/** Represents a ledger entry on Vega */ +export interface LedgerEntry { + /** One or more accounts to transfer from. */ + fromAccount: + | AccountDetails + | undefined; + /** One or more accounts to transfer to. */ + toAccount: + | AccountDetails + | undefined; + /** Amount to transfer. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Transfer type for this entry. */ + type: TransferType; + /** Timestamp in nanoseconds of when the ledger entry was created. */ + timestamp: number; + /** Sender account balance after the transfer. This field is an unsigned integer scaled to the asset's decimal places. */ + fromAccountBalance: string; + /** Receiver account balance after the transfer. This field is an unsigned integer scaled to the asset's decimal places. */ + toAccountBalance: string; +} + +/** Represents the balance for an account during a transfer */ +export interface PostTransferBalance { + /** Account relating to the transfer. */ + account: + | AccountDetails + | undefined; + /** Balance relating to the transfer. This field is an unsigned integer scaled to the asset's decimal places. */ + balance: string; +} + +export interface LedgerMovement { + /** All the entries for these ledger movements. */ + entries: LedgerEntry[]; + /** Resulting balances once the ledger movement are applied. */ + balances: PostTransferBalance[]; +} + +/** Represents the margin levels for a party on a market at a given time */ +export interface MarginLevels { + /** Maintenance margin value. This field is an unsigned integer scaled to the asset's decimal places. */ + maintenanceMargin: string; + /** Margin search level value. This field is an unsigned integer scaled to the asset's decimal places. */ + searchLevel: string; + /** Initial margin value. This field is an unsigned integer scaled to the asset's decimal places. */ + initialMargin: string; + /** Collateral release level value. This field is an unsigned integer scaled to the asset's decimal places. */ + collateralReleaseLevel: string; + /** Party ID for whom the margin levels apply. */ + partyId: string; + /** Market ID for which the margin levels apply. */ + marketId: string; + /** Asset ID for which the margin levels apply. */ + asset: string; + /** Timestamp in Unix nanoseconds for when the ledger entry was created. */ + timestamp: number; +} + +/** Represents data generated by a market when open */ +export interface MarketData { + /** + * Mark price, as an unsigned integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + markPrice: string; + /** + * Highest price level on an order book for buy orders, as an unsigned integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + bestBidPrice: string; + /** + * Aggregated volume being bid at the best bid price, as an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market is configured to 5 decimal places. + */ + bestBidVolume: number; + /** Lowest price level on an order book for offer orders. This field is an unsigned integer scaled to the market's decimal places. */ + bestOfferPrice: string; + /** + * Aggregated volume being offered at the best offer price, as an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market is configured to 5 decimal places. + */ + bestOfferVolume: number; + /** + * Highest price on the order book for buy orders not including pegged orders. + * This field is an unsigned integer scaled to the market's decimal places. + */ + bestStaticBidPrice: string; + /** Total volume at the best static bid price excluding pegged orders. */ + bestStaticBidVolume: number; + /** + * Lowest price on the order book for sell orders not including pegged orders. + * This field is an unsigned integer scaled to the market's decimal places. + */ + bestStaticOfferPrice: string; + /** Total volume at the best static offer price, excluding pegged orders. */ + bestStaticOfferVolume: number; + /** + * Arithmetic average of the best bid price and best offer price, as an integer, for example `123456` is a correctly + * formatted price of `1.23456` assuming market configured to 5 decimal places. + */ + midPrice: string; + /** + * Arithmetic average of the best static bid price and best static offer price. + * This field is an unsigned integer scaled to the market's decimal places. + */ + staticMidPrice: string; + /** Market ID for the data */ + market: string; + /** Timestamp in Unix nanoseconds at which this mark price was relevant. */ + timestamp: number; + /** Sum of the size of all positions greater than zero on the market. */ + openInterest: number; + /** Time in seconds until the end of the auction (zero if currently not in auction period). */ + auctionEnd: number; + /** Time until next auction, or start time of the current auction if market is in auction period. */ + auctionStart: number; + /** Indicative price (zero if not in auction). This field is an unsigned scaled to the market's decimal places. */ + indicativePrice: string; + /** Indicative volume (zero if not in auction). */ + indicativeVolume: number; + /** Current trading mode for the market. */ + marketTradingMode: Market_TradingMode; + /** When a market is in an auction trading mode, this field indicates what triggered the auction. */ + trigger: AuctionTrigger; + /** When a market auction is extended, this field indicates what caused the extension. */ + extensionTrigger: AuctionTrigger; + /** Targeted stake for the given market. This field is an unsigned integer scaled to the settlement asset's decimal places. */ + targetStake: string; + /** Available stake for the given market. This field is an unsigned integer scaled to the settlement asset's decimal places. */ + suppliedStake: string; + /** One or more price monitoring bounds for the current timestamp. */ + priceMonitoringBounds: PriceMonitoringBounds[]; + /** Market value proxy. */ + marketValueProxy: string; + /** Equity like share of liquidity fee for each liquidity provider. */ + liquidityProviderFeeShare: LiquidityProviderFeeShare[]; + /** Current state of the market. */ + marketState: Market_State; + /** Time in Unix nanoseconds when the next mark-to-market calculation will occur. */ + nextMarkToMarket: number; + /** Last traded price of the market. This field is an unsigned integer scaled to the market's decimal places. */ + lastTradedPrice: string; +} + +/** Equity like share of liquidity fee for each liquidity provider */ +export interface LiquidityProviderFeeShare { + /** Liquidity provider party ID. */ + party: string; + /** Share own by this liquidity provider (float). */ + equityLikeShare: string; + /** Average entry valuation of the liquidity provider for the market. */ + averageEntryValuation: string; + /** Average liquidity score. */ + averageScore: string; +} + +/** Represents a list of valid (at the current timestamp) price ranges per associated trigger */ +export interface PriceMonitoringBounds { + /** + * Minimum price that isn't currently breaching the specified price monitoring trigger. + * This field is an unsigned integer scaled to the market's decimal places. + */ + minValidPrice: string; + /** + * Maximum price that isn't currently breaching the specified price monitoring trigger. + * This field is an unsigned integer scaled to the market's decimal places. + */ + maxValidPrice: string; + /** Price monitoring trigger associated with the bounds. */ + trigger: + | PriceMonitoringTrigger + | undefined; + /** Reference price used to calculate the valid price range. This field is an unsigned integer scaled to the market's decimal places. */ + referencePrice: string; +} + +/** Represents Vega domain specific error information over gRPC/Protobuf */ +export interface ErrorDetail { + /** Vega API domain specific unique error code, useful for client side mappings, e.g. 10004. */ + code: number; + /** Message that describes the error in more detail, should describe the problem encountered. */ + message: string; + /** Any inner error information that could add more context, or be helpful for error reporting. */ + inner: string; +} + +/** Represents a network parameter on Vega */ +export interface NetworkParameter { + /** Unique key of the network parameter. */ + key: string; + /** Value for the network parameter. */ + value: string; +} + +/** Network limits, defined in the genesis file */ +export interface NetworkLimits { + /** Are market proposals allowed at this point in time. */ + canProposeMarket: boolean; + /** Are asset proposals allowed at this point in time. */ + canProposeAsset: boolean; + /** Are market proposals enabled on this chain. */ + proposeMarketEnabled: boolean; + /** Are asset proposals enabled on this chain. */ + proposeAssetEnabled: boolean; + /** True once the genesis file is loaded. */ + genesisLoaded: boolean; + /** Timestamp in Unix nanoseconds at which market proposals will be enabled (0 indicates not set). */ + proposeMarketEnabledFrom: number; + /** Timestamp in Unix nanoseconds at which asset proposals will be enabled (0 indicates not set). */ + proposeAssetEnabledFrom: number; +} + +/** Represents a liquidity order */ +export interface LiquidityOrder { + /** Pegged reference point for the order. */ + reference: PeggedReference; + /** Relative proportion of the commitment to be allocated at a price level. */ + proportion: number; + /** Offset/amount of units away for the order. This field is an unsigned integer scaled using the market's decimal places. */ + offset: string; +} + +/** Pair of a liquidity order and the ID of the generated order */ +export interface LiquidityOrderReference { + /** Unique ID of the pegged order generated to fulfil this liquidity order. */ + orderId: string; + /** Liquidity order from the original submission. */ + liquidityOrder: LiquidityOrder | undefined; +} + +/** Liquidity provider commitment */ +export interface LiquidityProvision { + /** Unique ID for the liquidity provision. */ + id: string; + /** Unique party ID for the creator of the provision. */ + partyId: string; + /** Timestamp in Unix nanoseconds for when the order was created. */ + createdAt: number; + /** Timestamp in Unix nanoseconds for when the order was updated. */ + updatedAt: number; + /** Market ID for the order. */ + marketId: string; + /** + * Specified as a unitless number that represents the amount of settlement asset of the market. + * This field is an unsigned integer scaled to the asset's decimal places. + */ + commitmentAmount: string; + /** Nominated liquidity fee factor, which is an input to the calculation of taker fees on the market, as per setting fees and rewarding liquidity providers. */ + fee: string; + /** Set of liquidity sell orders to meet the liquidity provision obligation. */ + sells: LiquidityOrderReference[]; + /** Set of liquidity buy orders to meet the liquidity provision obligation. */ + buys: LiquidityOrderReference[]; + /** Version of this liquidity provision order. */ + version: number; + /** Status of this liquidity provision order. */ + status: LiquidityProvision_Status; + /** Reference shared between this liquidity provision and all its orders. */ + reference: string; +} + +/** Status of a liquidity provision order. */ +export enum LiquidityProvision_Status { + /** STATUS_UNSPECIFIED - Always invalid */ + STATUS_UNSPECIFIED = 0, + /** STATUS_ACTIVE - Liquidity provision is active */ + STATUS_ACTIVE = 1, + /** STATUS_STOPPED - Liquidity provision was stopped by the network */ + STATUS_STOPPED = 2, + /** STATUS_CANCELLED - Liquidity provision was cancelled by the liquidity provider */ + STATUS_CANCELLED = 3, + /** STATUS_REJECTED - Liquidity provision was invalid and got rejected */ + STATUS_REJECTED = 4, + /** STATUS_UNDEPLOYED - Liquidity provision is valid and accepted by network, but orders aren't deployed */ + STATUS_UNDEPLOYED = 5, + /** + * STATUS_PENDING - Liquidity provision is valid and accepted by network + * but has never been deployed. If when it's possible to deploy the orders for the first time + * margin check fails, then they will be cancelled without any penalties. + */ + STATUS_PENDING = 6, + UNRECOGNIZED = -1, +} + +/** Ethereum configuration details. */ +export interface EthereumConfig { + /** Network ID of this Ethereum network. */ + networkId: string; + /** Chain ID of this Ethereum network. */ + chainId: string; + /** // Contract configuration of the collateral bridge contract for this Ethereum network. */ + collateralBridgeContract: + | EthereumContractConfig + | undefined; + /** + * Number of block confirmations to wait to consider an Ethereum transaction trusted. + * An Ethereum block is trusted when there are at least "n" blocks confirmed by the + * network, "n" being the number of `confirmations` required. If `confirmations` was set to `3`, + * and the current block to be forged (or mined) on Ethereum is block 14, block + * 10 would be considered as trusted, but not block 11. + */ + confirmations: number; + /** Contract configuration of the stacking bridge contract for this Ethereum network. */ + stakingBridgeContract: + | EthereumContractConfig + | undefined; + /** Contract configuration of the token vesting contract for this Ethereum network. */ + tokenVestingContract: + | EthereumContractConfig + | undefined; + /** Contract configuration of the multisig control contract for this Ethereum network. */ + multisigControlContract: EthereumContractConfig | undefined; +} + +export interface EthereumContractConfig { + /** Address of the contract for this Ethereum network. The address should start with "0x". */ + address: string; + /** Block height at which the stacking contract has been deployed for this Ethereum network. */ + deploymentBlockHeight: number; +} + +/** Describes in both human readable and block time when an epoch spans */ +export interface EpochTimestamps { + /** Timestamp in Unix nanoseconds for when epoch started. */ + startTime: number; + /** Timestamp in Unix nanoseconds for the epoch's expiry. */ + expiryTime: number; + /** Timestamp in Unix nanoseconds for when the epoch ended, empty if not ended. */ + endTime: number; + /** Height of first block in the epoch. */ + firstBlock: number; + /** Height of last block in the epoch, empty if not ended. */ + lastBlock: number; +} + +export interface Epoch { + /** Sequence is used as epoch ID. */ + seq: number; + /** Timestamps for start/end etc. */ + timestamps: + | EpochTimestamps + | undefined; + /** Validators that participated in this epoch. */ + validators: Node[]; + /** List of all delegations in epoch. */ + delegations: Delegation[]; +} + +export interface EpochParticipation { + epoch: Epoch | undefined; + offline: number; + online: number; + totalRewards: number; +} + +export interface EpochData { + /** Total number of epochs since node was created. */ + total: number; + /** Total number of offline epochs since node was created. */ + offline: number; + /** Total number of online epochs since node was created. */ + online: number; +} + +export interface RankingScore { + /** Stake based score - no anti-whaling. */ + stakeScore: string; + /** Performance based score. */ + performanceScore: string; + /** Status of the validator in the previous epoch. */ + previousStatus: ValidatorNodeStatus; + /** Status of the validator in the current epoch. */ + status: ValidatorNodeStatus; + /** Tendermint voting power of the validator. */ + votingPower: number; + /** Final score. */ + rankingScore: string; +} + +export interface RewardScore { + /** Stake based score - with anti-whaling. */ + rawValidatorScore: string; + /** Performance based score. */ + performanceScore: string; + /** Multisig score. */ + multisigScore: string; + /** Un-normalised score. */ + validatorScore: string; + /** Normalised validator score for rewards. */ + normalisedScore: string; + /** Status of the validator for reward. */ + validatorStatus: ValidatorNodeStatus; +} + +export interface Node { + /** Node ID i.e. the node's wallet ID. */ + id: string; + /** Public key of the node operator. */ + pubKey: string; + /** Public key of Tendermint. */ + tmPubKey: string; + /** Ethereum public key of the node. */ + ethereumAddress: string; + /** URL where users can find out more information on the node. */ + infoUrl: string; + /** Country code for the location of the node. */ + location: string; + /** Amount the node operator has put up themselves. This field is an unsigned integer scaled to the asset's decimal places. */ + stakedByOperator: string; + /** Amount of stake that has been delegated by token holders. This field is an unsigned integer scaled to the asset's decimal places. */ + stakedByDelegates: string; + /** Total amount staked on node. This field is an unsigned integer scaled to the asset's decimal places. */ + stakedTotal: string; + /** Max amount of (wanted) stake. This field is an unsigned integer scaled to the asset's decimal places. */ + maxIntendedStake: string; + /** Amount of stake on the next epoch. This field is an unsigned integer scaled to the asset's decimal places. */ + pendingStake: string; + /** Information about epoch. */ + epochData: + | EpochData + | undefined; + /** Node status. */ + status: NodeStatus; + /** Node's delegations. */ + delegations: Delegation[]; + /** Node reward score. */ + rewardScore: + | RewardScore + | undefined; + /** Node ranking information. */ + rankingScore: + | RankingScore + | undefined; + /** Node name. */ + name: string; + /** Avatar url. */ + avatarUrl: string; +} + +/** Details on the collection of nodes for a particular validator status */ +export interface NodeSet { + /** Total number of nodes in the node set. */ + total: number; + /** Number of nodes in the node set that had a performance score of 0 at the end of the last epoch. */ + inactive: number; + /** IDs of nodes that were promoted into this node set at the start of the epoch. */ + promoted: string[]; + /** IDs of nodes that were demoted into this node set at the start of the epoch. */ + demoted: string[]; + /** Total number of nodes allowed in the node set. */ + maximum?: number | undefined; +} + +export interface NodeData { + /** Total staked amount across all nodes. This field is an unsigned integer scaled to the asset's decimal places. */ + stakedTotal: string; + /** Total number of nodes across all node sets. */ + totalNodes: number; + /** Total number of nodes that had a performance score of 0 at the end of the last epoch. */ + inactiveNodes: number; + /** Details on the set of consensus nodes in the network. */ + tendermintNodes: + | NodeSet + | undefined; + /** Details on the set of ersatz (standby) nodes in the network. */ + ersatzNodes: + | NodeSet + | undefined; + /** Details on the set of pending nodes in the network. */ + pendingNodes: + | NodeSet + | undefined; + /** Total uptime for all epochs across all nodes. */ + uptime: number; +} + +export interface Delegation { + /** Party which is delegating. */ + party: string; + /** Node ID to delegate to. */ + nodeId: string; + /** Amount delegated. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Epoch of delegation. */ + epochSeq: string; +} + +/** Details for a single reward payment */ +export interface Reward { + /** Asset ID in which the reward is being paid. */ + assetId: string; + /** Party ID to whom the reward is being paid. */ + partyId: string; + /** Epoch in which the reward is being paid. */ + epoch: number; + /** Amount paid as a reward. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; + /** Percentage of total rewards paid in the epoch. */ + percentageOfTotal: string; + /** Timestamp at which the reward was paid as Unix nano time. */ + receivedAt: number; + /** Market ID in which the reward is being paid. */ + marketId: string; + /** Type of reward being paid. */ + rewardType: string; +} + +/** Details for rewards for a single asset */ +export interface RewardSummary { + /** Asset ID in which the reward is being paid. */ + assetId: string; + /** Party ID to whom the reward is being paid. */ + partyId: string; + /** Total amount of rewards paid in the asset. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; +} + +/** Details for rewards for a combination of asset, market, and reward type in a given epoch */ +export interface EpochRewardSummary { + /** Epoch in which the reward is being paid. */ + epoch: number; + /** Asset ID in which the reward is being paid. */ + assetId: string; + /** Market ID in which the reward is being paid. */ + marketId: string; + /** Type of reward being paid. */ + rewardType: string; + /** Amount distributed. This field is an unsigned integer scaled to the asset's decimal places. */ + amount: string; +} + +export interface StateValueProposal { + /** State variable ID. */ + stateVarId: string; + /** Event ID. */ + eventId: string; + /** Key value tolerance triplets. */ + kvb: KeyValueBundle[]; +} + +export interface KeyValueBundle { + key: string; + tolerance: string; + value: StateVarValue | undefined; +} + +export interface StateVarValue { + scalarVal?: ScalarValue | undefined; + vectorVal?: VectorValue | undefined; + matrixVal?: MatrixValue | undefined; +} + +export interface ScalarValue { + value: string; +} + +export interface VectorValue { + value: string[]; +} + +export interface MatrixValue { + value: VectorValue[]; +} diff --git a/libs/wallet/src/connectors/vega-connector.ts b/libs/wallet/src/connectors/vega-connector.ts index 27327a916..c58970d46 100644 --- a/libs/wallet/src/connectors/vega-connector.ts +++ b/libs/wallet/src/connectors/vega-connector.ts @@ -1,68 +1,32 @@ import { WalletClientError } from '@vegaprotocol/wallet-client'; -import type * as Schema from '@vegaprotocol/types'; -import type { PeggedReference } from '@vegaprotocol/types'; +import type { + OrderSubmission, + LiquidityProvisionSubmission as LiquidityProvisionBody, + DelegateSubmission, + UndelegateSubmission, + OrderCancellation, + OrderAmendment, + VoteSubmission, + WithdrawSubmission, + ProposalSubmission, + BatchMarketInstructions, + Transfer, +} from '@vegaprotocol/protos/dist/vega/commands/v1'; export interface LiquidityProvisionSubmission { liquidityProvisionSubmission: LiquidityProvisionBody; pubKey: string; propagate: boolean; } -export interface LiquidityProvisionBody { - marketId: string; - commitmentAmount: string; - fee: string; - buys?: PeggedOrders[]; - sells?: PeggedOrders[]; -} - -export interface PeggedOrders { - offset: string; - proportion: string; - reference: PeggedReference; -} export interface DelegateSubmissionBody { - delegateSubmission: { - nodeId: string; - amount: string; - }; + delegateSubmission: DelegateSubmission; } export interface UndelegateSubmissionBody { - undelegateSubmission: { - nodeId: string; - amount: string; - method: 'METHOD_NOW' | 'METHOD_AT_END_OF_EPOCH'; - }; + undelegateSubmission: UndelegateSubmission; } -export interface OrderSubmission { - marketId: string; - reference?: string; - type: Schema.OrderType; - side: Schema.Side; - timeInForce: Schema.OrderTimeInForce; - size: string; - price?: string; - expiresAt?: string; - postOnly?: boolean; - reduceOnly?: boolean; -} - -export interface OrderCancellation { - orderId?: string; - marketId?: string; -} - -export interface OrderAmendment { - marketId: string; - orderId: string; - reference?: string; - timeInForce: Schema.OrderTimeInForce; - sizeDelta?: number; - price?: string; - expiresAt?: string; -} export interface OrderSubmissionBody { orderSubmission: OrderSubmission; } @@ -76,230 +40,11 @@ export interface OrderAmendmentBody { } export interface VoteSubmissionBody { - voteSubmission: { - value: Schema.VoteValue; - proposalId: string; - }; + voteSubmission: VoteSubmission; } export interface WithdrawSubmissionBody { - withdrawSubmission: { - amount: string; - asset: string; - ext: { - erc20: { - receiverAddress: string; - }; - }; - }; -} - -interface ProposalNewMarketTerms { - newMarket: { - changes: { - decimalPlaces: string; - positionDecimalPlaces: string; - lpPriceRange: string; - linearSlippageFactor: string; - quadraticSlippageFactor: string; - instrument: { - name: string; - code: string; - future: { - settlementAsset: string; - quoteName: string; - dataSourceSpecForSettlementData: DataSourceSpec; - dataSourceSpecForTradingTermination: DataSourceSpec; - dataSourceSpecBinding: DataSourceSpecBinding; - }; - }; - metadata?: string[]; - priceMonitoringParameters?: PriceMonitoringParameters; - liquidityMonitoringParameters?: { - targetStakeParameters: { - timeWindow: string; - scalingFactor: number; - }; - triggeringRatio: string; - auctionExtension: string; - }; - logNormal: LogNormal; - }; - }; - closingTimestamp: number; - enactmentTimestamp: number; -} - -interface ProposalUpdateMarketTerms { - updateMarket: { - marketId: string; - changes: { - linearSlippageFactor: string; - quadraticSlippageFactor: string; - instrument: { - code: string; - future: { - quoteName: string; - settlementPriceDecimals: number; - dataSourceSpecForSettlementPrice: DataSourceSpec; - dataSourceSpecForTradingTermination: DataSourceSpec; - dataSourceSpecBinding: DataSourceSpecBinding; - }; - }; - priceMonitoringParameters?: PriceMonitoringParameters; - logNormal: LogNormal; - }; - }; - closingTimestamp: number; - enactmentTimestamp: number; -} - -interface ProposalNetworkParameterTerms { - updateNetworkParameter: { - changes: { - key: string; - value: string; - }; - }; - closingTimestamp: number; - enactmentTimestamp: number; -} - -interface ProposalFreeformTerms { - newFreeform: Record; - closingTimestamp: number; -} - -interface ProposalNewAssetTerms { - newAsset: { - changes: { - name: string; - symbol: string; - decimals: string; - quantum: string; - erc20: { - contractAddress: string; - withdrawThreshold: string; - lifetimeLimit: string; - }; - }; - }; - closingTimestamp: number; - enactmentTimestamp: number; - validationTimestamp: number; -} - -interface ProposalUpdateAssetTerms { - updateAsset: { - assetId: string; - changes: { - quantum: string; - erc20: { - withdrawThreshold: string; - lifetimeLimit: string; - }; - }; - }; - closingTimestamp: number; - enactmentTimestamp: number; -} - -interface DataSourceSpecBinding { - settlementDataProperty: string; - tradingTerminationProperty: string; -} - -interface InternalDataSourceSpec { - internal: { - time: { - conditions: Condition[]; - }; - }; -} - -interface ExternalDataSourceSpec { - external: { - oracle: { - signers: Signer[]; - filters: Filter[]; - }; - }; -} - -type DataSourceSpec = InternalDataSourceSpec | ExternalDataSourceSpec; - -type Signer = - | { - ethAddress: { - address: string; - }; - } - | { - pubKey: { - key: string; - }; - }; - -interface Filter { - key: DefaultFilterKey | IntegerFilterKey; - conditions?: Condition[]; -} - -interface DefaultFilterKey { - name: string; - type: 'TYPE_DECIMAL' | 'TYPE_BOOLEAN' | 'TYPE_TIMESTAMP' | 'TYPE_STRING'; -} - -interface IntegerFilterKey { - name: string; - type: 'TYPE_INTEGER'; - numberDecimalPlaces: string; -} - -type ConditionOperator = - | 'OPERATOR_EQUALS' - | 'OPERATOR_GREATER_THAN' - | 'OPERATOR_GREATER_THAN_OR_EQUAL' - | 'OPERATOR_LESS_THAN' - | 'OPERATOR_LESS_THAN_OR_EQUAL'; - -interface Condition { - operator: ConditionOperator; - value: string; -} - -interface LogNormal { - tau: number; - riskAversionParameter: number; - params: { - mu: number; - r: number; - sigma: number; - }; -} - -interface PriceMonitoringParameters { - triggers: Trigger[]; -} - -interface Trigger { - horizon: string; - probability: string; - auctionExtension: string; -} - -export interface ProposalSubmission { - rationale: { - description: string; - title: string; - }; - terms: - | ProposalFreeformTerms - | ProposalNewMarketTerms - | ProposalUpdateMarketTerms - | ProposalNetworkParameterTerms - | ProposalNewAssetTerms - | ProposalUpdateAssetTerms; + withdrawSubmission: WithdrawSubmission; } export interface ProposalSubmissionBody { @@ -307,47 +52,9 @@ export interface ProposalSubmissionBody { } export interface BatchMarketInstructionSubmissionBody { - batchMarketInstructions: { - // Will be processed in this order and the total amount of instructions is - // restricted by the net param spam.protection.max.batchSize - cancellations?: OrderCancellation[]; - amendments?: OrderAmendment[]; - // Note: If multiple orders are submitted the first order ID is determined by hashing the signature of the transaction - // (see determineId function). For each subsequent order's ID, a hash of the previous orders ID is used - submissions?: OrderSubmission[]; - }; + batchMarketInstructions: BatchMarketInstructions; } -interface TransferBase { - fromAccountType: Schema.AccountType; - to: string; - toAccountType: Schema.AccountType; - asset: string; - amount: string; - reference?: string; -} - -export interface OneOffTransfer extends TransferBase { - oneOff: { - deliverOn?: number; // omit for immediate - }; -} - -export interface RecurringTransfer extends TransferBase { - recurring: { - factor: string; - startEpoch: number; - endEpoch?: number; - dispatchStrategy?: { - assetForMetric: string; - metric: Schema.DispatchMetric; - markets?: string[]; - }; - }; -} - -export type Transfer = OneOffTransfer | RecurringTransfer; - export interface TransferBody { transfer: Transfer; } diff --git a/package.json b/package.json index 0409e62c6..3994485cc 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "@sentry/nextjs": "^6.19.3", "@sentry/react": "^6.19.2", "@sentry/tracing": "^6.19.2", + "@vegaprotocol/protos": "^0.4.0", "@vegaprotocol/wallet-client": "0.1.9", "@walletconnect/ethereum-provider": "^2.6.0", "@web3-react/coinbase-wallet": "8.1.2-beta.0", @@ -199,6 +200,8 @@ "tailwindcss": "^3.2.4", "ts-jest": "27.1.4", "ts-node": "10.9.1", + "ts-proto": "^1.148.2", + "ts-protoc-gen": "^0.15.0", "tslib": "^2.0.0", "type-fest": "^3.8.0", "typescript": "^5.0.4", diff --git a/yarn.lock b/yarn.lock index 240b6bd3b..db00d1620 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4329,6 +4329,59 @@ schema-utils "^3.0.0" source-map "^0.7.3" +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + "@radix-ui/number@1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@radix-ui/number/-/number-1.0.0.tgz#4c536161d0de750b3f5d55860fc3de46264f897b" @@ -7313,6 +7366,11 @@ resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.186.tgz#862e5514dd7bd66ada6c70ee5fce844b06c8ee97" integrity sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw== +"@types/long@^4.0.1": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== + "@types/mdast@^3.0.0": version "3.0.10" resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" @@ -7363,6 +7421,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.4.tgz#54be907698f40de8a45770b48486aa3cbd3adff7" integrity sha512-WdlVphvfR/GJCLEMbNA8lJ0lhFNBj4SW3O+O5/cEGw9oYrv0al9zTwuQsq+myDUXgNx2jgBynoVgZ2MMJ6pbow== +"@types/node@>=13.7.0": + version "20.3.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.0.tgz#719498898d5defab83c3560f45d8498f58d11938" + integrity sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ== + "@types/node@^12.12.54": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -7398,6 +7461,11 @@ resolved "https://registry.yarnpkg.com/@types/npmlog/-/npmlog-4.1.4.tgz#30eb872153c7ead3e8688c476054ddca004115f6" integrity sha512-WKG4gTr8przEZBiJ5r3s8ZIAoMXNbOgQ+j/d5O4X3x6kZJRLNvyUJuUK/KoG3+8BaOHPhp2m7WC6JKKeovDSzQ== +"@types/object-hash@^1.3.0": + version "1.3.4" + resolved "https://registry.yarnpkg.com/@types/object-hash/-/object-hash-1.3.4.tgz#079ba142be65833293673254831b5e3e847fe58b" + integrity sha512-xFdpkAkikBgqBdG9vIlsqffDV8GpvnPEzs0IUtr1v3BEB97ijsFQ4RXVbUZwjFThhB4MDSTUfvmxUD5PGx0wXA== + "@types/parse-json@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" @@ -7845,6 +7913,14 @@ "@typescript-eslint/types" "5.40.0" eslint-visitor-keys "^3.3.0" +"@vegaprotocol/protos@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@vegaprotocol/protos/-/protos-0.4.0.tgz#3c5640e1d42c3d5625a5d7c7457ddc41124cb0c8" + integrity sha512-1d1J1JTTuaHlfeVsMCzMnQ7l8T9XH59UJJ1Q9eLU//lDAkK/5eEoTkdkyh5g6j3PoZ5xrM/QHJijjx7w8SFhwg== + dependencies: + protobuf-codec "^1.0.6" + type-fest "^3.6.0" + "@vegaprotocol/wallet-client@0.1.9": version "0.1.9" resolved "https://registry.yarnpkg.com/@vegaprotocol/wallet-client/-/wallet-client-0.1.9.tgz#8c6a71c8b2222b3de5d73cade8fc6db57e332de9" @@ -10626,6 +10702,11 @@ cardinal@^2.1.1: ansicolors "~0.3.2" redeyed "~2.1.0" +case-anything@^2.1.10: + version "2.1.13" + resolved "https://registry.yarnpkg.com/case-anything/-/case-anything-2.1.13.tgz#0cdc16278cb29a7fcdeb072400da3f342ba329e9" + integrity sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng== + case-sensitive-paths-webpack-plugin@^2.3.0: version "2.4.0" resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.4.0.tgz#db64066c6422eed2e08cc14b986ca43796dbc6d4" @@ -12155,6 +12236,11 @@ dataloader@2.1.0: resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.1.0.tgz#c69c538235e85e7ac6c6c444bae8ecabf5de9df7" integrity sha512-qTcEYLen3r7ojZNgVUaRggOI+KM7jrKxXeSHhogh/TWxYMeONEMqY+hmkobiYQozsGIyg9OYVzO4ZIfoB4I0pQ== +dataloader@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8" + integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw== + date-fns-tz@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/date-fns-tz/-/date-fns-tz-2.0.0.tgz#1b14c386cb8bc16fc56fe333d4fc34ae1d1099d5" @@ -12432,6 +12518,11 @@ detect-indent@^6.0.0: resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== +detect-libc@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== + detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -12687,6 +12778,13 @@ dotenv@~10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dprint-node@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/dprint-node/-/dprint-node-1.0.7.tgz#f571eaf61affb3a696cff1bdde78a021875ba540" + integrity sha512-NTZOW9A7ipb0n7z7nC3wftvsbceircwVHSgzobJsEQa+7RnOMbhrfX5IflA6CtC4GA63DSAiHYXa4JKEy9F7cA== + dependencies: + detect-libc "^1.0.3" + dset@^3.1.1, dset@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.2.tgz#89c436ca6450398396dc6538ea00abc0c54cd45a" @@ -14785,6 +14883,11 @@ globule@^1.0.0: lodash "^4.17.21" minimatch "~3.0.2" +google-protobuf@^3.15.5: + version "3.21.2" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.21.2.tgz#4580a2bea8bbb291ee579d1fefb14d6fa3070ea4" + integrity sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA== + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -17728,6 +17831,11 @@ log-update@^4.0.0: slice-ansi "^4.0.0" wrap-ansi "^6.2.0" +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -18721,6 +18829,11 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== +nanoassert@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-2.0.0.tgz#a05f86de6c7a51618038a620f88878ed1e490c09" + integrity sha512-7vO7n28+aYO4J+8w96AzhmU8G+Y/xpPDJz/se19ICsqj/momRbb9mh9ZUtkoJ5X3nTnPdhEJyc0qnM6yAsHBaA== + nanoid@3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" @@ -19085,6 +19198,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-hash@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df" + integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA== + object-hash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" @@ -20530,6 +20648,32 @@ property-information@^6.0.0: resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.2.0.tgz#b74f522c31c097b5149e3c3cb8d7f3defd986a1d" integrity sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg== +protobuf-codec@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/protobuf-codec/-/protobuf-codec-1.0.6.tgz#46b93b76966e41e86336d5e7bec53f6f2d25c3dd" + integrity sha512-tQ9FGcca9g6COFr1yft+B/JYSafx6xsxak9YL0yCQ3FAM9HkbgEUZWyz1NbPcTN3Efw2YEVEBxaHr1+P9p+eJw== + dependencies: + nanoassert "^2.0.0" + +protobufjs@^6.11.3, protobufjs@^6.8.8: + version "6.11.3" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.3.tgz#637a527205a35caa4f3e2a9a4a13ddffe0e7af74" + integrity sha512-xL96WDdCZYdU7Slin569tFX712BxsxslWwAfAhCYjQKGTq7dAU91Lomy6nLLhh/dyGhk/YH4TwTSRxTzhuHyZg== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + protocols@^1.4.0: version "1.4.8" resolved "https://registry.yarnpkg.com/protocols/-/protocols-1.4.8.tgz#48eea2d8f58d9644a4a32caae5d5db290a075ce8" @@ -23617,6 +23761,41 @@ ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== +ts-poet@^6.4.1: + version "6.4.1" + resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-6.4.1.tgz#e68d314a07cf9c0d568a3bfd87023ec91ff77964" + integrity sha512-AjZEs4h2w4sDfwpHMxQKHrTlNh2wRbM5NRXmLz0RiH+yPGtSQFbe9hBpNocU8vqVNgfh0BIOiXR80xDz3kKxUQ== + dependencies: + dprint-node "^1.0.7" + +ts-proto-descriptors@1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.9.0.tgz#0ed5631f11851846c8de21be2bff346719edce71" + integrity sha512-Ui8zA5Q4Jnq6JIGRraUWvECrqixxtwwin8GkhIkvwCpR+JcSPsxWe8HfTj5eHfyruGYI6Zjf96XlC87hTakHfQ== + dependencies: + long "^4.0.0" + protobufjs "^6.8.8" + +ts-proto@^1.148.2: + version "1.148.2" + resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.148.2.tgz#16abf75bbbfb3e5093e8f0c064721e7ed1149e80" + integrity sha512-sd3STxwE6/6VpASSFnIySID2lkVGwqUU9gnz0Vr1DmB83VjlJpVSeCuEj6UHsrKy7AU2UxchOfcM95LJh0uwjg== + dependencies: + "@types/object-hash" "^1.3.0" + case-anything "^2.1.10" + dataloader "^1.4.0" + object-hash "^1.3.1" + protobufjs "^6.11.3" + ts-poet "^6.4.1" + ts-proto-descriptors "1.9.0" + +ts-protoc-gen@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/ts-protoc-gen/-/ts-protoc-gen-0.15.0.tgz#2fec5930b46def7dcc9fa73c060d770b7b076b7b" + integrity sha512-TycnzEyrdVDlATJ3bWFTtra3SCiEP0W0vySXReAuEygXCUr1j2uaVyL0DhzjwuUdQoW5oXPwk6oZWeA0955V+g== + dependencies: + google-protobuf "^3.15.5" + tsconfig-paths-webpack-plugin@3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-3.5.2.tgz#01aafff59130c04a8c4ebc96a3045c43c376449a" @@ -23734,6 +23913,11 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^3.6.0: + version "3.11.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.11.1.tgz#d8e62c7f42e14537d5b8796de5450d541f3a33a7" + integrity sha512-aCuRNRERRVh33lgQaJRlUxZqzfhzwTrsE98Mc3o3VXqmiaQdHacgUtJ0esp+7MvZ92qhtzKPeusaX6vIEcoreA== + type-fest@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.8.0.tgz#ce80d1ca7c7d11c5540560999cbd410cb5b3a385"