@0xcert/scaffold
Advanced tools
Comparing version 0.0.0-alpha3 to 0.0.0-alpha4
@@ -5,4 +5,4 @@ { | ||
{ | ||
"version": "0.0.0-alpha3", | ||
"tag": "@0xcert/scaffold_v0.0.0-alpha3", | ||
"version": "0.0.0-alpha4", | ||
"tag": "@0xcert/scaffold_v0.0.0-alpha4", | ||
"date": "Thu, 22 Nov 2018 00:51:03 GMT", | ||
@@ -9,0 +9,0 @@ "comments": {} |
@@ -5,3 +5,3 @@ # Change Log - @0xcert/scaffold | ||
## 0.0.0-alpha3 | ||
## 0.0.0-alpha4 | ||
Thu, 22 Nov 2018 00:51:03 GMT | ||
@@ -8,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Query, Mutation } from "./context"; | ||
import { MutationBase } from "./misc"; | ||
export declare enum AssetLedgerAbility { | ||
@@ -10,6 +10,2 @@ MANAGE_ABILITIES = 0, | ||
} | ||
export declare enum AssetLedgerTransferState { | ||
DISABLED = 0, | ||
ENABLED = 1 | ||
} | ||
export declare enum AssetLedgerCapability { | ||
@@ -23,16 +19,56 @@ BURNABLE = 1, | ||
readonly id: string; | ||
getAbilities(accountId: string): Promise<Query<AssetLedgerAbility[]>>; | ||
getCapabilities(): Promise<Query<AssetLedgerCapability[]>>; | ||
getInfo(): Promise<Query<AssetLedgerGetInfoResult>>; | ||
getSupply(): Promise<Query<number>>; | ||
getTransferState(): Promise<Query<AssetLedgerTransferState>>; | ||
assignAbilities(accountId: string, abilities: AssetLedgerAbility[]): any; | ||
revokeAbilities(accountId: string, abilities: AssetLedgerAbility[]): any; | ||
setTransferState(state: AssetLedgerTransferState): Promise<Mutation>; | ||
getAbilities(accountId: string): Promise<AssetLedgerAbility[]>; | ||
getApprovedAccount(assetId: string): Promise<string>; | ||
getAssetAccount(assetId: string): Promise<string>; | ||
getAsset(assetId: string): Promise<AssetLedgerItem>; | ||
getBalance(accountId: string): Promise<string>; | ||
getCapabilities(): Promise<AssetLedgerCapability[]>; | ||
getInfo(): Promise<AssetLedgerInfo>; | ||
isApprovedAccount(accountId: string, assetId: string): Promise<boolean>; | ||
isEnabled(): Promise<boolean>; | ||
approveAccount(accountId: string, tokenId: string): Promise<MutationBase>; | ||
assignAbilities(accountId: string, abilities: AssetLedgerAbility[]): Promise<MutationBase>; | ||
createAsset(recipe: AssetLedgerItemRecipe): Promise<MutationBase>; | ||
destroyAsset(assetId: string): Promise<MutationBase>; | ||
revokeAbilities(accountId: string, abilities: AssetLedgerAbility[]): Promise<MutationBase>; | ||
revokeAsset(assetId: string): Promise<MutationBase>; | ||
transferAsset(recipe: AssetLedgerTransferRecipe): Promise<MutationBase>; | ||
setEnabled(enabled: boolean): Promise<MutationBase>; | ||
updateAsset(assetId: string, recipe: AssetLedgerObjectUpdateRecipe): Promise<MutationBase>; | ||
update(recipe: AssetLedgerUpdateRecipe): Promise<MutationBase>; | ||
} | ||
export interface AssetLedgerGetInfoResult { | ||
export interface AssetLedgerDeployRecipe { | ||
source: string; | ||
name: string; | ||
symbol: string; | ||
uriBase: string; | ||
conventionId: string; | ||
schemaId: string; | ||
} | ||
export interface AssetLedgerItem { | ||
id: string; | ||
uri: string; | ||
proof: string; | ||
} | ||
export interface AssetLedgerInfo { | ||
name: string; | ||
symbol: string; | ||
uriBase: string; | ||
schemaId: string; | ||
supply: string; | ||
} | ||
export interface AssetLedgerItemRecipe { | ||
receiverId: string; | ||
id: string; | ||
proof: string; | ||
} | ||
export interface AssetLedgerTransferRecipe { | ||
receiverId: string; | ||
id: string; | ||
data?: string; | ||
} | ||
export interface AssetLedgerObjectUpdateRecipe { | ||
proof: string; | ||
} | ||
export interface AssetLedgerUpdateRecipe { | ||
uriBase: string; | ||
} |
@@ -12,7 +12,2 @@ "use strict"; | ||
})(AssetLedgerAbility = exports.AssetLedgerAbility || (exports.AssetLedgerAbility = {})); | ||
var AssetLedgerTransferState; | ||
(function (AssetLedgerTransferState) { | ||
AssetLedgerTransferState[AssetLedgerTransferState["DISABLED"] = 0] = "DISABLED"; | ||
AssetLedgerTransferState[AssetLedgerTransferState["ENABLED"] = 1] = "ENABLED"; | ||
})(AssetLedgerTransferState = exports.AssetLedgerTransferState || (exports.AssetLedgerTransferState = {})); | ||
var AssetLedgerCapability; | ||
@@ -19,0 +14,0 @@ (function (AssetLedgerCapability) { |
import { Order } from "./order"; | ||
import { Mutation } from "./context"; | ||
import { MutationBase } from "./misc"; | ||
export interface OrderGatewayBase { | ||
readonly id: string; | ||
claim(order: Order): Promise<string>; | ||
perform(order: Order, claim: string): Promise<Mutation>; | ||
cancel(order: Order): Promise<Mutation>; | ||
perform(order: Order, claim: string): Promise<MutationBase>; | ||
cancel(order: Order): Promise<MutationBase>; | ||
} |
@@ -6,4 +6,4 @@ export declare enum OrderActionKind { | ||
} | ||
export declare type OrderAction = CreateAssetOrderActionBase | TransferAssetOrderActionBase | TransferValueOrderActionBase; | ||
export interface CreateAssetOrderActionBase { | ||
export declare type OrderAction = OrderActionCreateAsset | OrderActionTransferAsset | OrderActionTransferValue; | ||
export interface OrderActionCreateAsset { | ||
kind: OrderActionKind.CREATE_ASSET; | ||
@@ -16,3 +16,3 @@ ledgerId: string; | ||
} | ||
export interface TransferAssetOrderActionBase { | ||
export interface OrderActionTransferAsset { | ||
kind: OrderActionKind.TRANSFER_ASSET; | ||
@@ -24,3 +24,3 @@ ledgerId: string; | ||
} | ||
export interface TransferValueOrderActionBase { | ||
export interface OrderActionTransferValue { | ||
kind: OrderActionKind.TRANSFER_VALUE; | ||
@@ -30,3 +30,3 @@ ledgerId: string; | ||
receiverId: string; | ||
value: number; | ||
value: string; | ||
} | ||
@@ -33,0 +33,0 @@ export declare class Order { |
@@ -1,11 +0,35 @@ | ||
import { Mutation } from "./context"; | ||
import { ValueLedgerBase } from "./value-ledger"; | ||
import { AssetLedgerBase } from "./asset-ledger"; | ||
import { OrderGatewayBase } from "./order-gateway"; | ||
export interface GenericProviderBase { | ||
sign(val: string): Promise<string>; | ||
getMutation(txId: string): Promise<Mutation>; | ||
getOrderGateway(id: string): Promise<OrderGatewayBase>; | ||
getAssetLedger(ledgerId: any): Promise<AssetLedgerBase>; | ||
getValueLedger(ledgerId: any): Promise<ValueLedgerBase>; | ||
export interface ProviderBase { | ||
accountId: string; | ||
} | ||
export declare enum ProviderIssue { | ||
UNHANDLED = 0, | ||
GENERAL_REVERT = 1, | ||
SIGNATURE_UNKNOWN = 9000, | ||
SIGNATURE_FAILED = 9001, | ||
ZERO_ADDRESS = 1001, | ||
INVALID_NFT = 1002, | ||
NOT_AUTHORIZED = 1003, | ||
RECEIVER_DOES_NOT_SUPPORT_NFT = 1004, | ||
NFT_ALREADY_EXISTS = 1005, | ||
INVALID_INDEX = 1006, | ||
TRANSFERS_PAUSED = 1007, | ||
COIN_TRANSFER_FAILED = 1008, | ||
INVALID_SIGNATURE_KIND = 1009, | ||
INVALID_PROXY = 1010, | ||
YOU_ARE_NOT_THE_TAKER = 1011, | ||
SENDER_NOT_TAKER_OR_MAKER = 1012, | ||
ORDER_EXPIRED = 1013, | ||
INVALID_SIGNATURE = 1014, | ||
ORDER_CANCELED = 1015, | ||
ORDER_CANNOT_BE_PERFORMED_TWICE = 1016, | ||
YOU_ARE_NOT_THE_MAKER = 1017, | ||
SIGNER_NOT_AUTHORIZED = 1018, | ||
ONE_ZERO_ABILITY_HAS_TO_EXIST = 1019, | ||
TRANSATION_RESPONSE_ERROR_CHECK_PENDING_TRANSACTIONS = 2001, | ||
INVALID_ADDRESS = 2002 | ||
} | ||
export declare class ProviderError extends Error { | ||
readonly issue: ProviderIssue; | ||
readonly original: any; | ||
constructor(issue: ProviderIssue, original?: any); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ProviderIssue; | ||
(function (ProviderIssue) { | ||
ProviderIssue[ProviderIssue["UNHANDLED"] = 0] = "UNHANDLED"; | ||
ProviderIssue[ProviderIssue["GENERAL_REVERT"] = 1] = "GENERAL_REVERT"; | ||
ProviderIssue[ProviderIssue["SIGNATURE_UNKNOWN"] = 9000] = "SIGNATURE_UNKNOWN"; | ||
ProviderIssue[ProviderIssue["SIGNATURE_FAILED"] = 9001] = "SIGNATURE_FAILED"; | ||
ProviderIssue[ProviderIssue["ZERO_ADDRESS"] = 1001] = "ZERO_ADDRESS"; | ||
ProviderIssue[ProviderIssue["INVALID_NFT"] = 1002] = "INVALID_NFT"; | ||
ProviderIssue[ProviderIssue["NOT_AUTHORIZED"] = 1003] = "NOT_AUTHORIZED"; | ||
ProviderIssue[ProviderIssue["RECEIVER_DOES_NOT_SUPPORT_NFT"] = 1004] = "RECEIVER_DOES_NOT_SUPPORT_NFT"; | ||
ProviderIssue[ProviderIssue["NFT_ALREADY_EXISTS"] = 1005] = "NFT_ALREADY_EXISTS"; | ||
ProviderIssue[ProviderIssue["INVALID_INDEX"] = 1006] = "INVALID_INDEX"; | ||
ProviderIssue[ProviderIssue["TRANSFERS_PAUSED"] = 1007] = "TRANSFERS_PAUSED"; | ||
ProviderIssue[ProviderIssue["COIN_TRANSFER_FAILED"] = 1008] = "COIN_TRANSFER_FAILED"; | ||
ProviderIssue[ProviderIssue["INVALID_SIGNATURE_KIND"] = 1009] = "INVALID_SIGNATURE_KIND"; | ||
ProviderIssue[ProviderIssue["INVALID_PROXY"] = 1010] = "INVALID_PROXY"; | ||
ProviderIssue[ProviderIssue["YOU_ARE_NOT_THE_TAKER"] = 1011] = "YOU_ARE_NOT_THE_TAKER"; | ||
ProviderIssue[ProviderIssue["SENDER_NOT_TAKER_OR_MAKER"] = 1012] = "SENDER_NOT_TAKER_OR_MAKER"; | ||
ProviderIssue[ProviderIssue["ORDER_EXPIRED"] = 1013] = "ORDER_EXPIRED"; | ||
ProviderIssue[ProviderIssue["INVALID_SIGNATURE"] = 1014] = "INVALID_SIGNATURE"; | ||
ProviderIssue[ProviderIssue["ORDER_CANCELED"] = 1015] = "ORDER_CANCELED"; | ||
ProviderIssue[ProviderIssue["ORDER_CANNOT_BE_PERFORMED_TWICE"] = 1016] = "ORDER_CANNOT_BE_PERFORMED_TWICE"; | ||
ProviderIssue[ProviderIssue["YOU_ARE_NOT_THE_MAKER"] = 1017] = "YOU_ARE_NOT_THE_MAKER"; | ||
ProviderIssue[ProviderIssue["SIGNER_NOT_AUTHORIZED"] = 1018] = "SIGNER_NOT_AUTHORIZED"; | ||
ProviderIssue[ProviderIssue["ONE_ZERO_ABILITY_HAS_TO_EXIST"] = 1019] = "ONE_ZERO_ABILITY_HAS_TO_EXIST"; | ||
ProviderIssue[ProviderIssue["TRANSATION_RESPONSE_ERROR_CHECK_PENDING_TRANSACTIONS"] = 2001] = "TRANSATION_RESPONSE_ERROR_CHECK_PENDING_TRANSACTIONS"; | ||
ProviderIssue[ProviderIssue["INVALID_ADDRESS"] = 2002] = "INVALID_ADDRESS"; | ||
})(ProviderIssue = exports.ProviderIssue || (exports.ProviderIssue = {})); | ||
class ProviderError extends Error { | ||
constructor(issue, original) { | ||
super(); | ||
this.name = 'ProviderError'; | ||
this.issue = issue; | ||
this.original = original; | ||
this.message = `GenericProvider error [issue: ${issue}]`; | ||
if (Error.captureStackTrace) { | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
} | ||
} | ||
exports.ProviderError = ProviderError; | ||
//# sourceMappingURL=provider.js.map |
@@ -1,11 +0,20 @@ | ||
import { Query } from "./context"; | ||
import { MutationBase } from "./misc"; | ||
export interface ValueLedgerBase { | ||
readonly id: string; | ||
getInfo(): Promise<Query<ValueLedgerGetInfoResult>>; | ||
getSupply(): Promise<Query<number>>; | ||
getBalance(accountId: string): Promise<string>; | ||
getInfo(): Promise<ValueLedgerInfo>; | ||
approveAccount(accountId: string, value: string): Promise<MutationBase>; | ||
} | ||
export interface ValueLedgerGetInfoResult { | ||
export interface ValueLedgerDeployRecipe { | ||
source: string; | ||
name: string; | ||
symbol: string; | ||
decimals: string; | ||
supply: string; | ||
} | ||
export interface ValueLedgerInfo { | ||
name: string; | ||
symbol: string; | ||
decimals: number; | ||
supply: string; | ||
} |
export * from './assets/metadata'; | ||
export * from './core/provider'; | ||
export * from './core/asset-ledger'; | ||
export * from './core/context'; | ||
export * from './core/errors'; | ||
export * from './core/misc'; | ||
export * from './core/order-gateway'; | ||
export * from './core/order'; | ||
export * from './core/value-ledger'; |
@@ -6,5 +6,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./core/provider")); | ||
__export(require("./core/asset-ledger")); | ||
__export(require("./core/errors")); | ||
__export(require("./core/order")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"files": { | ||
"packages/0xcert-scaffold/CHANGELOG.json": "62d2cdf768eba0f4276537b3c5ba44293225dc54", | ||
"packages/0xcert-scaffold/CHANGELOG.md": "f5c88ae691b250b1d2767a5d9c2cfbd86d128f95", | ||
"packages/0xcert-scaffold/CHANGELOG.json": "4679cf0078198a399396c6da18c7c450d45a2ce2", | ||
"packages/0xcert-scaffold/CHANGELOG.md": "c015016c27d991e0aaee0baa639256c43fa070a4", | ||
"packages/0xcert-scaffold/nodemon.json": "82b893373db9861f1df4b55d8ea68a5d37b118de", | ||
"packages/0xcert-scaffold/package.json": "264b7f7c0f7b0b9702d2264109d5f50e5290b4f5", | ||
"packages/0xcert-scaffold/package.json": "f6a850f347cc019a9140d735accfae16299e8df4", | ||
"packages/0xcert-scaffold/src/assets/metadata.ts": "1bd04e0ee8b5ab49edbd1c2ba23398b321ed0800", | ||
"packages/0xcert-scaffold/src/core/asset-ledger.ts": "ef22dec2e330785ee7140cbd3ea2c34a7c63028a", | ||
"packages/0xcert-scaffold/src/core/context.ts": "ae4f2fd2d87dc0caee1c0fe3fd0f4ddffda524f9", | ||
"packages/0xcert-scaffold/src/core/errors.ts": "c33c7d32f1da7b3273102fdd78197447ce48ed85", | ||
"packages/0xcert-scaffold/src/core/order-gateway.ts": "07782ece6576ad63debdc273763c16a30dde9b5d", | ||
"packages/0xcert-scaffold/src/core/order.ts": "f0de6eb366c8334c04974b5e7331de06ebc8dd7b", | ||
"packages/0xcert-scaffold/src/core/provider.ts": "c1a4226753a88c193cfa822de0b75d18006e20ba", | ||
"packages/0xcert-scaffold/src/core/value-ledger.ts": "b2c258fb806a2bcbbc674408941fd5ec86f1a6ff", | ||
"packages/0xcert-scaffold/src/index.ts": "e95b3d5e364766c56db328228c2ef23429fe877f", | ||
"packages/0xcert-scaffold/src/core/asset-ledger.ts": "cd72e0523beadda32cb9f15920f24fa6433bd9d9", | ||
"packages/0xcert-scaffold/src/core/misc.ts": "72309ea533f5280ee023c48ebd8770d3c32cd5f6", | ||
"packages/0xcert-scaffold/src/core/order-gateway.ts": "58ae19f48d35ea9bd4a6d7ca53b1a6c64c6b0edb", | ||
"packages/0xcert-scaffold/src/core/order.ts": "b72809f3af4d84e71db127cf164a507d6506bd40", | ||
"packages/0xcert-scaffold/src/core/provider.ts": "be596952ce293259d81442f245f66dd5dacbb7a3", | ||
"packages/0xcert-scaffold/src/core/value-ledger.ts": "60d1f125b5f7469751c085c9d1c93df47c981961", | ||
"packages/0xcert-scaffold/src/index.ts": "9689f39dbb95ce6fbb159ee26c26ac6a9f8cfcdd", | ||
"packages/0xcert-scaffold/src/tests/.keep": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", | ||
"packages/0xcert-scaffold/tsconfig.json": "99f0fa2e7cf44aa40828236230bc6f15d8648bc6", | ||
"common/config/rush/npm-shrinkwrap.json": "9dea1ec1c34d5bcf4df825f8250513472c8f14f2" | ||
"common/config/rush/npm-shrinkwrap.json": "85e9a2392b6dc8ee32e79467374e9a32d2631090" | ||
}, | ||
"arguments": "npx hayspec test " | ||
"arguments": "npm run clean && npx tsc " | ||
} |
{ | ||
"name": "@0xcert/scaffold", | ||
"version": "0.0.0-alpha3", | ||
"version": "0.0.0-alpha4", | ||
"description": "0xcert protocol scaffold.", | ||
@@ -24,3 +24,3 @@ "main": "./dist/index.js", | ||
"@hayspec/spec": "^0.7.6", | ||
"@types/node": "^10.12.0", | ||
"@types/node": "^10.12.10", | ||
"ts-node": "^7.0.1", | ||
@@ -27,0 +27,0 @@ "typescript": "^3.1.1" |
@@ -1,2 +0,2 @@ | ||
import { Query, Mutation, ContextBase } from "./context"; | ||
import { MutationBase } from "./misc"; | ||
@@ -18,10 +18,2 @@ /** | ||
*/ | ||
export enum AssetLedgerTransferState { | ||
DISABLED = 0, | ||
ENABLED = 1, | ||
} | ||
/** | ||
* | ||
*/ | ||
export enum AssetLedgerCapability { | ||
@@ -39,10 +31,21 @@ BURNABLE = 1, | ||
readonly id: string; | ||
getAbilities(accountId: string): Promise<Query<AssetLedgerAbility[]>>; | ||
getCapabilities(): Promise<Query<AssetLedgerCapability[]>>; | ||
getInfo(): Promise<Query<AssetLedgerGetInfoResult>>; | ||
getSupply(): Promise<Query<number>>; | ||
getTransferState(): Promise<Query<AssetLedgerTransferState>>; | ||
assignAbilities(accountId: string, abilities: AssetLedgerAbility[]); | ||
revokeAbilities(accountId: string, abilities: AssetLedgerAbility[]); | ||
setTransferState(state: AssetLedgerTransferState): Promise<Mutation>; | ||
getAbilities(accountId: string): Promise<AssetLedgerAbility[]>; | ||
getApprovedAccount(assetId: string): Promise<string>; | ||
getAssetAccount(assetId: string): Promise<string>; | ||
getAsset(assetId: string): Promise<AssetLedgerItem>; | ||
getBalance(accountId: string): Promise<string>; | ||
getCapabilities(): Promise<AssetLedgerCapability[]>; | ||
getInfo(): Promise<AssetLedgerInfo>; | ||
isApprovedAccount(accountId: string, assetId: string): Promise<boolean>; | ||
isEnabled(): Promise<boolean>; | ||
approveAccount(accountId: string, tokenId: string): Promise<MutationBase>; | ||
assignAbilities(accountId: string, abilities: AssetLedgerAbility[]): Promise<MutationBase>; | ||
createAsset(recipe: AssetLedgerItemRecipe): Promise<MutationBase>; | ||
destroyAsset(assetId: string): Promise<MutationBase>; | ||
revokeAbilities(accountId: string, abilities: AssetLedgerAbility[]): Promise<MutationBase>; | ||
revokeAsset(assetId: string): Promise<MutationBase>; | ||
transferAsset(recipe: AssetLedgerTransferRecipe): Promise<MutationBase>; | ||
setEnabled(enabled: boolean): Promise<MutationBase>; | ||
updateAsset(assetId: string, recipe: AssetLedgerObjectUpdateRecipe): Promise<MutationBase>; | ||
update(recipe: AssetLedgerUpdateRecipe): Promise<MutationBase>; | ||
} | ||
@@ -53,7 +56,60 @@ | ||
*/ | ||
export interface AssetLedgerGetInfoResult { | ||
export interface AssetLedgerDeployRecipe { | ||
source: string; | ||
name: string; | ||
symbol: string; | ||
uriBase: string; | ||
conventionId: string | ||
schemaId: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface AssetLedgerItem { | ||
id: string; | ||
uri: string; | ||
proof: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface AssetLedgerInfo { | ||
name: string; | ||
symbol: string; | ||
uriBase: string; | ||
schemaId: string; | ||
supply: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface AssetLedgerItemRecipe { | ||
receiverId: string; | ||
id: string; | ||
proof: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface AssetLedgerTransferRecipe { | ||
receiverId: string; | ||
id: string; | ||
data?: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface AssetLedgerObjectUpdateRecipe { | ||
proof: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface AssetLedgerUpdateRecipe { | ||
uriBase: string; | ||
} |
import { Order } from "./order"; | ||
import { Mutation } from "./context"; | ||
import { MutationBase } from "./misc"; | ||
@@ -10,4 +10,4 @@ /** | ||
claim(order: Order): Promise<string>; | ||
perform(order: Order, claim: string): Promise<Mutation>; | ||
cancel(order: Order): Promise<Mutation>; | ||
perform(order: Order, claim: string): Promise<MutationBase>; | ||
cancel(order: Order): Promise<MutationBase>; | ||
} |
@@ -13,4 +13,4 @@ /** | ||
*/ | ||
export type OrderAction = CreateAssetOrderActionBase | TransferAssetOrderActionBase | ||
| TransferValueOrderActionBase; | ||
export type OrderAction = OrderActionCreateAsset | OrderActionTransferAsset | ||
| OrderActionTransferValue; | ||
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
export interface CreateAssetOrderActionBase { | ||
export interface OrderActionCreateAsset { | ||
kind: OrderActionKind.CREATE_ASSET; | ||
@@ -33,3 +33,3 @@ ledgerId: string; | ||
*/ | ||
export interface TransferAssetOrderActionBase { | ||
export interface OrderActionTransferAsset { | ||
kind: OrderActionKind.TRANSFER_ASSET; | ||
@@ -45,3 +45,3 @@ ledgerId: string; | ||
*/ | ||
export interface TransferValueOrderActionBase { | ||
export interface OrderActionTransferValue { | ||
kind: OrderActionKind.TRANSFER_VALUE; | ||
@@ -51,3 +51,3 @@ ledgerId: string; | ||
receiverId: string; | ||
value: number; | ||
value: string; // TODO BN.js | ||
} | ||
@@ -54,0 +54,0 @@ |
@@ -1,15 +0,63 @@ | ||
import { Mutation } from "./context"; | ||
import { ValueLedgerBase } from "./value-ledger"; | ||
import { AssetLedgerBase } from "./asset-ledger"; | ||
import { OrderGatewayBase } from "./order-gateway"; | ||
/** | ||
* | ||
*/ | ||
export interface GenericProviderBase { | ||
sign(val: string): Promise<string>; | ||
getMutation(txId: string): Promise<Mutation>; | ||
getOrderGateway(id: string): Promise<OrderGatewayBase>; | ||
getAssetLedger(ledgerId): Promise<AssetLedgerBase>; | ||
getValueLedger(ledgerId): Promise<ValueLedgerBase>; | ||
export interface ProviderBase { | ||
accountId: string; | ||
} | ||
/** | ||
* Error codes. | ||
*/ | ||
export enum ProviderIssue { | ||
UNHANDLED = 0, | ||
GENERAL_REVERT = 1, | ||
SIGNATURE_UNKNOWN = 9000, | ||
SIGNATURE_FAILED = 9001, | ||
ZERO_ADDRESS = 1001, | ||
INVALID_NFT = 1002, | ||
NOT_AUTHORIZED = 1003, | ||
RECEIVER_DOES_NOT_SUPPORT_NFT = 1004, | ||
NFT_ALREADY_EXISTS = 1005, | ||
INVALID_INDEX = 1006, | ||
TRANSFERS_PAUSED = 1007, | ||
COIN_TRANSFER_FAILED = 1008, | ||
INVALID_SIGNATURE_KIND = 1009, | ||
INVALID_PROXY = 1010, | ||
YOU_ARE_NOT_THE_TAKER = 1011, | ||
SENDER_NOT_TAKER_OR_MAKER = 1012, | ||
ORDER_EXPIRED = 1013, | ||
INVALID_SIGNATURE = 1014, | ||
ORDER_CANCELED = 1015, | ||
ORDER_CANNOT_BE_PERFORMED_TWICE = 1016, | ||
YOU_ARE_NOT_THE_MAKER = 1017, | ||
SIGNER_NOT_AUTHORIZED = 1018, | ||
ONE_ZERO_ABILITY_HAS_TO_EXIST = 1019, | ||
TRANSATION_RESPONSE_ERROR_CHECK_PENDING_TRANSACTIONS = 2001, | ||
INVALID_ADDRESS = 2002, | ||
} | ||
/** | ||
* Handled system error. | ||
*/ | ||
export class ProviderError extends Error { | ||
readonly issue: ProviderIssue; | ||
readonly original: any; | ||
/** | ||
* Class constructor. | ||
* @param issue Issue identification. | ||
* @param details Original error object. | ||
*/ | ||
constructor(issue: ProviderIssue, original?: any) { | ||
super(); | ||
this.name = 'ProviderError'; | ||
this.issue = issue; | ||
this.original = original; | ||
this.message = `GenericProvider error [issue: ${issue}]`; | ||
if (Error.captureStackTrace) { | ||
Error.captureStackTrace(this, this.constructor); | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Query, ContextBase } from "./context"; | ||
import { MutationBase } from "./misc"; | ||
@@ -8,4 +8,5 @@ /** | ||
readonly id: string; | ||
getInfo(): Promise<Query<ValueLedgerGetInfoResult>>; | ||
getSupply(): Promise<Query<number>>; | ||
getBalance(accountId: string): Promise<string>; | ||
getInfo(): Promise<ValueLedgerInfo>; | ||
approveAccount(accountId: string, value: string): Promise<MutationBase>; | ||
} | ||
@@ -16,6 +17,18 @@ | ||
*/ | ||
export interface ValueLedgerGetInfoResult { | ||
export interface ValueLedgerDeployRecipe { | ||
source: string; | ||
name: string; | ||
symbol: string; | ||
decimals: string; | ||
supply: string; | ||
} | ||
/** | ||
* | ||
*/ | ||
export interface ValueLedgerInfo { | ||
name: string; | ||
symbol: string; | ||
decimals: number; | ||
supply: string; | ||
} |
export * from './assets/metadata'; | ||
export * from './core/provider'; | ||
export * from './core/asset-ledger'; | ||
export * from './core/context'; | ||
export * from './core/errors'; | ||
export * from './core/misc'; | ||
export * from './core/order-gateway'; | ||
export * from './core/order'; | ||
export * from './core/value-ledger'; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22467
601
40
1