@neo-one/smart-contract
Advanced tools
Comparing version 2.7.0 to 2.7.1-preview3.1
{ | ||
"name": "@neo-one/smart-contract", | ||
"version": "2.7.0", | ||
"version": "2.7.1-preview3.1", | ||
"description": "NEO•ONE smart contract apis.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.d.ts", |
@@ -68,2 +68,14 @@ // tslint:disable | ||
readonly isSender: (address: Address) => boolean; | ||
/** | ||
* `Address` of the NEO `Contract`. | ||
*/ | ||
readonly NEO: Address; | ||
/** | ||
* `Address` of the GAS `Contract`. | ||
*/ | ||
readonly GAS: Address; | ||
/** | ||
* `Address` of the Policy `Contract`. | ||
*/ | ||
readonly Policy: Address; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
@@ -95,10 +107,2 @@ } | ||
readonly from: (value: string) => Hash256; | ||
/** | ||
* `Hash256` of the NEO `Asset`. | ||
*/ | ||
readonly NEO: Hash256; | ||
/** | ||
* `Hash256` of the GAS `Asset`. | ||
*/ | ||
readonly GAS: Hash256; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
@@ -156,107 +160,20 @@ } | ||
* | ||
* @see BufferAttributeUsage | ||
* @see PublicKeyAttributeUsage | ||
* @see AddressAttributeUsage | ||
* @see Hash256AttributeUsage | ||
* @see HighPriorityAttributeUsage | ||
*/ | ||
export enum AttributeUsage { | ||
ContractHash = 0x00, | ||
ECDH02 = 0x02, | ||
ECDH03 = 0x03, | ||
Script = 0x20, | ||
Vote = 0x30, | ||
DescriptionUrl = 0x81, | ||
Description = 0x90, | ||
Hash1 = 0xa1, | ||
Hash2 = 0xa2, | ||
Hash3 = 0xa3, | ||
Hash4 = 0xa4, | ||
Hash5 = 0xa5, | ||
Hash6 = 0xa6, | ||
Hash7 = 0xa7, | ||
Hash8 = 0xa8, | ||
Hash9 = 0xa9, | ||
Hash10 = 0xaa, | ||
Hash11 = 0xab, | ||
Hash12 = 0xac, | ||
Hash13 = 0xad, | ||
Hash14 = 0xae, | ||
Hash15 = 0xaf, | ||
Remark = 0xf0, | ||
Remark1 = 0xf1, | ||
Remark2 = 0xf2, | ||
Remark3 = 0xf3, | ||
Remark4 = 0xf4, | ||
Remark5 = 0xf5, | ||
Remark6 = 0xf6, | ||
Remark7 = 0xf7, | ||
Remark8 = 0xf8, | ||
Remark9 = 0xf9, | ||
Remark10 = 0xfa, | ||
Remark11 = 0xfb, | ||
Remark12 = 0xfc, | ||
Remark13 = 0xfd, | ||
Remark14 = 0xfe, | ||
Remark15 = 0xff, | ||
HighPriority = 0x01, | ||
Reserved = 0xff, // Strange behavior in TypeScript compiler API makes this necessary for now | ||
} | ||
/** | ||
* `Attribute` usage flag indicating the data is an arbitrary `Buffer` | ||
* `Attribute` usage flag indicating the data is high priority. | ||
* | ||
* @see BufferAttribute | ||
* @see HighPriorityAttribute | ||
*/ | ||
export type BufferAttributeUsage = | ||
| AttributeUsage.DescriptionUrl | ||
| AttributeUsage.Description | ||
| AttributeUsage.Remark | ||
| AttributeUsage.Remark1 | ||
| AttributeUsage.Remark2 | ||
| AttributeUsage.Remark3 | ||
| AttributeUsage.Remark4 | ||
| AttributeUsage.Remark5 | ||
| AttributeUsage.Remark6 | ||
| AttributeUsage.Remark7 | ||
| AttributeUsage.Remark8 | ||
| AttributeUsage.Remark9 | ||
| AttributeUsage.Remark10 | ||
| AttributeUsage.Remark11 | ||
| AttributeUsage.Remark12 | ||
| AttributeUsage.Remark13 | ||
| AttributeUsage.Remark14 | ||
| AttributeUsage.Remark15; | ||
export type HighPriorityAttributeUsage = AttributeUsage.HighPriority; | ||
/** | ||
* `Attribute` usage flag indicating the data is a `PublicKey` | ||
* `Attribute` placeholder for TypeScript compiler. | ||
* | ||
* @see PublicKeyAttribute | ||
* @see ReservedAttribute | ||
*/ | ||
export type PublicKeyAttributeUsage = AttributeUsage.ECDH02 | AttributeUsage.ECDH03; | ||
/** | ||
* `Attribute` usage flag indicating the data is an `Address` | ||
* | ||
* @see AddressAttribute | ||
*/ | ||
export type AddressAttributeUsage = AttributeUsage.Script; | ||
/** | ||
* `Attribute` usage flag indicating the data is a `Hash256` | ||
* | ||
* @see Hash256Attribute | ||
*/ | ||
export type Hash256AttributeUsage = | ||
| AttributeUsage.ContractHash | ||
| AttributeUsage.Vote | ||
| AttributeUsage.Hash1 | ||
| AttributeUsage.Hash2 | ||
| AttributeUsage.Hash3 | ||
| AttributeUsage.Hash4 | ||
| AttributeUsage.Hash5 | ||
| AttributeUsage.Hash6 | ||
| AttributeUsage.Hash7 | ||
| AttributeUsage.Hash8 | ||
| AttributeUsage.Hash9 | ||
| AttributeUsage.Hash10 | ||
| AttributeUsage.Hash11 | ||
| AttributeUsage.Hash12 | ||
| AttributeUsage.Hash13 | ||
| AttributeUsage.Hash14 | ||
| AttributeUsage.Hash15; | ||
export type ReservedAttributeUsage = AttributeUsage.Reserved; | ||
@@ -271,5 +188,5 @@ /** | ||
readonly usage: AttributeUsage; | ||
readonly data: Buffer; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
export interface AttributeBaseConstructor { | ||
@@ -279,253 +196,74 @@ readonly [OpaqueTagSymbol0]: unique symbol; | ||
/** | ||
* `Attribute` whose data is an arbitrary `Buffer`. | ||
*/ | ||
export interface BufferAttribute extends AttributeBase { | ||
readonly usage: BufferAttributeUsage; | ||
readonly data: Buffer; | ||
export interface HighPriorityAttribute extends AttributeBase { | ||
readonly usage: HighPriorityAttributeUsage; | ||
} | ||
/** | ||
* `Attribute` whose data is a `PublicKey`. | ||
*/ | ||
export interface PublicKeyAttribute extends AttributeBase { | ||
readonly usage: PublicKeyAttributeUsage; | ||
readonly data: PublicKey; | ||
export interface ReservedAttribute extends AttributeBase { | ||
readonly usage: ReservedAttributeUsage; | ||
} | ||
/** | ||
* `Attribute` whose data is an `Address`. | ||
*/ | ||
export interface AddressAttribute extends AttributeBase { | ||
readonly usage: AddressAttributeUsage; | ||
readonly data: Address; | ||
} | ||
/** | ||
* `Attribute` whose data is a `Hash256`. | ||
*/ | ||
export interface Hash256Attribute extends AttributeBase { | ||
readonly usage: Hash256AttributeUsage; | ||
readonly data: Hash256; | ||
} | ||
/** | ||
* `Attribute`s are used to store additional data on `Transaction`s. Most `Attribute`s are used to store arbitrary data, whereas some, like `AddressAttribute`, have specific uses in the NEO | ||
* protocol. | ||
* protocol. The only attribute currently available in the Neo v3 protocol is the "HighPriority" attribute. | ||
*/ | ||
export type Attribute = BufferAttribute | PublicKeyAttribute | AddressAttribute | Hash256Attribute; | ||
export type Attribute = HighPriorityAttribute | ReservedAttribute; | ||
export enum WitnessScope { | ||
None = 0x00, | ||
CalledByEntry = 0x01, | ||
CustomContracts = 0x10, | ||
CustomGroups = 0x20, | ||
Global = 0x80, | ||
} | ||
export const WitnessScopeBase: WitnessScopeBaseConstructor; | ||
/** | ||
* `Output`s represent the destination `Address` and amount transferred of a given `Asset`. | ||
* Base interface for `WitnessScope` | ||
* | ||
* The sum of the unspent `Output`s of an `Address` represent the total balance of the `Address`. | ||
* @see WitnessScope | ||
*/ | ||
export const Output: OutputConstructor; | ||
export interface Output { | ||
/** | ||
* Destination `Address`. | ||
*/ | ||
readonly address: Address; | ||
/** | ||
* `Hash256` of the `Asset` that was transferred. | ||
*/ | ||
readonly asset: Hash256; | ||
/** | ||
* Amount transferred. | ||
*/ | ||
readonly value: Fixed8; | ||
export interface WitnessScopeBase { | ||
readonly scope: WitnessScope; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
export interface OutputConstructor { | ||
export interface WitnessScopeBaseConstructor { | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
/** | ||
* `Input`s are a reference to an `Output` of a `Transaction` that has been persisted to the blockchain. The sum of the `value`s of the referenced `Output`s is the total amount transferred in the `Transaction`. | ||
*/ | ||
export const Input: InputConstructor; | ||
export interface Input { | ||
/** | ||
* `Hash256` of the `Transaction` this input references. | ||
*/ | ||
readonly hash: Hash256; | ||
/** | ||
* `Output` index within the `Transaction` this input references. | ||
*/ | ||
readonly index: Integer; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
export interface NoneWitnessScope extends WitnessScopeBase { | ||
readonly scope: WitnessScope.None; | ||
} | ||
export interface InputConstructor { | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
export interface CalledByEntryWitnessScope extends WitnessScopeBase { | ||
readonly scope: WitnessScope.CalledByEntry; | ||
} | ||
/** | ||
* Constants that specify the type of a `Transaction`. | ||
*/ | ||
export enum TransactionType { | ||
/** | ||
* First `Transaction` in each block which contains the `Block` rewards for the consensus node that produced the `Block`. | ||
* | ||
* @see MinerTransaction | ||
*/ | ||
Miner = 0x00, | ||
/** | ||
* Issues new currency of a first-class `Asset`. | ||
* | ||
* @see IssueTransaction | ||
*/ | ||
Issue = 0x01, | ||
/** | ||
* Claims GAS for a set of spent `Output`s. | ||
* | ||
* @see ClaimTransaction | ||
*/ | ||
Claim = 0x02, | ||
/** | ||
* Enrolls a new validator for a given `PublicKey`. | ||
* | ||
* @see EnrollmentTransaction | ||
* @deprecated | ||
*/ | ||
Enrollment = 0x20, | ||
/** | ||
* Registers a new first class `Asset` | ||
* | ||
* @see RegisterTransaction | ||
* @deprecated Replaced by `Client#registerAsset` | ||
*/ | ||
Register = 0x40, | ||
/** | ||
* Transfers first class `Asset`s | ||
* | ||
* @see ContractTransaction | ||
*/ | ||
Contract = 0x80, | ||
State = 0x90, | ||
/** | ||
* Registers a new `Contract` | ||
* | ||
* @see PublishTransaction | ||
* @deprecated Replaced by `Client#publish` | ||
*/ | ||
Publish = 0xd0, | ||
/** | ||
* Runs a script in the NEO VM. | ||
* | ||
* @see InvocationTransaction | ||
*/ | ||
Invocation = 0xd1, | ||
export interface CustomContractsWitnessScope extends WitnessScopeBase { | ||
readonly scope: WitnessScope.CustomContracts; | ||
} | ||
/** | ||
* Base interface for all `Transaction`s. | ||
*/ | ||
export const TransactionBase: TransactionBaseConstructor; | ||
export interface TransactionBase { | ||
export interface CustomGroupsWitnessScope extends WitnessScopeBase { | ||
readonly scope: WitnessScope.CustomGroups; | ||
} | ||
export interface GlobalWitnessScope extends WitnessScopeBase { | ||
readonly scope: WitnessScope.Global; | ||
} | ||
export const Signer: SignerConstructor; | ||
export interface Signer { | ||
/** | ||
* `Hash256` of this `Transaction`. | ||
* `Address` representing the account of this signer. | ||
*/ | ||
readonly hash: Hash256; | ||
readonly account: Address; | ||
/** | ||
* Type of the `Transaction`. | ||
* | ||
* @see TransactionType | ||
* `Scopes` of this signature. | ||
*/ | ||
readonly type: TransactionType; | ||
/** | ||
* `Attribute`s attached to the `Transaction`. | ||
* | ||
* @see Attribute | ||
*/ | ||
readonly attributes: Attribute[]; | ||
/** | ||
* `Output`s of the `Transaction`. | ||
* | ||
* @see Output | ||
*/ | ||
readonly outputs: Output[]; | ||
/** | ||
* `Input`s of the `Transaction`. | ||
* | ||
* @see Input | ||
*/ | ||
readonly inputs: Input[]; | ||
/** | ||
* Corresponding `Output`s for the `Input`s of the `Transaction`. | ||
* | ||
* @see Output | ||
*/ | ||
readonly references: Output[]; | ||
/** | ||
* `Output`s which have not been spent. | ||
* | ||
* @see Output | ||
*/ | ||
readonly unspentOutputs: Output[]; | ||
readonly scopes: WitnessScope; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
export interface TransactionBaseConstructor {} | ||
export interface SignerConstructor {} | ||
/** | ||
* First `Transaction` in each `Block` which contains the `Block` rewards for the consensus node that produced the `Block`. | ||
*/ | ||
export interface MinerTransaction extends TransactionBase { | ||
readonly type: TransactionType.Miner; | ||
} | ||
/** | ||
* Issues new currency of a first-class `Asset`. | ||
*/ | ||
export interface IssueTransaction extends TransactionBase { | ||
readonly type: TransactionType.Issue; | ||
} | ||
/** | ||
* Claims GAS for a set of spent `Output`s. | ||
*/ | ||
export interface ClaimTransaction extends TransactionBase { | ||
readonly type: TransactionType.Claim; | ||
} | ||
/** | ||
* Enrolls a new validator for a given `PublicKey`. | ||
* | ||
* @deprecated | ||
*/ | ||
export interface EnrollmentTransaction extends TransactionBase { | ||
readonly type: TransactionType.Enrollment; | ||
} | ||
/** | ||
* Registers a new first class `Asset`. | ||
* | ||
* @deprecated Replaced by `Client#registerAsset` | ||
*/ | ||
export interface RegisterTransaction extends TransactionBase { | ||
readonly type: TransactionType.Register; | ||
} | ||
/** | ||
* `Transaction` that transfers first class `Asset`s. | ||
*/ | ||
export interface ContractTransaction extends TransactionBase { | ||
readonly type: TransactionType.Contract; | ||
} | ||
/** | ||
* Contains the state of votes. | ||
*/ | ||
export interface StateTransaction extends TransactionBase { | ||
readonly type: TransactionType.State; | ||
} | ||
/** | ||
* Registers a new `Contract` | ||
* | ||
* @deprecated Replaced by `Client#publish` | ||
*/ | ||
export interface PublishTransaction extends TransactionBase { | ||
readonly type: TransactionType.Publish; | ||
} | ||
/** | ||
* `Transaction` which runs a script in the NEO VM. | ||
*/ | ||
export interface InvocationTransaction extends TransactionBase { | ||
readonly type: TransactionType.Invocation; | ||
/** | ||
* Code that was executed in NEO VM. | ||
*/ | ||
readonly script: Buffer; | ||
} | ||
/** | ||
* `Transaction`s are persisted to the blockchain and represent various functionality like transferring first class `Asset`s or executing smart contracts. | ||
@@ -539,128 +277,56 @@ * | ||
* const transaction = Transaction.for(transactionHash); | ||
* const transactionOutputs = transaction.outputs; | ||
* | ||
*/ | ||
export const Transaction: TransactionConstructor; | ||
export type Transaction = | ||
| MinerTransaction | ||
| IssueTransaction | ||
| ClaimTransaction | ||
| EnrollmentTransaction | ||
| RegisterTransaction | ||
| ContractTransaction | ||
| StateTransaction | ||
| PublishTransaction | ||
| InvocationTransaction; | ||
export interface TransactionConstructor { | ||
/** | ||
* @returns `Transaction` for the specified `hash`. | ||
*/ | ||
readonly for: (hash: Hash256) => Transaction; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
/** | ||
* Balance and vote information for an `Address`. | ||
* | ||
* @example | ||
* | ||
* const address = Address.from('ALq7AWrhAueN6mJNqk6FHJjnsEoPRytLdW'); | ||
* const account = Account.for(address); | ||
* const neoBalance = account.getBalance(Hash256.NEO); | ||
* | ||
* Interface for all `Transaction`s. | ||
*/ | ||
export const Account: AccountConstructor; | ||
export interface Account { | ||
export interface Transaction { | ||
/** | ||
* `Address` of this `Account`. | ||
* `Hash256` of this `Transaction`. | ||
*/ | ||
readonly address: Address; | ||
readonly hash: Hash256; | ||
/** | ||
* Retrieve the balance for a first class `Asset` based on its `Hash256`. | ||
* Neo protocol version. | ||
*/ | ||
readonly getBalance: (asset: Hash256) => Fixed8; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
export interface AccountConstructor { | ||
readonly version: number; | ||
/** | ||
* @returns `Account` for the specified `address`. | ||
* Unique number in order to ensure the hash for this contract is unique. | ||
*/ | ||
readonly for: (address: Address) => Account; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
/** | ||
* Constants that specify the type of the `Asset`. | ||
*/ | ||
export enum AssetType { | ||
Credit = 0x40, | ||
Duty = 0x80, | ||
readonly nonce: number; | ||
/** | ||
* Reserved for the NEO `Asset`. | ||
* `Address` of the transaction sender. | ||
*/ | ||
Governing = 0x00, | ||
readonly sender: Address; | ||
/** | ||
* Reserved for the GAS `Asset`. | ||
* GAS execution fee for the transaction. | ||
*/ | ||
Utility = 0x01, | ||
Currency = 0x08, | ||
Share = 0x90, | ||
Invoice = 0x98, | ||
Token = 0x60, | ||
} | ||
/** | ||
* Attributes of a first class asset. | ||
* | ||
* Smart contract authors will typically only interact with the NEO and GAS `Asset`s. | ||
* | ||
* @example | ||
* | ||
* const asset = Asset.for(Hash256.NEO); | ||
* const neoAmount = asset.amount; | ||
* | ||
*/ | ||
export const Asset: AssetConstructor; | ||
export interface Asset { | ||
readonly systemFee: number; | ||
/** | ||
* `Hash256` of this `Asset`. | ||
* GAS network priority fee for the transaction. | ||
*/ | ||
readonly hash: Hash256; | ||
readonly networkFee: number; | ||
/** | ||
* `AssetType` of the `Asset` | ||
* | ||
* @see AssetType | ||
* Block expiration time. | ||
*/ | ||
readonly type: AssetType; | ||
readonly validUntilBlock: number; | ||
/** | ||
* Total possible supply of the `Asset` | ||
* The index of the `Transaction` within the `Block` | ||
*/ | ||
readonly amount: Fixed8; | ||
readonly height: number; | ||
/** | ||
* Amount currently available of the `Asset` | ||
* Code that was executed in NEO VM. | ||
*/ | ||
readonly available: Fixed8; | ||
readonly script: Buffer; | ||
/** | ||
* Precision (number of decimal places) of the `Asset` | ||
* `Notification`s emitted by the `Transaction`. | ||
*/ | ||
readonly precision: Integer; | ||
/** | ||
* Owner of the `Asset`. | ||
*/ | ||
readonly owner: PublicKey; | ||
/** | ||
* Admin of the `Asset`. | ||
*/ | ||
readonly admin: Address; | ||
/** | ||
* Issuer of the `Asset`. | ||
*/ | ||
readonly issuer: Address; | ||
// readonly notifications: Notification[]; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
export interface AssetConstructor { | ||
export interface TransactionConstructor { | ||
/** | ||
* @returns `Asset` for the specified `hash`. | ||
* @returns `Transaction` for the specified `hash`. | ||
*/ | ||
readonly for: (hash: Hash256) => Asset; | ||
readonly for: (hash: Hash256) => Transaction; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
@@ -686,4 +352,12 @@ } | ||
/** | ||
* Flag that indicates if the `Contract` supports receiving `Asset`s. | ||
* A string representation of the contract's manifest | ||
*/ | ||
readonly manifest: string; | ||
/** | ||
* If `true` then contract uses blockchain storage. | ||
*/ | ||
readonly hasStorage: boolean; | ||
/** | ||
* If `true` then contract is payable. | ||
*/ | ||
readonly payable: boolean; | ||
@@ -702,13 +376,59 @@ readonly [OpaqueTagSymbol0]: unique symbol; | ||
// export enum StackItemType { | ||
// Any = 0x00, | ||
// Pointer = 0x10, | ||
// Boolean = 0x20, | ||
// Integer = 0x21, | ||
// ByteString = 0x28, | ||
// Buffer = 0x30, | ||
// Array = 0x40, | ||
// Struct = 0x41, | ||
// Map = 0x48, | ||
// InteropInterface = 0x60, | ||
// } | ||
// export interface StackItemBase { | ||
// readonly type: StackItemType; | ||
// } | ||
// export interface BufferStackItem extends StackItemBase { | ||
// readonly type: StackItemType.Buffer; | ||
// readonly value: Buffer; | ||
// } | ||
// export type StackItem = BufferStackItem; | ||
// /** | ||
// * | ||
// */ | ||
// export interface Notification { | ||
// /** | ||
// * | ||
// */ | ||
// readonly scriptHash: Address; | ||
// /** | ||
// * The name of the notification event. "Transfer" in the event of a transfer. | ||
// */ | ||
// readonly eventName: string; | ||
// /** | ||
// * | ||
// */ | ||
// readonly state: StackItem[]; | ||
// } | ||
/** | ||
* Attributes of a `Block` persisted to the blockchain. `Header` includes all information except the list of `Transaction`s. | ||
* Attributes of a `Block` persisted to the blockchain. | ||
* | ||
* @example | ||
* | ||
* const genesisBlock = Block.for(0); | ||
* | ||
* @example | ||
* | ||
* const blockHash = Hash256.from('0xd6572a459b95d9136b7a713c5485ca709f9efa4f08f1c25dd792672d2bd75bfb'); | ||
* const header = Header.for(blockHash); | ||
* const arbitraryBlock = Block.for(blockHash); | ||
* | ||
*/ | ||
export const Header: HeaderConstructor; | ||
export interface Header { | ||
export const Block: BlockConstructor; | ||
export interface Block { | ||
/** | ||
@@ -742,29 +462,7 @@ * `Block` hash. | ||
readonly nextConsensus: Address; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
} | ||
export interface HeaderConstructor { | ||
/** | ||
* Accepts either the `Hash256` or the index of the `Block`. | ||
* | ||
* @returns `Header` for the specified `hashOrIndex`. | ||
* The number of `Transaction`s contained in the `Block`. | ||
*/ | ||
readonly for: (hashOrIndex: Hash256 | Integer) => Header; | ||
readonly [OpaqueTagSymbol0]: unique symbol; | ||
readonly transactionsLength: Integer; | ||
} | ||
/** | ||
* Attributes of a `Block` persisted to the blockchain. | ||
* | ||
* @example | ||
* | ||
* const genesisBlock = Block.for(0); | ||
* | ||
*/ | ||
export const Block: BlockConstructor; | ||
export interface Block extends Header { | ||
/** | ||
* `Transaction`s contained in the `Block`. | ||
*/ | ||
readonly transactions: Transaction[]; | ||
} | ||
export interface BlockConstructor { | ||
@@ -1053,5 +751,5 @@ /** | ||
/** | ||
* `InvocationTransaction` this smart contract is executed in. | ||
* `Transaction` this smart contract is executed in. | ||
*/ | ||
readonly currentTransaction: InvocationTransaction; | ||
readonly currentTransaction: Transaction; | ||
/** | ||
@@ -1299,11 +997,55 @@ * The `Address` of the smart contract that directly invoked the contract. | ||
/** | ||
* Object with string literals for the contract properties to be used in deployment. | ||
* Object that defines a contract group for use in deployment. | ||
* | ||
* See the [Deployment](https://neo-one.io/docs/deployment#Properties) chapter of the main guide for more information. | ||
*/ | ||
export interface ContractGroup { | ||
/** | ||
* The public key of the group. | ||
*/ | ||
readonly publicKey: string; | ||
/** | ||
* The signature of the contract hash. | ||
*/ | ||
readonly signature: string; | ||
} | ||
/** | ||
* Object that defines a contract permission for use in deployment. | ||
* | ||
* See the [Deployment](https://neo-one.io/docs/deployment#Properties) chapter of the main guide for more information. | ||
*/ | ||
export interface ContractPermission { | ||
/** | ||
* An object indicating the contract to be invoked. It can be the hash of a single contract or the public key of a contract group. | ||
* If it specifies the hash of a contract then the contract can be invoked. | ||
* If it specifies the public key of a group, then any contract in this group can be invoked | ||
* If this object has hash and group as undefined then this will be considered a wildcard ("*") and any contract can be invoked. | ||
*/ | ||
readonly contract: { readonly hash?: string; readonly group?: string }; | ||
/** | ||
* An array of methods that are allowed to be called. An empty array means that no methods will be allowed to be called. This can also be a wildcard string: "*", which means that any method can be called. | ||
*/ | ||
readonly methods: string | readonly string[]; | ||
} | ||
/** | ||
* Object with literals for the contract properties to be used in deployment. | ||
* | ||
* See the [Deployment](https://neo-one.io/docs/deployment#Properties) chapter of the main guide for more information. | ||
*/ | ||
export interface ContractProperties { | ||
readonly codeVersion: string; | ||
readonly author: string; | ||
readonly email: string; | ||
readonly description: string; | ||
/** | ||
* A group represents a set of mutually trusted contracts. A contract will trust and allow any contract in the same group to invoke it, and the user interface will not give any warnings. | ||
*/ | ||
readonly groups: readonly ContractGroup[]; | ||
/** | ||
* The permissions field is an array containing a set of `ContractPermission` objects. It describes which contracts may be invoked and which methods are called. | ||
*/ | ||
readonly permissions: readonly ContractPermission[]; | ||
/** | ||
* The trusts field is an array containing a set of contract hashes or group public keys. It can also be assigned with a wildcard *. If it is a wildcard *, then it means that this contract trusts any contract. | ||
* If a contract is trusted, the user interface will not give any warnings when called by the contract. | ||
*/ | ||
readonly trusts: string | readonly string[]; | ||
} | ||
@@ -1326,20 +1068,2 @@ | ||
/** | ||
* Stores `Transaction` hashes that have been processed by a method marked with `@receive`, `@send`, or `@sendUnsafe`. | ||
* | ||
* Used to enforce that a `Transaction` with native `Asset`s is only ever processed once by an appropriate `@receive`, `@send`, or `@sendUnsafe` method. | ||
* | ||
* Unprocessed transactions that sent assets to the smart contract can be refunded by using `refundAssets`. | ||
* | ||
* See the [Native Assets](https://neo-one.io/docs/native-assets) chapter of the advanced guide for more information. | ||
*/ | ||
protected readonly processedTransactions: SetStorage<Hash256>; | ||
/** | ||
* Stores `Transaction` hashes that have been claimed by an address with a method marked with `@send`. | ||
* | ||
* The first contract output of a claimed transaction may be sent to the receiver by using `completeSend`. | ||
* | ||
* See the [Native Assets](https://neo-one.io/docs/native-assets) chapter of the advanced guide for more information. | ||
*/ | ||
protected readonly claimedTransactions: MapStorage<Hash256, Address>; | ||
/** | ||
* Property primarily used internally to validate that the smart contract is deployed only once. | ||
@@ -1373,14 +1097,2 @@ */ | ||
/** | ||
* Method automatically added for refunding native `Asset`s. | ||
* | ||
* See the [Native Assets](https://neo-one.io/docs/native-assets) chapter of the advanced guide for more information. | ||
*/ | ||
public readonly refundAssets: () => boolean; | ||
/** | ||
* Method automatically added for sending native `Asset`s that have been claimed by a `@send` method. | ||
* | ||
* See the [Native Assets](https://neo-one.io/docs/native-assets) chapter of the advanced guide for more information. | ||
*/ | ||
public readonly completeSend: () => boolean; | ||
/** | ||
* Used internally by client APIs to upgrade the contract. Control whether an invocation is allowed to upgrade the contract by overriding `approveUpgrade`. | ||
@@ -1390,13 +1102,3 @@ * | ||
*/ | ||
public readonly upgrade: ( | ||
script: Buffer, | ||
parameterList: Buffer, | ||
returnType: number, | ||
properties: number, | ||
contractName: string, | ||
codeVersion: string, | ||
author: string, | ||
email: string, | ||
description: string, | ||
) => boolean; | ||
public readonly upgrade: (script: Buffer, manifest: Buffer) => boolean; | ||
/** | ||
@@ -1457,6 +1159,2 @@ * Returns the singleton instance of the `SmartContract` defined by the interface `T` at `address`. | ||
/** | ||
* Returns a `Buffer` of the SHA1 hash of the input | ||
*/ | ||
readonly sha1: (value: Hashable) => Buffer; | ||
/** | ||
* Returns a `Buffer` of the SHA256 hash of the input | ||
@@ -1466,4 +1164,8 @@ */ | ||
/** | ||
* Returns a `Buffer` of the RMD160 hash of the SHA256 hash of the input. | ||
* Returns a `Buffer` of the RIPEMD160 hash of the input. | ||
*/ | ||
readonly ripemd160: (value: Hashable) => Address; | ||
/** | ||
* Returns a `Buffer` of the RIPEMD160 hash of the SHA256 hash of the input. | ||
*/ | ||
readonly hash160: (value: Hashable) => Address; | ||
@@ -1470,0 +1172,0 @@ /** |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
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
67175
1725
2
1