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
Conversation
@@ -24,6 +24,14 @@ export class AssetOutPoint { | |||
readonly lockScriptHash?: H256; | |||
readonly parameters?: Buffer[]; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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; | |||
}; | |||
|
|||
/** |
There was a problem hiding this comment.
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 { | |||
}; | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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; | ||
|
||
/** |
There was a problem hiding this comment.
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)); | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
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())); | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
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); | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
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); | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
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; | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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[]; | |||
|
|||
/** |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A -> An
539028e
to
5d0d3fc
Compare
No description provided.