Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
530 changes: 265 additions & 265 deletions client/src/generated/schema.d.ts

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@
"@fastify/swagger": "8.15.0",
"@fastify/type-provider-typebox": "4.0.0",
"@hirosystems/api-toolkit": "1.12.0",
"@hirosystems/stacks-encoding-native-js": "1.3.0",
"@scure/base": "1.1.1",
"@sinclair/typebox": "0.32.35",
"@stacks/codec": "1.6.0",
"@stacks/common": "6.10.0",
"@stacks/encryption": "6.13.1",
"@stacks/network": "6.11.3",
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/db-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
decodeClarityValueToRepr,
decodeClarityValueToTypeName,
decodePostConditions,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';

import {
RosettaBlock,
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
parseDbTx,
} from '../controllers/db-controller';
import { InvalidRequestError, InvalidRequestErrorType, NotFoundError } from '../../errors';
import { decodeClarityValueToRepr } from '@hirosystems/stacks-encoding-native-js';
import { decodeClarityValueToRepr } from '@stacks/codec';
import {
handlePrincipalCache,
handlePrincipalMempoolCache,
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/debug.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { stacksToBitcoinAddress } from '@hirosystems/stacks-encoding-native-js';
import { stacksToBitcoinAddress } from '@stacks/codec';
import { htmlEscape } from 'escape-goat';
import {
makeSTXTokenTransfer,
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/rosetta/construction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import {
uintCV,
} from '@stacks/transactions';
import * as express from 'express';
import { bitcoinToStacksAddress } from '@hirosystems/stacks-encoding-native-js';
import { bitcoinToStacksAddress } from '@stacks/codec';
import { StacksCoreRpcClient, getCoreNodeEndpoint } from '../../../core-rpc/client';
import { DbBlock } from '../../../datastore/common';
import { PgStore } from '../../../datastore/pg-store';
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getPagingQueryLimit, parsePagingQueryInput, ResourceType } from '../pagination';
import { isValidPrincipal } from '../../helpers';
import { decodeClarityValueToRepr } from '@hirosystems/stacks-encoding-native-js';
import { decodeClarityValueToRepr } from '@stacks/codec';
import { getAssetEventTypeString, parseDbTx } from '../controllers/db-controller';
import { handleChainTipCache } from '../controllers/cache-controller';
import { has0xPrefix } from '@hirosystems/api-toolkit';
Expand Down
2 changes: 1 addition & 1 deletion src/api/routes/v2/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getTxStatusString,
parseDbTx,
} from '../../../api/controllers/db-controller';
import { decodeClarityValueToRepr } from '@hirosystems/stacks-encoding-native-js';
import { decodeClarityValueToRepr } from '@stacks/codec';
import { TransactionVersion, getAddressFromPublicKey } from '@stacks/transactions';
import { SmartContractStatusList } from '../../schemas/entities/smart-contracts';
import { AddressTransaction, AddressTransactionEvent } from '../../schemas/entities/addresses';
Expand Down
12 changes: 10 additions & 2 deletions src/api/schemas/entities/post-conditions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Static, Type } from '@sinclair/typebox';

export const PostConditionModeSchema = Type.Union([Type.Literal('allow'), Type.Literal('deny')]);
export const PostConditionModeSchema = Type.Union([
Type.Literal('allow'),
Type.Literal('deny'),
Type.Literal('originator'),
]);

