@waves/ts-types
Advanced tools
Comparing version 0.3.5 to 1.0.0
{ | ||
"name": "@waves/ts-types", | ||
"version": "0.3.5", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"version": "1.0.0", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"scripts": { | ||
@@ -10,7 +10,33 @@ "prepublish": "tsc", | ||
"postpublish": "git push", | ||
"prepare": "npx tsc" | ||
"prepare": "npx tsc", | ||
"build": "npm run prepare" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^3.2.4" | ||
"@typescript-eslint/eslint-plugin": "^2.18.0", | ||
"@typescript-eslint/parser": "^2.18.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-plugin-jest": "^23.6.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.18.0", | ||
"eslint-plugin-react-hooks": "^2.3.0", | ||
"husky": "^4.2.1", | ||
"lint-staged": "^10.0.5", | ||
"prettier": "^1.19.1", | ||
"typescript": "^3.4.5" | ||
}, | ||
"lint-staged": { | ||
"src/**/*.ts?(x)": [ | ||
"eslint --fix", | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"post-commit": "git update-index --again" | ||
} | ||
} | ||
} |
export * from '../transactions'; | ||
export * from './parts' | ||
export * from './parts'; | ||
export const GENESIS_TYPE = 1 as 1; | ||
export const PAYMENT_TYPE = 2 as 2; | ||
export const ISSUE_TYPE = 3 as 3; | ||
export const TRANSFER_TYPE = 4 as 4; | ||
export const REISSUE_TYPE = 5 as 5; | ||
export const BURN_TYPE = 6 as 6; | ||
export const EXCHANGE_TYPE = 7 as 7; | ||
export const LEASE_TYPE = 8 as 8; | ||
export const CANCEL_LEASE_TYPE = 9 as 9; | ||
export const ALIAS_TYPE = 10 as 10; | ||
export const MASS_TRANSFER_TYPE = 11 as 11; | ||
export const DATA_TYPE = 12 as 12; | ||
export const SET_SCRIPT_TYPE = 13 as 13; | ||
export const SPONSORSHIP_TYPE = 14 as 14; | ||
export const SET_ASSET_SCRIPT_TYPE = 15 as 15; | ||
export const INVOKE_SCRIPT_TYPE = 16 as 16; | ||
export const UPDATE_ASSET_INFO_TYPE = 17 as 17; | ||
export const INTEGER_DATA_TYPE = 'integer' as 'integer'; | ||
export const BOOLEAN_DATA_TYPE = 'boolean' as 'boolean'; | ||
export const STRING_DATA_TYPE = 'string' as 'string'; | ||
export const BINARY_DATA_TYPE = 'binary' as 'binary'; | ||
export const TRANSACTION_TYPE = { | ||
GENESIS: 1 as 1, | ||
PAYMENT: 2 as 2, | ||
ISSUE: 3 as 3, | ||
TRANSFER: 4 as 4, | ||
REISSUE: 5 as 5, | ||
BURN: 6 as 6, | ||
EXCHANGE: 7 as 7, | ||
LEASE: 8 as 8, | ||
CANCEL_LEASE: 9 as 9, | ||
ALIAS: 10 as 10, | ||
MASS_TRANSFER: 11 as 11, | ||
DATA: 12 as 12, | ||
SET_SCRIPT: 13 as 13, | ||
SPONSORSHIP: 14 as 14, | ||
SET_ASSET_SCRIPT: 15 as 15, | ||
INVOKE_SCRIPT: 16 as 16, | ||
UPDATE_ASSET_INFO: 17 as 17 | ||
GENESIS: GENESIS_TYPE, | ||
PAYMENT: PAYMENT_TYPE, | ||
ISSUE: ISSUE_TYPE, | ||
TRANSFER: TRANSFER_TYPE, | ||
REISSUE: REISSUE_TYPE, | ||
BURN: BURN_TYPE, | ||
EXCHANGE: EXCHANGE_TYPE, | ||
LEASE: LEASE_TYPE, | ||
CANCEL_LEASE: CANCEL_LEASE_TYPE, | ||
ALIAS: ALIAS_TYPE, | ||
MASS_TRANSFER: MASS_TRANSFER_TYPE, | ||
DATA: DATA_TYPE, | ||
SET_SCRIPT: SET_SCRIPT_TYPE, | ||
SPONSORSHIP: SPONSORSHIP_TYPE, | ||
SET_ASSET_SCRIPT: SET_ASSET_SCRIPT_TYPE, | ||
INVOKE_SCRIPT: INVOKE_SCRIPT_TYPE, | ||
UPDATE_ASSET_INFO: UPDATE_ASSET_INFO_TYPE, | ||
}; | ||
export const DATA_FIELD_TYPE = { | ||
INTEGER: 'integer' as 'integer', | ||
BOOLEAN: 'boolean' as 'boolean', | ||
STRING: 'string' as 'string', | ||
BINARY: 'binary' as 'binary' | ||
INTEGER: INTEGER_DATA_TYPE, | ||
BOOLEAN: BOOLEAN_DATA_TYPE, | ||
STRING: STRING_DATA_TYPE, | ||
BINARY: BINARY_DATA_TYPE, | ||
}; | ||
export type TTransactionType = typeof TRANSACTION_TYPE[keyof typeof TRANSACTION_TYPE]; | ||
export type TDataEntryType = typeof DATA_FIELD_TYPE[keyof typeof DATA_FIELD_TYPE]; | ||
export type TransactionType = typeof TRANSACTION_TYPE[keyof typeof TRANSACTION_TYPE]; | ||
export type DataFiledType = typeof DATA_FIELD_TYPE[keyof typeof DATA_FIELD_TYPE]; |
208
src/parts.ts
@@ -1,75 +0,94 @@ | ||
import { DATA_FIELD_TYPE, TProofs } from './index'; | ||
import { DATA_FIELD_TYPE, ExchangeTransaction } from './index'; | ||
export type ExchangeTransactionOrderType = 'buy' | 'sell'; | ||
export type Base64Script = string; | ||
export type Base58Bytes = string; | ||
export type Proofs = Array<string>; | ||
export type Long = string | number; | ||
export type AssetDecimals = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; | ||
export type Base64string = string; | ||
export type TOrderType = 'buy' | 'sell'; | ||
export type WithApiMixin = WithId & { | ||
sender: string; | ||
height: number; | ||
}; | ||
export interface IInvokeScriptCall<LONG> { | ||
export type InvokeScriptCall<LONG = Long> = { | ||
function: string; | ||
args: Array<TInvokeScriptCallArgument<LONG>>; | ||
} | ||
args: Array<InvokeScriptCallArgument<LONG>>; | ||
}; | ||
export interface IInvokeScriptPayment<LONG> { | ||
export type InvokeScriptPayment<LONG = Long> = { | ||
assetId: string; | ||
amount: LONG; | ||
} | ||
}; | ||
export type TInvokeScriptCallArgument<LONG> = | ||
IInvokeScriptCallStringOrBinaryArgument | | ||
IInvokeScriptCallBoolArgument | | ||
IInvokeScriptCallIntArgument<LONG>; | ||
export type InvokeScriptCallArgument<LONG = Long> = | ||
| InvokeScriptCallStringArgument | ||
| InvokeScriptCallBinaryArgument | ||
| InvokeScriptCallBooleanArgument | ||
| InvokeScriptCallIntegerArgument<LONG> | ||
| InvokeScriptCallListArgument< | ||
LONG, | ||
string | boolean | LONG | Base64Script | ||
>; | ||
export interface IInvokeScriptCallStringOrBinaryArgument { | ||
type: 'string' | 'binary'; | ||
value: string; | ||
} | ||
export type InvokeScriptCallArgumentGeneric<Type, Value> = { | ||
type: Type; | ||
value: Value; | ||
}; | ||
export interface IInvokeScriptCallBoolArgument { | ||
type: 'boolean'; | ||
value: boolean; | ||
} | ||
export type InvokeScriptCallStringArgument = InvokeScriptCallArgumentGeneric< | ||
'string', | ||
string | ||
>; | ||
export type InvokeScriptCallBinaryArgument = InvokeScriptCallArgumentGeneric< | ||
'binary', | ||
Base64string | ||
>; | ||
export type InvokeScriptCallBooleanArgument = InvokeScriptCallArgumentGeneric< | ||
'boolean', | ||
boolean | ||
>; | ||
export type InvokeScriptCallIntegerArgument< | ||
LONG = Long | ||
> = InvokeScriptCallArgumentGeneric<'integer', LONG>; | ||
export type InvokeScriptCallListArgument< | ||
LONG, | ||
ITEMS extends string | boolean | LONG | Base64Script | ||
> = InvokeScriptCallArgumentGeneric<'list', Array<ITEMS>>; | ||
export interface IInvokeScriptCallIntArgument<LONG> { | ||
type: 'integer'; | ||
value: LONG; | ||
} | ||
export interface IWithProofs { | ||
proofs: TProofs; | ||
} | ||
export interface IWithId { | ||
export interface WithId { | ||
id: string; | ||
} | ||
export interface IMassTransferItem<LONG> { | ||
recipient: string | ||
export type MassTransferItem<LONG = Long> = { | ||
recipient: string; | ||
amount: LONG; | ||
} | ||
}; | ||
export interface IDataTransactionEntryInteger<LONG> { | ||
export type DataTransactionEntryGeneric<Type, Value> = { | ||
key: string; | ||
type?: typeof DATA_FIELD_TYPE.INTEGER | null; | ||
value: LONG | null; | ||
} | ||
type: Type; | ||
value: Value; | ||
}; | ||
export interface IDataTransactionEntryBoolean { | ||
key: string; | ||
type?: typeof DATA_FIELD_TYPE.BOOLEAN | null; | ||
value: boolean | null; | ||
} | ||
export type DataTransactionEntryInteger<LONG> = DataTransactionEntryGeneric< | ||
typeof DATA_FIELD_TYPE.INTEGER, | ||
LONG | ||
>; | ||
export type DataTransactionEntryString = DataTransactionEntryGeneric< | ||
typeof DATA_FIELD_TYPE.STRING, | ||
string | ||
>; | ||
export type DataTransactionEntryBinary = DataTransactionEntryGeneric< | ||
typeof DATA_FIELD_TYPE.BINARY, | ||
Base64string | ||
>; | ||
export type DataTransactionEntryBoolean = DataTransactionEntryGeneric< | ||
typeof DATA_FIELD_TYPE.BOOLEAN, | ||
boolean | ||
>; | ||
export interface IDataTransactionEntryString { | ||
key: string; | ||
type?: typeof DATA_FIELD_TYPE.STRING | null; | ||
value: string | null; | ||
} | ||
export interface IDataTransactionEntryBinary { | ||
key: string; | ||
type?: typeof DATA_FIELD_TYPE.BINARY | null; | ||
value: Uint8Array | null; | ||
} | ||
export interface IExchangeTransactionOrder<LONG> { | ||
export type ExchangeTransactionOrderData<LONG> = { | ||
matcherPublicKey: string; | ||
@@ -80,4 +99,4 @@ version: number; | ||
priceAsset: string; | ||
}, | ||
orderType: TOrderType; | ||
}; | ||
orderType: ExchangeTransactionOrderType; | ||
price: LONG; | ||
@@ -88,13 +107,70 @@ amount: LONG; | ||
matcherFee: LONG; | ||
matcherFeeAssetId: string; | ||
senderPublicKey: string; | ||
} | ||
}; | ||
export interface IExchangeTransactionOrderWithProofs<LONG> extends IExchangeTransactionOrder<LONG>, IWithProofs { | ||
} | ||
export type WithVersion< | ||
Target extends Record<string, any>, | ||
Version extends number | ||
> = Target & { | ||
version: Version; | ||
}; | ||
export type TDataTransactionEntry<LONG> = | ||
IDataTransactionEntryInteger<LONG> | | ||
IDataTransactionEntryBoolean | | ||
IDataTransactionEntryString | | ||
IDataTransactionEntryBinary; | ||
type ExchangeOrderWithCustomFee<Long> = ExchangeTransactionOrderData<Long> & { | ||
matcherFeeAssetId: string | null; | ||
}; | ||
export type ExchangeTransactionOrderV1<LONG = Long> = WithVersion< | ||
ExchangeTransactionOrderData<LONG>, | ||
1 | ||
>; | ||
export type ExchangeTransactionOrderV2<LONG = Long> = WithVersion< | ||
ExchangeTransactionOrderData<LONG>, | ||
2 | ||
>; | ||
export type ExchangeTransactionOrderV3<LONG = Long> = WithVersion< | ||
ExchangeOrderWithCustomFee<LONG>, | ||
3 | ||
>; | ||
export type ExchangeTransactionOrderV4<LONG = Long> = WithVersion< | ||
ExchangeOrderWithCustomFee<LONG>, | ||
4 | ||
>; | ||
export type ExchangeTransactionOrder<LONG = Long> = | ||
| ExchangeTransactionOrderV1<LONG> | ||
| ExchangeTransactionOrderV2<LONG> | ||
| ExchangeTransactionOrderV3<LONG> | ||
| ExchangeTransactionOrderV4<LONG>; | ||
export type SignedIExchangeTransactionOrder< | ||
ORDER extends ExchangeTransactionOrder<any> | ||
> = ORDER & | ||
(ORDER extends { version: 1 } | ||
? { signature: string } | ||
: { proofs: Array<string> }); | ||
export type ExchangeTransactionOrderMap<LONG = Long> = { | ||
1: ExchangeTransactionOrderV1<LONG>; | ||
2: ExchangeTransactionOrderV2<LONG>; | ||
3: ExchangeTransactionOrderV3<LONG>; | ||
4: ExchangeTransactionOrderV4<LONG>; | ||
}; | ||
export type ExchangeTransactionOrderByTx< | ||
TX extends ExchangeTransaction | ||
> = TX extends { version: 1 } | ||
? ExchangeTransactionOrderMap[1] | ||
: TX extends { version: 2 } | ||
? ExchangeTransactionOrderMap[1 | 2 | 3] | ||
: ExchangeTransactionOrder; | ||
export type DataTransactionEntry<LONG = Long> = | ||
| DataTransactionEntryInteger<LONG> | ||
| DataTransactionEntryString | ||
| DataTransactionEntryBinary | ||
| DataTransactionEntryBoolean | ||
| DataTransactionDeleteRequest; | ||
export type DataTransactionDeleteRequest = { | ||
key: string; | ||
}; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
61351
20
1509
1
13
1