UNPKG

ccxt

Version:

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

37 lines (34 loc) 1.64 kB
// ---------------------------------------------------------------------------- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code // EDIT THE CORRESPONDENT .ts FILE INSTEAD import { PubKey } from './cosmos/crypto/secp256k1/keys.js'; import { TxExtension } from './dydxprotocol/accountplus/tx.js'; import { MsgPlaceOrder, MsgCancelOrder, MsgBatchCancel, } from './dydxprotocol/clob/tx.js'; import { MsgWithdrawFromSubaccount, MsgDepositToSubaccount, } from './dydxprotocol/sending/transfer.js'; import { MsgCreateTransfer } from './dydxprotocol/sending/tx.js'; import { Any } from "./google/protobuf/any.js"; export const registry = { // clob '/dydxprotocol.clob.MsgPlaceOrder': MsgPlaceOrder, '/dydxprotocol.clob.MsgCancelOrder': MsgCancelOrder, '/dydxprotocol.clob.MsgBatchCancel': MsgBatchCancel, // sending '/dydxprotocol.sending.MsgCreateTransfer': MsgCreateTransfer, '/dydxprotocol.sending.MsgWithdrawFromSubaccount': MsgWithdrawFromSubaccount, '/dydxprotocol.sending.MsgDepositToSubaccount': MsgDepositToSubaccount, '/dydxprotocol.accountplus.TxExtension': TxExtension, '/cosmos.crypto.secp256k1.PubKey': PubKey, }; export function encodeAsAny(encodeObject) { const { typeUrl, value } = encodeObject; const type = registry[typeUrl]; if (!type) { throw new Error(`Unsupport type url: ${typeUrl}`); } const encodedMsg = type.encode(type.fromPartial(value)).finish(); return Any.fromPartial({ typeUrl: typeUrl, value: encodedMsg, }); }