Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typedoc commments #104

Merged
merged 1 commit into from Aug 9, 2018
Merged

Conversation

joojis
Copy link
Contributor

@joojis joojis commented Aug 1, 2018

No description provided.

@joojis joojis requested a review from ScarletBlue August 1, 2018 07:53
@@ -24,6 +24,14 @@ export class AssetOutPoint {
readonly lockScriptHash?: H256;
readonly parameters?: Buffer[];

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A transaction hash that Asset is created at. -> The transaction hash where the Asset is created.
An index in the outputs of a transaction. -> The index in the output of the transaction.
An asset type of an asset that it points. -> The asset type of the asset that it points to.
Asset amount of an asset that it points. -> The Asset amount of the asset that it points to.
A lock script hash of an asset. -> The lock script hash of the asset.
Parameters of an asset. -> The parameters of the asset.

@@ -7,31 +7,44 @@ export type AssetTransferInputData = {
lockScript?: Buffer;
unlockScript?: Buffer;
};

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -50,6 +67,11 @@ export class AssetTransferInput {
};
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -9,14 +9,22 @@ export type AssetTransferOutputData = {
amount: number;
};
/**
* AssetTransferOutput consists of lockScriptHash and parameters, which mark ownership of the asset, and asset type and amount, which indicate the asset's type and quantity.
* An AssetTransferOutput consists of:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*/
export class AssetTransferOutput {
readonly lockScriptHash: H256;
readonly parameters: Buffer[];
readonly assetType: H256;
readonly amount: number;

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTransferredAssets(): Asset[] {
return _.range(this.outputs.length).map(i => this.getTransferredAsset(i));
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -141,6 +198,13 @@ export class AssetTransferTransaction {
}).rlpBytes()));
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -151,20 +215,35 @@ export class AssetTransferTransaction {
this.setUnlockScript(index, unlockScript);
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setLockScript(index: number, lockScript: Buffer): void {
if (index < 0 || this.inputs.length <= index) {
throw "Invalid index";
}
this.inputs[index].setLockScript(lockScript);
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -5,13 +5,19 @@ export type Transaction =
AssetMintTransaction
| AssetTransferTransaction;

export const getTransactionFromJSON = (obj: { type: string, data: object }) => {
const { type } = obj;
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@ScarletBlue ScarletBlue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished reviewing your PR

@@ -24,6 +24,14 @@ export class AssetOutPoint {
readonly lockScriptHash?: H256;
readonly parameters?: Buffer[];

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A transaction hash that Asset is created at. -> The transaction hash where the Asset is created.
An index in the outputs of a transaction. -> The index in the output of the transaction.
An asset type of an asset that it points. -> The asset type of the asset that it points to.
Asset amount of an asset that it points. -> The Asset amount of the asset that it points to.
A lock script hash of an asset. -> The lock script hash of the asset.
Parameters of an asset. -> The parameters of the asset.

* - The results of running the script must return successful in order for the Asset's Input to be valid.
* An AssetTransferInput consists of the following:
* - An AssetOutPoint, which points to the asset to be spent.
* - A lock script and a unlock script, that prove ownership of the asset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an unlock script

* - A list of AssetTransferInput to burn.
* - A list of AssetTransferInput to spend.
* - A list of AssetTransferOutput to create.
* - A network ID. This must be identical to the network ID to which the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A network ID. This must be identical to the network ID of which the

@@ -126,10 +174,19 @@ export class AssetTransferTransaction {
});
}

/**
* Get the outputs of this transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this is outputs instead of output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method returns the array.

getTransferredAssets(): Asset[] {
return _.range(this.outputs.length).map(i => this.getTransferredAsset(i));
}

/**
* Get a hash of the transaction that doesn't contain the scripts. The hash
* is used as a message to craete a signature for a transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

craete -> create

@@ -141,6 +198,13 @@ export class AssetTransferTransaction {
}).rlpBytes()));
}

/**
* Set an input's lock script and an input's unlock script so the input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the -> so that the

@@ -151,20 +215,35 @@ export class AssetTransferTransaction {
this.setUnlockScript(index, unlockScript);
}

/**
* Set an input's lock script.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an -> the

setLockScript(index: number, lockScript: Buffer): void {
if (index < 0 || this.inputs.length <= index) {
throw "Invalid index";
}
this.inputs[index].setLockScript(lockScript);
}

/**
* Set an input's unlock script.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an -> the

/**
* Set an input's unlock script.
* @param index An index indicating the input.
* @param unlockScript A unlock script.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A -> An

@joojis joojis merged commit 6227fca into CodeChain-io:master Aug 9, 2018
@joojis joojis deleted the typedoc-transaction branch August 16, 2018 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants