Skip to content

Commit

Permalink
fix: transaction lib build
Browse files Browse the repository at this point in the history
  • Loading branch information
yknl committed Oct 8, 2020
1 parent fd71e71 commit 86829fe
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 34 deletions.
3 changes: 2 additions & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"codecov": "^3.7.2",
"cross-fetch": "^3.0.5",
"jsontokens": "^3.0.0",
"query-string": "^6.13.1"
"query-string": "^6.13.1",
"ts-jest": "^26.4.1"
},
"devDependencies": {
"@types/jest": "24.9.0",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"jsontokens": "^2.0.2",
"node-fetch": "^2.6.0",
"ripemd160": "^2.0.1",
"ts-jest": "^26.4.1",
"ts-node": "^8.10.2",
"tsdx": "^0.13.3",
"typescript": "^3.9.7",
Expand Down
3 changes: 2 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"dependencies": {
"bitcoinjs-lib": "^5.1.10",
"codecov": "^3.7.2",
"cross-fetch": "^3.0.5"
"cross-fetch": "^3.0.5",
"ts-jest": "^26.4.1"
},
"devDependencies": {
"@types/jest": "24.9.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/encryption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"elliptic": "^6.5.2",
"randombytes": "^2.1.0",
"ripemd160-min": "^0.0.6",
"sha.js": "^2.4.11"
"sha.js": "^2.4.11",
"ts-jest": "^26.4.1"
},
"devDependencies": {
"@types/jest": "24.9.0",
Expand Down
1 change: 1 addition & 0 deletions packages/keychain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"jsontokens": "^3.0.0",
"prettier": "^2.0.5",
"triplesec": "^3.0.27",
"ts-jest": "^26.4.1",
"zone-file": "^1.0.0"
},
"bugs": {
Expand Down
1 change: 1 addition & 0 deletions packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"dependencies": {
"@stacks/common": "^1.0.0-beta.1",
"codecov": "^3.7.2",
"ts-jest": "^26.4.1",
"tsdx": "^0.14.0"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/profile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"codecov": "^3.7.2",
"jsontokens": "^3.0.0",
"schema-inspector": "^1.7.0",
"ts-jest": "^26.4.1",
"zone-file": "^1.0.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"@stacks/auth": "^1.0.0-beta.1",
"@stacks/common": "^1.0.0-beta.1",
"@stacks/encryption": "^1.0.0-beta.1",
"codecov": "^3.7.2"
"codecov": "^3.7.2",
"ts-jest": "^26.4.1"
},
"devDependencies": {
"@types/jest": "24.9.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/transactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@blockstack/eslint-config": "^1.0.5",
"@types/common-tags": "^1.8.0",
"@types/jest": "^25.2.3",
"@types/jest": "^24.9.0",
"@types/lodash": "^4.14.160",
"@types/node": "^13.13.15",
"@typescript-eslint/eslint-plugin": "^3.9.1",
Expand All @@ -59,7 +59,6 @@
"@stacks/network": "^1.0.0-beta.1",
"@types/bn.js": "^4.11.6",
"@types/elliptic": "^6.4.12",
"@types/jest": "^24.9.0",
"@types/randombytes": "^2.0.0",
"@types/sha.js": "^2.4.0",
"bn.js": "^4.11.9",
Expand All @@ -72,6 +71,7 @@
"ripemd160-min": "^0.0.6",
"sha.js": "^2.4.11",
"smart-buffer": "^4.1.0",
"ts-jest": "^26.4.1",
"tsdx": "^0.14.0"
},
"publishConfig": {
Expand Down
3 changes: 3 additions & 0 deletions packages/transactions/src/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ export function nextVerification(
authType: AuthType,
fee: BigNum,
nonce: BigNum,
// @ts-ignore
pubKeyEncoding: PubKeyEncoding,
signature: MessageSignature
) {
Expand Down Expand Up @@ -493,6 +494,8 @@ export class Authorization extends Deserializable {
return this.spendingCondition!.fee;
case AuthType.Sponsored:
return this.sponsorSpendingCondition!.fee;
default:
return 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {

import { AssetInfo, createLPList, createStandardPrincipal, createContractPrincipal } from './types';

import { cvToHex, parseReadOnlyResponse, cloneDeep, omit } from './utils';
import { cvToHex, parseReadOnlyResponse, omit } from './utils';

import { fetchPrivate } from '@stacks/common';

Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/clarity/types/booleanCV.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClarityType, ClarityValue } from '../clarityValue';
import { ClarityType } from '../clarityValue';

type BooleanCV = TrueCV | FalseCV;

Expand Down
22 changes: 1 addition & 21 deletions packages/transactions/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,6 @@ enum AssetType {
NonFungible = 0x02,
}

/**
* Type IDs corresponding to each of the Clarity value types as described here:
* {@link https://github.com/blockstack/blockstack-core/blob/sip/sip-005/sip/sip-005-blocks-and-transactions.md#clarity-value-representation}
*/
enum ClarityType {
Int = 0x00,
UInt = 0x01,
Buffer = 0x02,
BoolTrue = 0x03,
BoolFalse = 0x04,
PrincipalStandard = 0x05,
PrincipalContract = 0x06,
ResponseOk = 0x07,
ResponseErr = 0x08,
OptionalNone = 0x09,
OptionalSome = 0x0a,
List = 0x0b,
Tuple = 0x0c,
}

enum TxRejectedReason {
Serialization = 'Serialization',
Deserialization = 'Deserialization',
Expand Down Expand Up @@ -189,5 +169,5 @@ export {
FungibleConditionCode,
NonFungibleConditionCode,
AssetType,
TxRejectedReason,
TxRejectedReason
};
4 changes: 3 additions & 1 deletion packages/transactions/src/contract-abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
getCVTypeString,
bufferCVFromString,
} from './clarity';
import { ContractCallPayload, createContractCallPayload } from './payload';
import { ContractCallPayload } from './payload';
import { NotImplementedError } from './errors';
import { stringAsciiCV, stringUtf8CV } from './clarity/types/stringCV';

Expand Down Expand Up @@ -336,6 +336,8 @@ function matchType(cv: ClarityValue, abiType: ClarityAbiType): boolean {
}
}
return true;
} else {
return false;
}
default:
return false;
Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/signer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StacksTransaction } from './transaction';

import { StacksPrivateKey, StacksPublicKey } from './keys';
import { isSingleSig, MultiSigSpendingCondition } from './authorization';
import { isSingleSig } from './authorization';
import { cloneDeep } from './utils';
import { SpendingCondition } from './authorization';
import { AuthType } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export function serializePrincipal(principal: PostConditionPrincipal): Buffer {
}

export function deserializePrincipal(bufferReader: BufferReader): PostConditionPrincipal {
const prefix = bufferReader.readUInt8Enum(PostConditionPrincipalID, n => {
const prefix = bufferReader.readUInt8Enum(PostConditionPrincipalID, _ => {
throw new DeserializationError('Unexpected Principal payload type: ${n}');
});
const address = deserializeAddress(bufferReader);
Expand Down
64 changes: 62 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,17 @@
"@types/yargs" "^15.0.0"
chalk "^3.0.0"

"@jest/types@^26.5.2":
version "26.5.2"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.5.2.tgz#44c24f30c8ee6c7f492ead9ec3f3c62a5289756d"
integrity sha512-QDs5d0gYiyetI8q+2xWdkixVQMklReZr4ltw7GFDtb4fuJIBCE6mzj2LnitGqCuAlLap6wPyb8fpoHgwZz5fdg==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^3.0.0"
"@types/node" "*"
"@types/yargs" "^15.0.0"
chalk "^4.0.0"

"@lerna/add@3.21.0":
version "3.21.0"
resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.21.0.tgz#27007bde71cc7b0a2969ab3c2f0ae41578b4577b"
Expand Down Expand Up @@ -2554,13 +2565,28 @@
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"

"@types/istanbul-reports@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz#508b13aa344fa4976234e75dddcc34925737d821"
integrity sha512-nwKNbvnwJ2/mndE9ItP/zc2TCzw6uuodnF4EHYWD+gCQDVBuRQL5UzbZD0/ezy1iKsFU2ZQiDqg4M9dN4+wZgA==
dependencies:
"@types/istanbul-lib-report" "*"

"@types/jest@24.9.0":
version "24.9.0"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.9.0.tgz#78c6991cd1734cf0d390be24875e310bb0a9fb74"
integrity sha512-dXvuABY9nM1xgsXlOtLQXJKdacxZJd7AtvLsKZ/0b57ruMXDKCOXAC/M75GbllQX6o1pcZ5hAG4JzYy7Z/wM2w==
dependencies:
jest-diff "^24.3.0"

"@types/jest@26.x":
version "26.0.14"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.14.tgz#078695f8f65cb55c5a98450d65083b2b73e5a3f3"
integrity sha512-Hz5q8Vu0D288x3iWXePSn53W7hAjP0H7EQ6QvDO9c7t46mR0lNOLlfuwQ+JkVxuhygHzlzPX+0jKdA3ZgSh+Vg==
dependencies:
jest-diff "^25.2.1"
pretty-format "^25.2.1"

"@types/jest@^24.0.15", "@types/jest@^24.9.0":
version "24.9.1"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.9.1.tgz#02baf9573c78f1b9974a5f36778b366aa77bd534"
Expand Down Expand Up @@ -8672,6 +8698,18 @@ jest-util@^25.5.0:
is-ci "^2.0.0"
make-dir "^3.0.0"

jest-util@^26.1.0:
version "26.5.2"
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.5.2.tgz#8403f75677902cc52a1b2140f568e91f8ed4f4d7"
integrity sha512-WTL675bK+GSSAYgS8z9FWdCT2nccO1yTIplNLPlP0OD8tUk/H5IrWKMMRudIQQ0qp8bb4k+1Qa8CxGKq9qnYdg==
dependencies:
"@jest/types" "^26.5.2"
"@types/node" "*"
chalk "^4.0.0"
graceful-fs "^4.2.4"
is-ci "^2.0.0"
micromatch "^4.0.2"

jest-validate@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab"
Expand Down Expand Up @@ -9813,7 +9851,7 @@ mkdirp-promise@^5.0.1:
dependencies:
mkdirp "*"

mkdirp@*:
mkdirp@*, mkdirp@1.x:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
Expand Down Expand Up @@ -11997,7 +12035,7 @@ semver@7.0.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==

semver@^7.1.1, semver@^7.2.1, semver@^7.3.2:
semver@7.x, semver@^7.1.1, semver@^7.2.1, semver@^7.3.2:
version "7.3.2"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938"
integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==
Expand Down Expand Up @@ -13127,6 +13165,23 @@ ts-jest@^25.3.1:
semver "6.x"
yargs-parser "18.x"

ts-jest@^26.4.1:
version "26.4.1"
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.4.1.tgz#08ec0d3fc2c3a39e4a46eae5610b69fafa6babd0"
integrity sha512-F4aFq01aS6mnAAa0DljNmKr/Kk9y4HVZ1m6/rtJ0ED56cuxINGq3Q9eVAh+z5vcYKe5qnTMvv90vE8vUMFxomg==
dependencies:
"@types/jest" "26.x"
bs-logger "0.x"
buffer-from "1.x"
fast-json-stable-stringify "2.x"
jest-util "^26.1.0"
json5 "2.x"
lodash.memoize "4.x"
make-error "1.x"
mkdirp "1.x"
semver "7.x"
yargs-parser "20.x"

ts-loader@^6.2.1, ts-loader@^6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.2.tgz#dffa3879b01a1a1e0a4b85e2b8421dc0dfff1c58"
Expand Down Expand Up @@ -14160,6 +14215,11 @@ yargs-parser@18.x, yargs-parser@^18.1.2, yargs-parser@^18.1.3:
camelcase "^5.0.0"
decamelize "^1.2.0"

yargs-parser@20.x:
version "20.2.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.1.tgz#28f3773c546cdd8a69ddae68116b48a5da328e77"
integrity sha512-yYsjuSkjbLMBp16eaOt7/siKTjNVjMm3SoJnIg3sEh/JsvqVVDyjRKmaJV4cl+lNIgq6QEco2i3gDebJl7/vLA==

yargs-parser@^13.0.0, yargs-parser@^13.1.2:
version "13.1.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"
Expand Down

0 comments on commit 86829fe

Please sign in to comment.