const PostConditionPrincipalSchema = Type.Union([
Type.Object({
Expand Down Expand Up @@ -46,7 +50,11 @@ const PostConditionFungibleAssetSchema = Type.Object({

const PostConditionNonFungibleAssetSchema = Type.Object({
principal: PostConditionPrincipalSchema,
condition_code: Type.Union([Type.Literal('sent'), Type.Literal('not_sent')]),
condition_code: Type.Union([
Type.Literal('sent'),
Type.Literal('not_sent'),
Type.Literal('maybe_sent'),
]),
type: Type.Literal('non_fungible'),
asset_value: Type.Object({
hex: Type.String(),
Expand Down
14 changes: 8 additions & 6 deletions src/api/serializers/post-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
PostConditionAssetInfoID,
PostConditionPrincipal,
PostConditionPrincipalTypeID,
} from '@hirosystems/stacks-encoding-native-js';
PostConditionModeID,
} from '@stacks/codec';

const assetPrincipalTypeMap = {
[PostConditionPrincipalTypeID.Origin]: 'principal_origin',
Expand Down Expand Up @@ -75,12 +76,13 @@ export function serializePostCondition(pc: TxPostCondition) {
}
}

export function serializePostConditionMode(byte: number) {
switch (byte) {
case 1:
export function serializePostConditionMode(mode: PostConditionModeID) {
switch (mode) {
case PostConditionModeID.Allow:
return 'allow';
case 2:
case PostConditionModeID.Deny:
return 'deny';
case PostConditionModeID.Originator:
return 'originator';
}
throw new Error(`PostConditionMode byte must be either 1 or 2 but was ${byte}`);
}
2 changes: 1 addition & 1 deletion src/c32-addr-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and for now this approach is much easier and faster.

import * as c32check from 'c32check';
import * as LruCache from 'lru-cache';
import { stacksAddressFromParts } from '@hirosystems/stacks-encoding-native-js';
import { stacksAddressFromParts } from '@stacks/codec';

type c32AddressFn = typeof c32check.c32address;

Expand Down
2 changes: 1 addition & 1 deletion src/datastore/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import {
PostConditionAuthFlag,
PrincipalTypeID,
TxPayloadTypeID,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import { getTxSenderAddress } from '../event-stream/reader';
import postgres = require('postgres');
import * as prom from 'prom-client';
Expand Down
2 changes: 1 addition & 1 deletion src/event-stream/bns/bns-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
ClarityValueTuple,
ClarityValueUInt,
TxPayloadTypeID,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import { SmartContractEvent } from '../core-node-message';
import { DbBnsNamespace, DbBnsName } from '../../datastore/common';
import { hexToBuffer, hexToUtf8String } from '@hirosystems/api-toolkit';
Expand Down
2 changes: 1 addition & 1 deletion src/event-stream/core-node-message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DecodedTxResult } from '@hirosystems/stacks-encoding-native-js';
import { DecodedTxResult } from '@stacks/codec';
import { ClarityAbi } from './contract-abi';

export enum CoreNodeEventType {
Expand Down
2 changes: 1 addition & 1 deletion src/event-stream/event-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import {
ClarityValueStringAscii,
ClarityValueTuple,
TxPayloadTypeID,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import { BnsContractIdentifier } from './bns/bns-constants';
import {
parseNameFromContractEvent,
Expand Down
2 changes: 1 addition & 1 deletion src/event-stream/pox-event-parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
ClarityValueTuple,
ClarityValueUInt,
decodeClarityValue,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import { poxAddressToBtcAddress } from '@stacks/stacking';
import { SyntheticPoxEventName } from '../pox-helpers';
import { logger } from '../logger';
Expand Down
2 changes: 1 addition & 1 deletion src/event-stream/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
TxSpendingConditionSingleSigHashMode,
decodeClarityValueList,
ClarityValueBuffer,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import {
DbMicroblockPartial,
DbPoxSyntheticDelegateStxEvent,
Expand Down
5 changes: 1 addition & 4 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import * as btc from 'bitcoinjs-lib';
import * as dotenv from 'dotenv-flow';
import * as http from 'http';
import * as path from 'path';
import {
isValidStacksAddress,
stacksToBitcoinAddress,
} from '@hirosystems/stacks-encoding-native-js';
import { isValidStacksAddress, stacksToBitcoinAddress } from '@stacks/codec';
import * as stream from 'stream';
import * as ecc from 'tiny-secp256k1';
import * as util from 'util';
Expand Down
2 changes: 1 addition & 1 deletion src/import-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as util from 'util';
import * as readline from 'readline';
import * as path from 'path';
import * as zlib from 'zlib';
import { bitcoinToStacksAddress } from '@hirosystems/stacks-encoding-native-js';
import { bitcoinToStacksAddress } from '@stacks/codec';
import * as split2 from 'split2';
import {
DataStoreBnsBlockTxData,
Expand Down
2 changes: 1 addition & 1 deletion src/inspector-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Socket } from 'net';
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs';
import { startProfiler, stopProfiler } from '@hirosystems/stacks-encoding-native-js';
import { startProfiler, stopProfiler } from '@stacks/codec';
import { logger } from './logger';
import { stopwatch, Stopwatch, timeout } from '@hirosystems/api-toolkit';

Expand Down
2 changes: 1 addition & 1 deletion src/rosetta/rosetta-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {
decodeClarityValueList,
ClarityValue,
ClarityValueList,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import { PgStore } from '../datastore/pg-store';
import { poxAddressToBtcAddress } from '@stacks/stacking';
import { parseRecoverableSignatureVrs } from '@stacks/common';
Expand Down
2 changes: 1 addition & 1 deletion tests/2.5/pox-4-burnchain-delegate-stx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { StacksNetwork } from '@stacks/network';
import { RPCClient } from 'rpc-bitcoin';
import * as supertest from 'supertest';
import { PoxContractIdentifier } from '../../src/pox-helpers';
import { ClarityValueUInt, decodeClarityValue } from '@hirosystems/stacks-encoding-native-js';
import { ClarityValueUInt, decodeClarityValue } from '@stacks/codec';
import { decodeBtcAddress, poxAddressToBtcAddress } from '@stacks/stacking';
import { timeout } from '@hirosystems/api-toolkit';
import { AddressStxBalance } from '../../src/api/schemas/entities/addresses';
Expand Down
2 changes: 1 addition & 1 deletion tests/2.5/pox-4-burnchain-stack-stx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { ApiServer } from '../../src/api/init';
import { StacksNetwork } from '@stacks/network';
import { RPCClient } from 'rpc-bitcoin';
import * as supertest from 'supertest';
import { ClarityValueUInt, decodeClarityValue } from '@hirosystems/stacks-encoding-native-js';
import { ClarityValueUInt, decodeClarityValue } from '@stacks/codec';
import { decodeBtcAddress, poxAddressToTuple } from '@stacks/stacking';
import { timeout } from '@hirosystems/api-toolkit';
import { hexToBytes } from '@stacks/common';
Expand Down
2 changes: 1 addition & 1 deletion tests/2.5/pox-4-delegate-aggregation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
ClarityValueTuple,
ClarityValueUInt,
decodeClarityValue,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import * as assert from 'assert';
import { hexToBytes } from '@stacks/common';
import { StackingClient } from '@stacks/stacking';
Expand Down
6 changes: 1 addition & 5 deletions tests/2.5/pox-4-delegate-revoked-stacking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import {
standardPrincipalCV,
uintCV,
} from '@stacks/transactions';
import {
ClarityValueTuple,
ClarityValueUInt,
decodeClarityValue,
} from '@hirosystems/stacks-encoding-native-js';
import { ClarityValueTuple, ClarityValueUInt, decodeClarityValue } from '@stacks/codec';
import { testnetKeys } from '../../src/api/routes/debug';
import { CoreRpcPoxInfo } from '../../src/core-rpc/client';
import { DbTxStatus } from '../../src/datastore/common';
Expand Down
2 changes: 1 addition & 1 deletion tests/2.5/pox-4-delegate-stacking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
standardPrincipalCV,
uintCV,
} from '@stacks/transactions';
import { ClarityValueTuple, ClarityValueUInt } from '@hirosystems/stacks-encoding-native-js';
import { ClarityValueTuple, ClarityValueUInt } from '@stacks/codec';
import * as assert from 'assert';
import { StackingClient } from '@stacks/stacking';
import { getPublicKeyFromPrivate } from '@stacks/encryption';
Expand Down
2 changes: 1 addition & 1 deletion tests/api/address.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
serializeCV,
} from '@stacks/transactions';
import { createClarityValueArray } from '../../src/stacks-encoding-helpers';
import { decodeTransaction } from '@hirosystems/stacks-encoding-native-js';
import { decodeTransaction } from '@stacks/codec';
import {
DbBlock,
DbTxTypeId,
Expand Down
5 changes: 1 addition & 4 deletions tests/api/helpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as c32check from 'c32check';
import {
bitcoinToStacksAddress,
stacksToBitcoinAddress,
} from '@hirosystems/stacks-encoding-native-js';
import { bitcoinToStacksAddress, stacksToBitcoinAddress } from '@stacks/codec';
import * as c32AddrCache from '../../src/c32-addr-cache';
import { ADDR_CACHE_ENV_VAR } from '../../src/c32-addr-cache';
import { isValidBitcoinAddress, getUintEnvOrDefault, BitVec } from '../../src/helpers';
Expand Down
2 changes: 1 addition & 1 deletion tests/api/import-genesis.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { importV1TokenOfferingData } from '../../src/import-v1';
import { bitcoinToStacksAddress } from '@hirosystems/stacks-encoding-native-js';
import { bitcoinToStacksAddress } from '@stacks/codec';
import { PgWriteStore } from '../../src/datastore/pg-write-store';
import { migrate } from '../utils/test-helpers';

Expand Down
2 changes: 1 addition & 1 deletion tests/api/parse-db-tx.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { migrate } from '../utils/test-helpers';
import { importEventsFromTsv } from '../../src/event-replay/event-replay';
import { decodeClarityValueList } from '@hirosystems/stacks-encoding-native-js';
import { decodeClarityValueList } from '@stacks/codec';
import * as fs from 'fs';
import * as readline from 'readline';
import { PgSqlClient, timeout } from '@hirosystems/api-toolkit';
Expand Down
2 changes: 1 addition & 1 deletion tests/api/synthetic-stx-txs.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChainID } from '@stacks/transactions';
import * as fs from 'fs';
import * as path from 'path';
import { DecodedTxResult, TxPayloadTypeID } from '@hirosystems/stacks-encoding-native-js';
import { DecodedTxResult, TxPayloadTypeID } from '@stacks/codec';
import { CoreNodeBlockMessage } from '../../src/event-stream/core-node-message';
import { CoreNodeMsgBlockData, parseMessageTransaction } from '../../src/event-stream/reader';
import { parseNewBlockMessage } from '../../src/event-stream/event-server';
Expand Down
5 changes: 1 addition & 4 deletions tests/api/tx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import {
stringAsciiCV,
} from '@stacks/transactions';
import { createClarityValueArray } from '../../src/stacks-encoding-helpers';
import {
decodeTransaction,
TxPayloadVersionedSmartContract,
} from '@hirosystems/stacks-encoding-native-js';
import { decodeTransaction, TxPayloadVersionedSmartContract } from '@stacks/codec';
import { getTxFromDataStore, TransactionType } from '../../src/api/controllers/db-controller';
import {
DbBlock,
Expand Down
2 changes: 1 addition & 1 deletion tests/subnets/subnet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from '@stacks/transactions';
import { StacksCoreRpcClient } from '../../src/core-rpc/client';
import { StacksTestnet } from '@stacks/network';
import { ClarityTypeID, decodeClarityValue } from '@hirosystems/stacks-encoding-native-js';
import { ClarityTypeID, decodeClarityValue } from '@stacks/codec';
import { timeout } from '@hirosystems/api-toolkit';
import {
TransactionEventsResponse,
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
ClarityTypeID,
ClarityValue as NativeClarityValue,
decodeClarityValue,
} from '@hirosystems/stacks-encoding-native-js';
} from '@stacks/codec';
import * as supertest from 'supertest';
import { ApiServer } from '../../src/api/init';
import { testnetKeys } from '../../src/api/routes/debug';
Expand Down
Loading