Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0xcert/scaffold

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xcert/scaffold - npm Package Compare versions

Comparing version 1.0.0-rc5 to 1.0.0-rc6

.nyc_output/87fd8b48-407a-4588-9d8c-5a5c115a9ef4.json

4

CHANGELOG.json

@@ -5,4 +5,4 @@ {

{
"version": "1.0.0-rc5",
"tag": "@0xcert/scaffold_v1.0.0-rc5",
"version": "1.0.0-rc6",
"tag": "@0xcert/scaffold_v1.0.0-rc6",
"date": "Thu, 22 Nov 2018 00:51:03 GMT",

@@ -9,0 +9,0 @@ "comments": {}

{
"name": "@0xcert/scaffold",
"version": "1.0.0-rc5",
"version": "1.0.0-rc6",
"description": "Overarching module with types, enums, and interfaces for easier development of interoperable modules.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -5,10 +5,17 @@ /**

export interface AssetMetadata {
/** A detailed description of an asset */
/**
* A detailed description of an asset.
*/
description?: string;
/** A valid URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive. */
/**
* A valid URI pointing to a resource with mime type image/* representing the asset to which this NFT represents. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.
*/
image?: string;
/** A name of an asset */
/**
* A name of an asset.
*/
name?: string;
}

@@ -31,27 +31,153 @@ import { MutationBase } from './mutation';

export interface AssetLedgerBase {
/**
* AssetLedger Id. Address pointing at the smartcontract.
*/
readonly id: string;
/**
* Approves another account so it can transfer the specific asset.
* @param assetId Id of the asset.
* @param accountId Id of the account.
*/
approveAccount(assetId: string, accountId: string | OrderGatewayBase): Promise<MutationBase>;
/**
* Approves an account as an operator (meaning he has full controll of all of your assets).
* @param accountId Account id.
*/
approveOperator(accountId: string | OrderGatewayBase): Promise<MutationBase>;
/**
* Grants abilities of an account.
* @param accountId Id of the account.
* @param abilities List of the abilities.
*/
grantAbilities(accountId: string, abilities: AssetLedgerAbility[]): Promise<MutationBase>;
/**
* Creates a new asset.
* @param recipe Data from which the new asset is created.
*/
createAsset(recipe: AssetLedgerItemRecipe): Promise<MutationBase>;
/**
* Destoys an existing asset (only asset owner can do this).
* @param assetId Id of the asset.
*/
destroyAsset(assetId: string): Promise<MutationBase>;
/**
* Disapproves approved account for a specific asset.
* @param assetId Asset id.
*/
disapproveAccount(assetId: string): Promise<MutationBase>;
/**
* Disapproves an account as an operator.
* @param accountId Account id.
*/
disapproveOperator(accountId: string | OrderGatewayBase): Promise<MutationBase>;
/**
* Disables transfers of asset on the asset ledger.
*/
disableTransfers(): Promise<MutationBase>;
/**
* Enables transfers of asset on the asset ledger.
*/
enableTransfers(): Promise<MutationBase>;
/**
* Gets a list of abilities an account has for this asset ledger.
* @param accountId Account address for wich we want to get abilities.
*/
getAbilities(accountId: string): Promise<AssetLedgerAbility[]>;
/**
* Gets accountId if anyone is approved for this asset.
* @param assetId Id of the asset.
*/
getApprovedAccount(assetId: string): Promise<string>;
/**
* Gets information about the asset(id, uri, imprint).
* @param assetId Id of the asset.
*/
getAsset(assetId: string): Promise<AssetLedgerItem>;
/**
* Gets the asset owner account ID.
* @param assetId Id of the asset.
*/
getAssetAccount(assetId: string): Promise<string>;
/**
* Gets the count of assets an account owns.
* @param accountId Address for which we want asset count.
*/
getBalance(accountId: string): Promise<string>;
/**
* Gets a list of all asset ledger capabilities(options).
*/
getCapabilities(): Promise<AssetLedgerCapability[]>;
/**
* Gets information about the asset ledger (name, symbol, uriBase, schemaId, supply).
*/
getInfo(): Promise<AssetLedgerInfo>;
/**
* Checks if a specific account is approved for a specific asset.
* @param assetId Id of the asset.
* @param accountId Id of the account.
*/
isApprovedAccount(assetId: string, accountId: string | OrderGatewayBase): Promise<boolean>;
/**
* Checks if specific account is the operator for specific account.
* @param accountId Account id.
* @param operatorId Operator account id.
*/
isApprovedOperator(accountId: string, operatorId: string | OrderGatewayBase): Promise<boolean>;
/**
* Checks if transfers on the asset ledger are enabled.
*/
isTransferable(): Promise<boolean>;
/**
* Removes abilities from account.
* @param accountId Id of the account.
* @param abilities List of the abilities.
*/
revokeAbilities(accountId: string, abilities: AssetLedgerAbility[]): Promise<MutationBase>;
/**
* Destroys an existing asset (only someone with asset ledger revoke ability can do this).
* @param assetId If of the asset.
*/
revokeAsset(assetId: string): Promise<MutationBase>;
/**
* Updates asset ledger data.
* @param recipe Data to update asset ledger with.
*/
update(recipe: AssetLedgerUpdateRecipe): Promise<MutationBase>;
/**
* Updates data on an existing asset.
* @param assetId Id of the asset.
* @param recipe Data to update asset with.
*/
updateAsset(assetId: string, recipe: AssetLedgerObjectUpdateRecipe): Promise<MutationBase>;
/**
* Transfers asset to another account.
* @param recipe Data needed for the transfer.
*/
transferAsset(recipe: AssetLedgerTransferRecipe): Promise<MutationBase>;
}

@@ -63,6 +189,28 @@

export interface AssetLedgerDeployRecipe {
/**
* Asset Ledger name.
*/
name: string;
/**
* Asset Ledger symbol/ticker.
*/
symbol: string;
/**
* Uri base for metadata URI-s. At the end of the base the assetId is automatically appended foo each asset.
* Example: https://example.com/id/
* Asset 1 URI will become: https://example.com/id/1
*/
uriBase: string;
/**
* Hashed representation of JSON schema defining this object.
*/
schemaId: string;
/**
* Array representing capabilities.
*/
capabilities?: AssetLedgerCapability[];

@@ -75,4 +223,16 @@ }

export interface AssetLedgerItem {
/**
* Unique asset Id.
*/
id: string;
/**
* Uri poiting to the asset metadata (is automatically generated based on baseUri).
*/
uri: string;
/**
* Merkle tree root of asset proof.
*/
imprint: string;

@@ -85,6 +245,28 @@ }

export interface AssetLedgerInfo {
/**
* Asset Ledger name.
*/
name: string;
/**
* Asset Ledger symbol/ticker.
*/
symbol: string;
/**
* Uri base for metadata URI-s. At the end of the base the assetId is automatically appended foo each asset.
* Example: https://example.com/id/
* Asset 1 URI will become: https://example.com/id/1
*/
uriBase: string;
/**
* Hashed representation of JSON schema defining this object.
*/
schemaId: string;
/**
* Total supply of all assets in this AssetLedger.
*/
supply: string;

@@ -97,4 +279,16 @@ }

export interface AssetLedgerItemRecipe {
/**
* Id(address) of the receiver.
*/
receiverId: string;
/**
* Unique asset Id.
*/
id: string;
/**
* Merkle tree root of asset proof.
*/
imprint: string;

@@ -107,5 +301,21 @@ }

export interface AssetLedgerTransferRecipe {
/**
* Id(address) of the sender.
*/
senderId?: string;
/**
* Id(address) of the receiver.
*/
receiverId: string;
/**
* Unique asset Id.
*/
id: string;
/**
* Additional data that will be sent with mutation to the receiver.
*/
data?: string;

@@ -118,2 +328,6 @@ }

export interface AssetLedgerObjectUpdateRecipe {
/**
* Merkle tree root of asset proof.
*/
imprint: string;

@@ -126,3 +340,9 @@ }

export interface AssetLedgerUpdateRecipe {
/**
* Uri base for metadata URI-s. At the end of the base the assetId is automatically appended foo each asset.
* Example: https://example.com/id/
* Asset 1 URI will become: https://example.com/id/1
*/
uriBase: string;
}

@@ -14,20 +14,68 @@ /**

export interface MutationBase {
/**
* Mutation Id (transaction hash).
*/
id: string;
/**
* Number of confirmations (blocks in blockchain after mutation is accepted) are necessary to mark a mutation complete.
*/
confirmations: number;
/**
* Id(address) of the sender.
*/
senderId: string;
/**
* Id(address) of the receiver.
*/
receiverId: string;
/**
* Checks if mutation in pending.
*/
isPending(): boolean;
/**
* Checks if mutation has reached the required number of confirmation.
*/
isCompleted(): boolean;
/**
* Event emmiter.
*/
emit(event: MutationEvent.CONFIRM, mutation: MutationBase): this;
emit(event: MutationEvent.COMPLETE, mutation: MutationBase): this;
emit(event: MutationEvent.ERROR, error: any): this;
/**
* Attaches on mutation events.
*/
on(event: MutationEvent.CONFIRM, handler: (m: MutationBase) => any): this;
on(event: MutationEvent.COMPLETE, handler: (m: MutationBase) => any): this;
on(event: MutationEvent.ERROR, handler: (e: any, m: MutationBase) => any): this;
/**
* Once handler.
*/
once(event: MutationEvent.CONFIRM, handler: (m: MutationBase) => any): this;
once(event: MutationEvent.COMPLETE, handler: (m: MutationBase) => any): this;
once(event: MutationEvent.ERROR, handler: (e: any, m: MutationBase) => any): this;
/**
* Dettaches from mutation events.
*/
off(event: MutationEvent, handler?: () => any): this;
/**
* Waits until mutation is resolved (mutation reaches the specified number of confirmations).
*/
complete(): Promise<this>;
/**
* Stops listening for confirmations.
*/
forget(): this;
}

@@ -16,5 +16,25 @@ import { MutationBase } from './mutation';

export interface OrderGatewayBase {
/**
* Address of the smart contract that represents this order gateway.
*/
readonly id: string;
/**
* Gets signed claim for an order.
* @param order Order data.
*/
claim(order: Order): Promise<string>;
/**
* Performs an order.
* @param order Order data.
* @param claim Claim data.
*/
perform(order: Order, claim: string): Promise<MutationBase>;
/**
* Cancels an order.
* @param order Order data.
*/
cancel(order: Order): Promise<MutationBase>;

@@ -24,3 +44,3 @@ }

/**
*
* Different order actions.
*/

@@ -34,7 +54,31 @@ export type OrderAction = OrderActionCreateAsset | OrderActionTransferAsset

export interface OrderActionCreateAsset {
/**
* Type od order action.
*/
kind: OrderActionKind.CREATE_ASSET;
/**
* Id (address) of the smart contract that represents the assetLedger.
*/
ledgerId: string;
/**
* Id (address) of the sender.
*/
senderId: string;
/**
* Id (address) of the receiver.
*/
receiverId: string;
/**
* Unique asset Id.
*/
assetId: string;
/**
* Merkle tree root of asset proof.
*/
assetImprint: string;

@@ -47,6 +91,26 @@ }

export interface OrderActionTransferAsset {
/**
* Type od order action.
*/
kind: OrderActionKind.TRANSFER_ASSET;
/**
* Id (address) of the smart contract that represents the assetLedger.
*/
ledgerId: string;
/**
* Id (address) of the sender.
*/
senderId: string;
/**
* Id (address) of the receiver.
*/
receiverId: string;
/**
* Unique asset Id.
*/
assetId: string;

@@ -59,6 +123,26 @@ }

export interface OrderActionTransferValue {
/**
* Type od order action.
*/
kind: OrderActionKind.TRANSFER_VALUE;
/**
* Id (address) of the smart contract that represents the assetLedger.
*/
ledgerId: string;
/**
* Id (address) of the sender.
*/
senderId: string;
/**
* Id (address) of the receiver.
*/
receiverId: string;
/**
* The amount of value(erc20 tokens).
*/
value: string; // TODO BN.js

@@ -71,7 +155,27 @@ }

export class Order {
/**
* Address of the order maker.
*/
public makerId: string;
/**
* Address of the order taker.
*/
public takerId: string;
/**
* Array of actions that will execute in this order.
*/
public actions: OrderAction[];
/**
* Nonce for hash generation - usually current timestamp.
*/
public seed: number;
/**
* Timestamp of order expiration.
*/
public expiration: number;
}

@@ -27,3 +27,11 @@ /**

export class ProviderError extends Error {
/**
* Specific kind of error.
*/
public issue: ProviderIssue;
/**
* Original error report.
*/
public original: any;

@@ -30,0 +38,0 @@

@@ -8,9 +8,51 @@ import { MutationBase } from './mutation';

export interface ValueLedgerBase {
/**
* Value ledger Id. Address pointing at the smartcontract.
*/
readonly id: string;
/**
* Approves another account to operate with a specified amount of value.
* @param accountId Account id.
* @param value Value amount.
*/
approveValue(value: string, accountId: string | OrderGatewayBase): Promise<MutationBase>;
/**
* Disapproves account for operating with your value.
* @param accountId Account id.
*/
disapproveValue(accountId: string | OrderGatewayBase): Promise<MutationBase>;
/**
* Gets the amount of value that another account id approved for.
* @param accountId Account id.
* @param spenderId Account if of the spender.
*/
getApprovedValue(accountId: string, spenderId: string): Promise<String>;
/**
* Gets the amount of value a specific account owns.
* @param accountId Account id.
*/
getBalance(accountId: string): Promise<string>;
/**
* Gets information(name, symbol, total supply, decimals) about the value ledger.
*/
getInfo(): Promise<ValueLedgerInfo>;
/**
* Checks if spender is approved for the specific values.
* @param accountId Account id.
* @param spenderId Account id of spender.
* @param value Value amount we are checking against.
*/
isApprovedValue(value: string, accountId: string | OrderGatewayBase, spenderId: string): Promise<Boolean>;
/**
* Transfer value to another account.
* @param recipe Data needed for the transfer.
*/
transferValue(recipe: ValueLedgerTransferRecipe): Promise<MutationBase>;

@@ -23,5 +65,21 @@ }

export interface ValueLedgerDeployRecipe {
/**
* Value Ledger name.
*/
name: string;
/**
* Value Ledger symbol.
*/
symbol: string;
/**
* Number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.
*/
decimals: string;
/**
* Number of total tokens.
*/
supply: string;

@@ -34,5 +92,21 @@ }

export interface ValueLedgerInfo {
/**
* Value Ledger name.
*/
name: string;
/**
* Value Ledger symbol.
*/
symbol: string;
/**
* Number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.
*/
decimals: number;
/**
* Number of total tokens.
*/
supply: string;

@@ -45,5 +119,17 @@ }

export interface ValueLedgerTransferRecipe {
/**
* Id (address) of the sender.
*/
senderId?: string;
/**
* Id (address) of the receiver.
*/
receiverId: string;
/**
* The amount of value(erc20 tokens).
*/
value: string;
}

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