@trezor/protobuf
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -0,1 +1,8 @@ | ||
# 1.0.4 | ||
- chore: remove `bytebuffer` dependency (9b2f9def0) | ||
- chore(connect): use `tslib` as dependency in all public libs (606ecc63b) | ||
- chore(repo): update tsx (53de3e3a8) | ||
- feat(suite): add Solana support (f2a89b34f) | ||
# 1.0.3 | ||
@@ -2,0 +9,0 @@ |
@@ -1,2 +0,2 @@ | ||
import ByteBuffer from 'bytebuffer'; | ||
/// <reference types="node" /> | ||
import { Type, Message } from 'protobufjs/light'; | ||
@@ -6,5 +6,5 @@ export declare function messageToJSON(MessageParam: Message<Record<string, unknown>>, fields: Type['fields']): { | ||
}; | ||
export declare const decode: (MessageParam: Type, data: ByteBuffer) => { | ||
export declare const decode: (MessageParam: Type, data: Buffer) => { | ||
[key: string]: any; | ||
}; | ||
//# sourceMappingURL=decode.d.ts.map |
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decode = exports.messageToJSON = void 0; | ||
const bytebuffer_1 = __importDefault(require("bytebuffer")); | ||
const tslib_1 = require("tslib"); | ||
const utils_1 = require("./utils"); | ||
@@ -26,3 +12,3 @@ const transform = (field, value) => { | ||
if (field.type === 'bytes') { | ||
return bytebuffer_1.default.wrap(value).toString('hex'); | ||
return Buffer.from(value).toString('hex'); | ||
} | ||
@@ -46,3 +32,3 @@ if (field.long) { | ||
function messageToJSON(MessageParam, fields) { | ||
const message = __rest(MessageParam, []); | ||
const message = tslib_1.__rest(MessageParam, []); | ||
const res = {}; | ||
@@ -63,5 +49,3 @@ Object.keys(fields).forEach(key => { | ||
const decode = (MessageParam, data) => { | ||
const buff = data.toBuffer(); | ||
const a = new Uint8Array(buff); | ||
const decoded = MessageParam.decode(a); | ||
const decoded = MessageParam.decode(new Uint8Array(data)); | ||
return messageToJSON(decoded, decoded.$type.fields); | ||
@@ -68,0 +52,0 @@ }; |
@@ -1,5 +0,5 @@ | ||
import ByteBuffer from 'bytebuffer'; | ||
/// <reference types="node" /> | ||
import { Type } from 'protobufjs/light'; | ||
export declare function patch(Message: Type, payload: any): any; | ||
export declare const encode: (Message: Type, data: Record<string, unknown>) => ByteBuffer; | ||
export declare const encode: (Message: Type, data: Record<string, unknown>) => Buffer; | ||
//# sourceMappingURL=encode.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.encode = exports.patch = void 0; | ||
const bytebuffer_1 = __importDefault(require("bytebuffer")); | ||
const utils_1 = require("./utils"); | ||
@@ -62,9 +58,6 @@ const transform = (fieldType, value) => { | ||
const message = Message.fromObject(payload); | ||
const buffer = Message.encode(message).finish(); | ||
const bytebuffer = new bytebuffer_1.default(buffer.byteLength); | ||
bytebuffer.append(buffer); | ||
bytebuffer.reset(); | ||
return bytebuffer; | ||
const bytes = Message.encode(message).finish(); | ||
return Buffer.from(bytes); | ||
}; | ||
exports.encode = encode; | ||
//# sourceMappingURL=encode.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createMessageFromType = exports.createMessageFromName = exports.parseConfigure = exports.Messages = void 0; | ||
__exportStar(require("./decode"), exports); | ||
__exportStar(require("./encode"), exports); | ||
exports.Messages = __importStar(require("./messages")); | ||
__exportStar(require("./types"), exports); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./decode"), exports); | ||
tslib_1.__exportStar(require("./encode"), exports); | ||
exports.Messages = tslib_1.__importStar(require("./messages")); | ||
tslib_1.__exportStar(require("./types"), exports); | ||
var utils_1 = require("./utils"); | ||
@@ -35,0 +10,0 @@ Object.defineProperty(exports, "parseConfigure", { enumerable: true, get: function () { return utils_1.parseConfigure; } }); |
@@ -172,2 +172,3 @@ /// <reference types="node" /> | ||
no_script_type?: boolean; | ||
chunkify?: boolean; | ||
}; | ||
@@ -183,2 +184,3 @@ export type MessageSignature = { | ||
coin_name?: string; | ||
chunkify?: boolean; | ||
}; | ||
@@ -1105,2 +1107,3 @@ export type CoinJoinRequest = { | ||
encoded_network?: ArrayBuffer; | ||
chunkify?: boolean; | ||
}; | ||
@@ -1115,2 +1118,3 @@ export type EthereumMessageSignature = { | ||
address: string; | ||
chunkify?: boolean; | ||
}; | ||
@@ -1335,3 +1339,10 @@ export type EthereumSignTypedHash = { | ||
export type CancelAuthorization = {}; | ||
export type RebootToBootloader = {}; | ||
export declare enum BootCommand { | ||
STOP_AND_WAIT = 0, | ||
INSTALL_UPGRADE = 1 | ||
} | ||
export type RebootToBootloader = { | ||
boot_command?: BootCommand; | ||
firmware_header?: string; | ||
}; | ||
export type GetNonce = {}; | ||
@@ -1508,2 +1519,3 @@ export type Nonce = { | ||
show_display?: boolean; | ||
chunkify?: boolean; | ||
}; | ||
@@ -1513,5 +1525,15 @@ export type SolanaAddress = { | ||
}; | ||
export type SolanaTxTokenAccountInfo = { | ||
base_address: string; | ||
token_program: string; | ||
token_mint: string; | ||
token_account: string; | ||
}; | ||
export type SolanaTxAdditionalInfo = { | ||
token_accounts_infos: SolanaTxTokenAccountInfo[]; | ||
}; | ||
export type SolanaSignTx = { | ||
address_n: number[]; | ||
serialized_tx: string; | ||
additional_info?: SolanaTxAdditionalInfo; | ||
}; | ||
@@ -2002,2 +2024,4 @@ export type SolanaTxSignature = { | ||
SolanaAddress: SolanaAddress; | ||
SolanaTxTokenAccountInfo: SolanaTxTokenAccountInfo; | ||
SolanaTxAdditionalInfo: SolanaTxAdditionalInfo; | ||
SolanaSignTx: SolanaSignTx; | ||
@@ -2004,0 +2028,0 @@ SolanaTxSignature: SolanaTxSignature; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TezosBallotType = exports.TezosContractType = exports.StellarSignerType = exports.StellarMemoType = exports.StellarAssetType = exports.NEMImportanceTransferMode = exports.NEMModificationType = exports.NEMSupplyChangeType = exports.NEMMosaicLevy = exports.MoneroNetworkType = exports.Enum_WordRequestType = exports.RecoveryDeviceType = exports.SdProtectOperationType = exports.Enum_Capability = exports.Enum_HomescreenFormat = exports.Enum_SafetyCheckLevel = exports.Enum_BackupType = exports.EthereumDataType = exports.EthereumDefinitionType = exports.DebugPhysicalButton = exports.DebugButton = exports.Enum_PinMatrixRequestType = exports.Enum_ButtonRequestType = exports.FailureType = exports.CardanoTxWitnessType = exports.CardanoTxSigningMode = exports.CardanoCVoteRegistrationFormat = exports.CardanoTxAuxiliaryDataSupplementType = exports.CardanoPoolRelayType = exports.CardanoCertificateType = exports.CardanoTxOutputSerializationFormat = exports.CardanoNativeScriptHashDisplayFormat = exports.CardanoNativeScriptType = exports.CardanoAddressType = exports.CardanoDerivationType = exports.Enum_RequestType = exports.AmountUnit = exports.DecredStakingSpendType = exports.Enum_OutputScriptType = exports.Enum_InputScriptType = exports.BinanceTimeInForce = exports.BinanceOrderSide = exports.BinanceOrderType = exports.DeviceModelInternal = void 0; | ||
exports.TezosBallotType = exports.TezosContractType = exports.StellarSignerType = exports.StellarMemoType = exports.StellarAssetType = exports.NEMImportanceTransferMode = exports.NEMModificationType = exports.NEMSupplyChangeType = exports.NEMMosaicLevy = exports.MoneroNetworkType = exports.BootCommand = exports.Enum_WordRequestType = exports.RecoveryDeviceType = exports.SdProtectOperationType = exports.Enum_Capability = exports.Enum_HomescreenFormat = exports.Enum_SafetyCheckLevel = exports.Enum_BackupType = exports.EthereumDataType = exports.EthereumDefinitionType = exports.DebugPhysicalButton = exports.DebugButton = exports.Enum_PinMatrixRequestType = exports.Enum_ButtonRequestType = exports.FailureType = exports.CardanoTxWitnessType = exports.CardanoTxSigningMode = exports.CardanoCVoteRegistrationFormat = exports.CardanoTxAuxiliaryDataSupplementType = exports.CardanoPoolRelayType = exports.CardanoCertificateType = exports.CardanoTxOutputSerializationFormat = exports.CardanoNativeScriptHashDisplayFormat = exports.CardanoNativeScriptType = exports.CardanoAddressType = exports.CardanoDerivationType = exports.Enum_RequestType = exports.AmountUnit = exports.DecredStakingSpendType = exports.Enum_OutputScriptType = exports.Enum_InputScriptType = exports.BinanceTimeInForce = exports.BinanceOrderSide = exports.BinanceOrderType = exports.DeviceModelInternal = void 0; | ||
var DeviceModelInternal; | ||
@@ -280,2 +280,7 @@ (function (DeviceModelInternal) { | ||
})(Enum_WordRequestType || (exports.Enum_WordRequestType = Enum_WordRequestType = {})); | ||
var BootCommand; | ||
(function (BootCommand) { | ||
BootCommand[BootCommand["STOP_AND_WAIT"] = 0] = "STOP_AND_WAIT"; | ||
BootCommand[BootCommand["INSTALL_UPGRADE"] = 1] = "INSTALL_UPGRADE"; | ||
})(BootCommand || (exports.BootCommand = BootCommand = {})); | ||
var MoneroNetworkType; | ||
@@ -282,0 +287,0 @@ (function (MoneroNetworkType) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createMessageFromType = exports.createMessageFromName = exports.parseConfigure = exports.isPrimitiveField = void 0; | ||
const protobuf = __importStar(require("protobufjs/light")); | ||
const tslib_1 = require("tslib"); | ||
const protobuf = tslib_1.__importStar(require("protobufjs/light")); | ||
const primitiveTypes = [ | ||
@@ -29,0 +7,0 @@ 'bool', |
{ | ||
"name": "@trezor/protobuf", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"license": "See LICENSE.md in repo root", | ||
@@ -33,3 +33,2 @@ "repository": { | ||
"dependencies": { | ||
"bytebuffer": "^5.0.1", | ||
"long": "^4.0.0", | ||
@@ -42,5 +41,8 @@ "protobufjs": "7.2.5" | ||
"rimraf": "^5.0.5", | ||
"tsx": "^3.14.0", | ||
"tsx": "^4.6.2", | ||
"typescript": "5.3.2" | ||
}, | ||
"peerDependencies": { | ||
"tslib": "^2.6.2" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
414579
12273
+ Addedtslib@2.8.1(transitive)
- Removedbytebuffer@^5.0.1
- Removedbytebuffer@5.0.1(transitive)
- Removedlong@3.2.0(transitive)