Socket
Socket
Sign inDemoInstall

@helium/transactions

Package Overview
Dependencies
Maintainers
4
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helium/transactions - npm Package Compare versions

Comparing version 4.6.2 to 4.7.0

4

build/PaymentV2.d.ts
import Transaction from './Transaction';
import { Addressable, Base64Memo, SignableKeypair, TokenType } from './types';
import { Addressable, Base64Memo, SignableKeypair } from './types';
interface PaymentOptions {

@@ -14,3 +14,3 @@ payer?: Addressable;

memo?: Base64Memo;
tokenType?: TokenType;
tokenType?: string;
}

@@ -17,0 +17,0 @@ interface SignOptions {

@@ -29,3 +29,2 @@ "use strict";

const utils_1 = require("./utils");
const types_1 = require("./types");
class PaymentV2 extends Transaction_1.default {

@@ -62,3 +61,3 @@ constructor(opts) {

memo: utils_1.toString(p.memo),
tokenType: p.tokenType === undefined ? types_1.TokenType.hnt : utils_1.toNumber(p.tokenType),
tokenType: utils_1.toTicker(utils_1.toNumber(p.tokenType)),
}));

@@ -86,3 +85,3 @@ const fee = utils_1.toNumber((_c = decoded.paymentV2) === null || _c === void 0 ? void 0 : _c.fee);

const Payment = proto_1.default.helium.payment;
const payments = this.payments.map(({ payee, amount, memo, tokenType, }) => {
const payments = this.payments.map(({ payee, amount, memo, tokenType }) => {
const memoBuffer = memo ? Buffer.from(memo, 'base64') : undefined;

@@ -93,3 +92,3 @@ return Payment.create({

memo: memoBuffer ? JSLong.fromBytes(Array.from(memoBuffer), true, true) : undefined,
tokenType: tokenType,
tokenType: utils_1.toTokenType(tokenType),
});

@@ -96,0 +95,0 @@ });

import Transaction from './Transaction';
import { Addressable, SignableKeypair } from './types';
interface Options {
tokenType: number;
tokenType: string;
startEpoch: number;

@@ -18,3 +18,3 @@ endEpoch: number;

export default class SubnetworkRewardsV1 extends Transaction {
tokenType?: number;
tokenType?: string;
startEpoch?: number;

@@ -21,0 +21,0 @@ endEpoch?: number;

@@ -9,3 +9,2 @@ "use strict";

const utils_1 = require("./utils");
const types_1 = require("./types");
class SubnetworkRewardsV1 extends Transaction_1.default {

@@ -41,3 +40,3 @@ constructor(opts) {

const decoded = proto_1.default.helium.blockchain_txn.decode(buf);
const tokenType = utils_1.toNumber((_a = decoded.subnetworkRewards) === null || _a === void 0 ? void 0 : _a.tokenType) || types_1.TokenType.hnt;
const tokenType = utils_1.toTicker(utils_1.toNumber((_a = decoded.subnetworkRewards) === null || _a === void 0 ? void 0 : _a.tokenType));
const startEpoch = utils_1.toNumber((_b = decoded.subnetworkRewards) === null || _b === void 0 ? void 0 : _b.startEpoch) || 0;

@@ -66,3 +65,3 @@ const endEpoch = utils_1.toNumber((_c = decoded.subnetworkRewards) === null || _c === void 0 ? void 0 : _c.endEpoch) || 0;

return SubnetworkRewards.create({
tokenType: this.tokenType,
tokenType: utils_1.toTokenType(this.tokenType),
startEpoch: this.startEpoch,

@@ -69,0 +68,0 @@ endEpoch: this.endEpoch,

@@ -8,3 +8,3 @@ import Transaction from './Transaction';

nonce?: number;
tokenType?: number;
tokenType?: string;
signature?: Uint8Array;

@@ -20,3 +20,3 @@ }

nonce?: number;
tokenType?: number;
tokenType?: string;
signature?: Uint8Array;

@@ -23,0 +23,0 @@ type: string;

@@ -49,3 +49,3 @@ "use strict";

nonce: this.nonce,
tokenType: this.tokenType,
tokenType: utils_1.toTokenType(this.tokenType),
signature: this.signature && !forSigning ? utils_1.toUint8Array(this.signature) : null,

@@ -60,3 +60,3 @@ });

const amount = utils_1.toNumber(tokenRedeem === null || tokenRedeem === void 0 ? void 0 : tokenRedeem.amount) || 0;
const tokenType = utils_1.toNumber(tokenRedeem === null || tokenRedeem === void 0 ? void 0 : tokenRedeem.tokenType);
const tokenType = utils_1.toTicker(utils_1.toNumber(tokenRedeem === null || tokenRedeem === void 0 ? void 0 : tokenRedeem.tokenType));
const fee = utils_1.toNumber(tokenRedeem === null || tokenRedeem === void 0 ? void 0 : tokenRedeem.fee);

@@ -63,0 +63,0 @@ const nonce = utils_1.toNumber(tokenRedeem === null || tokenRedeem === void 0 ? void 0 : tokenRedeem.nonce);

@@ -9,2 +9,4 @@ /// <reference types="node" />

export declare const toNumber: (long: Long | number | undefined | null) => number | undefined;
export declare const toTokenType: (ticker?: string | undefined) => number;
export declare const toTicker: (tokenType?: number | undefined) => string;
//# sourceMappingURL=utils.d.ts.map

@@ -6,5 +6,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.toNumber = exports.toString = exports.toAddressable = exports.EMPTY_SIGNATURE = exports.toUint8Array = void 0;
exports.toTicker = exports.toTokenType = exports.toNumber = exports.toString = exports.toAddressable = exports.EMPTY_SIGNATURE = exports.toUint8Array = void 0;
const address_1 = __importDefault(require("@helium/address"));
const long_1 = __importDefault(require("long"));
const types_1 = require("./types");
const toUint8Array = (str) => Uint8Array.from(Buffer.from(str || ''));

@@ -38,2 +39,30 @@ exports.toUint8Array = toUint8Array;

exports.toNumber = toNumber;
const toTokenType = (ticker) => {
switch (ticker === null || ticker === void 0 ? void 0 : ticker.toLowerCase()) {
default:
case 'hnt':
return types_1.TokenType.hnt;
case 'hst':
return types_1.TokenType.hst;
case 'mobile':
return types_1.TokenType.mobile;
case 'iot':
return types_1.TokenType.iot;
}
};
exports.toTokenType = toTokenType;
const toTicker = (tokenType) => {
switch (tokenType) {
default:
case types_1.TokenType.hnt:
return 'hnt';
case types_1.TokenType.hst:
return 'hst';
case types_1.TokenType.mobile:
return 'mobile';
case types_1.TokenType.iot:
return 'iot';
}
};
exports.toTicker = toTicker;
//# sourceMappingURL=utils.js.map
{
"name": "@helium/transactions",
"version": "4.6.2",
"version": "4.7.0",
"description": "Construct and serialize Helium blockchain transaction primatives",

@@ -39,3 +39,3 @@ "keywords": [

},
"gitHead": "6800dfa927a111bb028bb68531e67dd334d52e0f"
"gitHead": "20d7cf8f2002f3962dce732bf4c1f0ef7e88b6f7"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc