README
scrypt-ts
scrypt-ts
Table of contents
Namespaces
Enumerations
Other Classes
- ActionError
- BsvApi
- ContractApi
- DefaultProvider
- DotwalletSigner
- DummyProvider
- FunctionCall
- GorillapoolProvider
- Provider
- ScryptProvider
- SensibleProvider
- SensiletSigner
- Signer
- TAALSigner
- TaalProvider
- TestWallet
- WhatsonchainProvider
SmartContract Classes
Standard Contracts Classes
Interfaces
- Artifact
- ContractCalledEvent
- ContractTransaction
- DefaultProviderOption
- LogConfig
- MethodCallOptions
- MethodCallTxBuilder
- MultiContractCallOptions
- MultiContractTransaction
- Outpoint
- RequestConfig
- ScriptContext
- ScryptConfig
- SignTransactionOptions
- SignatureRequest
- SignatureResponse
- StatefulNext
- SubScription
- SubscribeOptions
- TransactionResponse
- TxContext
- TxInputRef
- TxOutputRef
- UtxoQueryOptions
- VerifyResult
Array Type Aliases
Other Type Aliases
- Addr
- AddressOption
- AddressesOption
- ByteString
- ContractId
- LogLevel
- Network
- OpCodeType
- PrivKey
- PubKey
- PubKeyHash
- PublicKeyOption
- PublicKeysOption
- PublicKeysOrAddressesOption
- Ripemd160
- Sha1
- Sha256
- Sig
- SigHashPreimage
- SigHashType
- SignatureOption
- SignaturesOption
- SubBytes
- TxHash
- UTXO
Types Type Aliases
Variables
Bitwise Operator Functions
Bytes Operations Functions
Global Function Functions
Hashing Functions
Math Functions
Other Functions
- Addr
- OpCodeType
- PrivKey
- PubKey
- PubKeyHash
- Ripemd160
- Sha1
- Sha256
- Sig
- SigHashPreimage
- SigHashType
- alterFileExt
- and
- buildOpreturnScript
- buildPublicKeyHashScript
- camelCaseCapitalized
- fill
- filterUTXO
- findSig
- findSigs
- fromByteString
- getDummyP2pkhUTXOs
- getDummySig
- getRandomAddress
- getSortedItem
- invert
- isInNodeEnv
- mapIter
- or
- parseAddresses
- parseSignatureOption
- slice
- toByteString
- toHex
- toNumber
- utxoFromOutput
- xor
assert Functions
decorator Functions
Array Type Aliases
FixedArray
Ƭ FixedArray<T
, N
>: GrowToSize
<T
, N
, []>
An array is a fixed-size list of values of the same basic type. When you declare an array you have to declare it like this:
Example
let aaa: FixedArray<bigint, 3> = [1n, 3n, 3n];
let abb: FixedArray<FixedArray<bigint, 2>, 3> = [[1n, 3n], [1n, 3n], [1n, 3n]];
let bbb: FixedArray<FixedArray<FixedArray<bigint, 1>, 2>, 3> = [[[1n], [1n]], [[1n], [1n]], [[1n], [1n]]];
Type parameters
Name | Type |
---|---|
T | T |
N | extends number |
Defined in
dist/smart-contract/builtins/types.d.ts:118
Other Type Aliases
Addr
Ƭ Addr: _PubKeyHash
A domain specific subtype of ByteString
, representing an address.
Defined in
dist/smart-contract/builtins/types.d.ts:75
dist/smart-contract/builtins/types.d.ts:37
AddressOption
Ƭ AddressOption: Address
Defined in
dist/bsv/types.d.ts:5
AddressesOption
Ƭ AddressesOption: AddressOption
| AddressOption
[]
Defined in
dist/bsv/types.d.ts:6
ByteString
Ƭ ByteString: Flavor
<string
, "bytes"
>
a ByteString represents a byte array.
Defined in
dist/smart-contract/builtins/types.d.ts:89
ContractId
Ƭ ContractId: Object
ContractId is a unique identifier for a contract. It is the outpoint referenced by the deployment transaction id and the output index.
Type declaration
Name | Type | Description |
---|---|---|
outputIndex | number | The output index |
txId | string | The deployment transaction id |
Defined in
dist/client/core/types.d.ts:10
LogLevel
Ƭ LogLevel: "verbose"
| "debug"
| "info"
| "warning"
| "error"
| "off"
Defined in
dist/client/core/logger-controller.d.ts:2
Network
Ƭ Network: Network
Defined in
dist/bsv/types.d.ts:4
OpCodeType
Ƭ OpCodeType: Bytes
& { __type
: "OpCodeType"
}
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:88
node_modules/scryptlib/dist/scryptTypes.d.ts:61
PrivKey
Ƭ PrivKey: Int
& { __type
: "PrivKey"
}
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:69
node_modules/scryptlib/dist/scryptTypes.d.ts:36
PubKey
Ƭ PubKey: _PubKey
A domain specific subtype of ByteString
, representing a public key.
Defined in
dist/smart-contract/builtins/types.d.ts:51
dist/smart-contract/builtins/types.d.ts:21
PubKeyHash
Ƭ PubKeyHash: _PubKeyHash
A domain specific subtype of ByteString
, representing an address.
Defined in
dist/smart-contract/builtins/types.d.ts:69
dist/smart-contract/builtins/types.d.ts:33
PublicKeyOption
Ƭ PublicKeyOption: PublicKey
Defined in
dist/bsv/types.d.ts:7
PublicKeysOption
Ƭ PublicKeysOption: PublicKeyOption
| PublicKeyOption
[]
Defined in
dist/bsv/types.d.ts:8
PublicKeysOrAddressesOption
Ƭ PublicKeysOrAddressesOption: AddressesOption
| PublicKeysOption
Defined in
dist/bsv/types.d.ts:9
Ripemd160
Ƭ Ripemd160: _Ripemd160
A domain specific subtype of ByteString
, representing a RIPEMD-160 hash.
Defined in
dist/smart-contract/builtins/types.d.ts:63
dist/smart-contract/builtins/types.d.ts:29
Sha1
Ƭ Sha1: _Sha1
A domain specific subtype of ByteString
, representing a SHA-1 hash.
Defined in
dist/smart-contract/builtins/types.d.ts:81
dist/smart-contract/builtins/types.d.ts:45
Sha256
Ƭ Sha256: _Sha256
A domain specific subtype of ByteString
, representing a SHA-256 hash.
Defined in
dist/smart-contract/builtins/types.d.ts:87
dist/smart-contract/builtins/types.d.ts:41
Sig
Ƭ Sig: _Sig
A domain specific subtype of ByteString
, representing a signature.
Defined in
dist/smart-contract/builtins/types.d.ts:57
dist/smart-contract/builtins/types.d.ts:25
SigHashPreimage
Ƭ SigHashPreimage: Bytes
& { __type
: "SigHashPreimage"
}
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:87
node_modules/scryptlib/dist/scryptTypes.d.ts:58
SigHashType
Ƭ SigHashType: Bytes
& { __type
: "SigHashType"
}
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:86
node_modules/scryptlib/dist/scryptTypes.d.ts:55
SignatureOption
Ƭ SignatureOption: Object
Type declaration
Name | Type | Description |
---|---|---|
csIdx? | number | Index of the OP_CODESEPARATOR to split the previous output script at during verification. If undefined, the whole script is used. |
pubKeyOrAddr | PublicKeysOrAddressesOption | - |
sigHashType? | SignatureHashType | - |
Defined in
dist/bsv/types.d.ts:10
SignaturesOption
Ƭ SignaturesOption: SignatureOption
| SignatureOption
[]
Defined in
dist/bsv/types.d.ts:19
SubBytes
Ƭ SubBytes: PubKey
| Sig
| Sha256
| Sha1
| SigHashType
| Ripemd160
| OpCodeType
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:95
TxHash
Ƭ TxHash: string
Defined in
dist/bsv/abstract-provider.d.ts:7
UTXO
Ƭ UTXO: IUnspentOutput
Defined in
dist/bsv/types.d.ts:3
Types Type Aliases
auto
Ƭ auto: any
The auto keyword specifies that the type of the variable, of basic type, declared will be automatically deducted from its initializer.
Defined in
dist/smart-contract/builtins/types.d.ts:102
Variables
Scrypt
• Const
Scrypt: Object
Type declaration
Name | Type |
---|---|
bsvApi | BsvApi |
contractApi | ContractApi |
getConfig | <T>(name : string , defaultValue? : T ) => T |
init | (config : ScryptConfig ) => void |
Defined in
dist/client/index.d.ts:4
Bitwise Operator Functions
lshift
▸ lshift(x
, n
): bigint
Arithmetic left shift, returns x * 2^n
.
More detail about [Bitwise Operator][https://docs.scrypt.io/how-to-write-a-contract/built-ins#bitwise-operator](https://docs.scrypt.io/how-to-write-a-contract/built-ins#bitwise-operator)
Parameters
Name | Type |
---|---|
x | bigint |
n | bigint |
Returns
bigint
Defined in
dist/smart-contract/builtins/functions.d.ts:149
rshift
▸ rshift(x
, n
): bigint
Arithmetic right shift, returns x / 2^n
.
More detail about [Bitwise Operator][https://docs.scrypt.io/how-to-write-a-contract/built-ins#bitwise-operator](https://docs.scrypt.io/how-to-write-a-contract/built-ins#bitwise-operator)
Parameters
Name | Type |
---|---|
x | bigint |
n | bigint |
Returns
bigint
Defined in
dist/smart-contract/builtins/functions.d.ts:155
Bytes Operations Functions
byteString2Int
▸ byteString2Int(a
): bigint
ByteString can be converted to bigint using function byteString2Int.
Parameters
Name | Type |
---|---|
a | ByteString |
Returns
bigint
Defined in
dist/smart-contract/builtins/functions.d.ts:32
int2ByteString
▸ int2ByteString(n
, size?
): ByteString
bigint can be converted to string with int2ByteString.
If size
is not passed, the number n
is converted to a ByteString with as few bytes as possible.
Otherwise, converts the number n
to a ByteString of the specified size, including the sign bit. Fails if the number cannot be accommodated.
Parameters
Name | Type | Description |
---|---|---|
n | bigint | a number being converts |
size? | bigint | the size of the ByteString |
Returns
Defined in
dist/smart-contract/builtins/functions.d.ts:27
len
▸ len(a
): bigint
Returns the length of the ByteString. Not the length of the string.
Parameters
Name | Type | Description |
---|---|---|
a | ByteString | a ByteString |
Returns
bigint
The length of the ByteString.
Defined in
dist/smart-contract/builtins/functions.d.ts:39
reverseByteString
▸ reverseByteString(b
, size
): ByteString
Returns reversed bytes of b, which is of size bytes. Note size must be a compiled-time constant. It is often useful when converting a number between little-endian and big-endian.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | a ByteString to be reversed |
size | bigint | the size of the ByteString. |
Returns
reversed ByteString.
Defined in
dist/smart-contract/builtins/functions.d.ts:48
Global Function Functions
equals
▸ equals<T
>(a
, b
): boolean
Comparing two struct/FixedArray
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
a | T |
b | T |
Returns
boolean
returns true if equal; otherwise returns false
Defined in
dist/smart-contract/builtins/types.d.ts:124
Hashing Functions
hash160
▸ hash160(a
): Ripemd160
A RIPEMD160 hash of a SHA256 hash, which is always 160 bits or 20 bytes long. This value is commonly used inside Bitcoin, particularly for Bitcoin addresses.
See: https://en.wikipedia.org/wiki/RIPEMD
Parameters
Name | Type | Description |
---|---|---|
a | ByteString | ByteString Data, a.k.a. pre-image, which can be any size. |
Returns
Ripemd160
The hash in the form of a string.
Defined in
dist/smart-contract/builtins/functions.d.ts:117
hash256
▸ hash256(a
): Sha256
A double SHA256 hash, which is always 256 bits or 32 bytes bytes long. This hash function is commonly used inside Bitcoin, particularly for the hash of a block and the hash of a transaction.
See: https://www.movable-type.co.uk/scripts/sha256.html
Parameters
Name | Type | Description |
---|---|---|
a | ByteString | ByteString data, a.k.a. pre-image, which can be any size. |
Returns
Sha256
The hash in the form of a string.
Defined in
dist/smart-contract/builtins/functions.d.ts:129
pubKey2Addr
▸ pubKey2Addr(a
): Addr
Get Addr for PubKey. Under the hood this just wraps the hash160 function.
Parameters
Name | Type |
---|---|
a | PubKey |
Returns
address for the passed public key.
Defined in
dist/smart-contract/builtins/functions.d.ts:137
ripemd160
▸ ripemd160(a
): Ripemd160
A RIPEMD160 hash, which is always 160 bits or 20 bytes long. See: https://en.wikipedia.org/wiki/RIPEMD
Parameters
Name | Type | Description |
---|---|---|
a | ByteString | ByteString Data, a.k.a. pre-image, which can be any size. |
Returns
Ripemd160
The hash in the form of a ByteString.
Defined in
dist/smart-contract/builtins/functions.d.ts:85
sha1
▸ sha1(a
): Sha1
A SHA or SHA1 hash, which is always 160 bits or 20 bytes long.
See: https://en.wikipedia.org/wiki/SHA-1
Parameters
Name | Type | Description |
---|---|---|
a | ByteString | ByteString Data, a.k.a. pre-image, which can be any size. |
Returns
Sha1
The hash in the form of a string.
Defined in
dist/smart-contract/builtins/functions.d.ts:95
sha256
▸ sha256(a
): Sha256
A SHA256 hash, which is always 256 bits or 32 bytes long.
See: https://www.movable-type.co.uk/scripts/sha256.html
Parameters
Name | Type | Description |
---|---|---|
a | ByteString | ByteString Data, a.k.a. pre-image, which can be any size. |
Returns
Sha256
The hash in the form of a string.
Defined in
dist/smart-contract/builtins/functions.d.ts:105
Math Functions
abs
▸ abs(a
): bigint
The input a
is made positive.
Parameters
Name | Type |
---|---|
a | bigint |
Returns
bigint
Defined in
dist/smart-contract/builtins/functions.d.ts:61
max
▸ max(a
, b
): bigint
Returns the largest of a
and b
.
Parameters
Name | Type |
---|---|
a | bigint |
b | bigint |
Returns
bigint
Defined in
dist/smart-contract/builtins/functions.d.ts:71
min
▸ min(a
, b
): bigint
Returns the smallest of a
and b
.
Parameters
Name | Type |
---|---|
a | bigint |
b | bigint |
Returns
bigint
Defined in
dist/smart-contract/builtins/functions.d.ts:66
within
▸ within(x
, min
, max
): boolean
Returns true if x
is within the specified range (left-inclusive), false otherwise.
Parameters
Name | Type |
---|---|
x | bigint |
min | bigint |
max | bigint |
Returns
boolean
Defined in
dist/smart-contract/builtins/functions.d.ts:76
Other Functions
Addr
▸ Addr(b
): Addr
Creates an Addr
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific address representation.
Defined in
dist/smart-contract/builtins/types.d.ts:75
OpCodeType
▸ OpCodeType(b
): OpCodeType
Parameters
Name | Type |
---|---|
b | Bytes |
Returns
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:88
PrivKey
▸ PrivKey(n
): PrivKey
Parameters
Name | Type |
---|---|
n | Int |
Returns
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:69
PubKey
▸ PubKey(b
): PubKey
Creates a PubKey
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific public key representation.
Defined in
dist/smart-contract/builtins/types.d.ts:51
PubKeyHash
▸ PubKeyHash(b
): PubKeyHash
Creates a PubKeyHash
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific address representation.
Defined in
dist/smart-contract/builtins/types.d.ts:69
Ripemd160
▸ Ripemd160(b
): Ripemd160
Creates a Ripemd160
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific RIPEMD-160 hash representation.
Defined in
dist/smart-contract/builtins/types.d.ts:63
Sha1
▸ Sha1(b
): Sha1
Creates a Sha1
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific SHA-1 hash representation.
Defined in
dist/smart-contract/builtins/types.d.ts:81
Sha256
▸ Sha256(b
): Sha256
Creates a Sha256
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific SHA-256 hash representation.
Defined in
dist/smart-contract/builtins/types.d.ts:87
Sig
▸ Sig(b
): Sig
Creates a Sig
instance from a ByteString
.
Parameters
Name | Type | Description |
---|---|---|
b | ByteString | Input ByteString. |
Returns
- A domain specific digital signature representation.
Defined in
dist/smart-contract/builtins/types.d.ts:57
SigHashPreimage
▸ SigHashPreimage(b
): SigHashPreimage
Parameters
Name | Type |
---|---|
b | Bytes |
Returns
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:87
SigHashType
▸ SigHashType(s
): SigHashType
Parameters
Name | Type |
---|---|
s | 0 | SignatureHashType |
Returns
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:86
alterFileExt
▸ alterFileExt(filename
, toExt
, fromExt?
): string
Parameters
Name | Type |
---|---|
filename | string |
toExt | string |
fromExt? | string |
Returns
string
Defined in
dist/smart-contract/utils/index.d.ts:11
and
▸ and(a
, b
): Int
Parameters
Name | Type |
---|---|
a | Int |
b | Int |
Returns
Int
Defined in
node_modules/scryptlib/dist/builtins.d.ts:15
buildOpreturnScript
▸ buildOpreturnScript(data
): Script
Parameters
Name | Type |
---|---|
data | string |
Returns
Defined in
node_modules/scryptlib/dist/builtins.d.ts:22
buildPublicKeyHashScript
▸ buildPublicKeyHashScript(pubKeyHash
): Script
Parameters
Name | Type |
---|---|
pubKeyHash | Ripemd160 |
Returns
Defined in
node_modules/scryptlib/dist/builtins.d.ts:23
camelCaseCapitalized
▸ camelCaseCapitalized(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
dist/smart-contract/utils/index.d.ts:12
fill
▸ fill<E
, N
>(value
, length
): FixedArray
<E
, N
>
Returns an FixedArray
with all size
elements set to value
, where value
can be any type.
Note that length
must be a numeric literal or a compiled-time constant
Type parameters
Name | Type |
---|---|
E | E |
N | extends number |
Parameters
Name | Type | Description |
---|---|---|
value | E | the value of each element to set |
length | N | the length of FixedArray |
Returns
FixedArray
<E
, N
>
Defined in
dist/smart-contract/builtins/functions.d.ts:18
filterUTXO
▸ filterUTXO(utxos
, options
): IUnspentOutput
[]
Parameters
Name | Type |
---|---|
utxos | IUnspentOutput [] |
options | UtxoQueryOptions |
Returns
Defined in
dist/bsv/utils.d.ts:12
findSig
▸ findSig(sigResponses
, pubKeyOrAddr
, sigHashType?
): Sig
Parameters
Name | Type |
---|---|
sigResponses | SignatureResponse [] |
pubKeyOrAddr | PublicKey | Address |
sigHashType? | SignatureHashType |
Returns
Defined in
dist/smart-contract/utils/index.d.ts:7
findSigs
▸ findSigs(sigResponses
, queries
): Sig
[]
Parameters
Name | Type |
---|---|
sigResponses | SignatureResponse [] |
queries | (PublicKey | Address | SignatureOption )[] |
Returns
Sig
[]
Defined in
dist/smart-contract/utils/index.d.ts:8
fromByteString
▸ fromByteString(bs
): string
convert ByteString to utf8 string
Parameters
Name | Type | Description |
---|---|---|
bs | ByteString | ByteString |
Returns
string
utf8 string
Defined in
dist/smart-contract/utils/index.d.ts:18
getDummyP2pkhUTXOs
▸ getDummyP2pkhUTXOs(count?
): UTXO
[]
Parameters
Name | Type |
---|---|
count? | number |
Returns
UTXO
[]
Defined in
dist/bsv/utils.d.ts:4
getDummySig
▸ getDummySig(): Sig
Returns
Defined in
dist/smart-contract/utils/index.d.ts:5
getRandomAddress
▸ getRandomAddress(network?
): Address
Parameters
Name | Type |
---|---|
network? | Network |
Returns
Defined in
dist/bsv/utils.d.ts:5
getSortedItem
▸ getSortedItem<K
, V
>(collection
, k
): SortedItem
<K
>
Type parameters
Name |
---|
K |
V |
Parameters
Name | Type |
---|---|
collection | Map <K , V > | Set <K > |
k | K |
Returns
SortedItem
<K
>
Defined in
node_modules/scryptlib/dist/scryptTypes.d.ts:93
invert
▸ invert(a
): Int
Parameters
Name | Type |
---|---|
a | Int |
Returns
Int
Defined in
node_modules/scryptlib/dist/builtins.d.ts:18
isInNodeEnv
▸ isInNodeEnv(): boolean
Returns
boolean
Defined in
dist/smart-contract/utils/index.d.ts:10
mapIter
▸ mapIter<T
>(iterable
, callback
): Generator
<any
, void
, unknown
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
iterable | IterableIterator <T > |
callback | (x : any ) => any |
Returns
Generator
<any
, void
, unknown
>
Defined in
dist/smart-contract/utils/index.d.ts:9
or
▸ or(a
, b
): Int
Parameters
Name | Type |
---|---|
a | Int |
b | Int |
Returns
Int
Defined in
node_modules/scryptlib/dist/builtins.d.ts:16
parseAddresses
▸ parseAddresses(publicKeysOrAddresses
, network
): AddressOption
[]
Parameters
Name | Type |
---|---|
publicKeysOrAddresses | PublicKeysOrAddressesOption |
network | Network |
Returns
Defined in
dist/bsv/utils.d.ts:7
parseSignatureOption
▸ parseSignatureOption(signaturesOption
, network
): { address
: AddressOption
; sigHashType
: SignatureHashType
}[]
Parameters
Name | Type |
---|---|
signaturesOption | PublicKeysOrAddressesOption | SignaturesOption |
network | Network |
Returns
{ address
: AddressOption
; sigHashType
: SignatureHashType
}[]
Defined in
dist/bsv/utils.d.ts:8
slice
▸ slice(byteString
, start
, end?
): ByteString
Returns a section of a ByteString.
Parameters
Name | Type | Description |
---|---|---|
byteString | ByteString | The ByteString. |
start | BigInt | The beginning byte index of the specified portion of ByteString, included. |
end? | BigInt | The end byte index of the specified portion of ByteString, excluded. If this value is not specified, the sub-section continues to the end of ByteString. |
Returns
Defined in
dist/smart-contract/builtins/functions.d.ts:11
toByteString
▸ toByteString(literal
, isUtf8?
): ByteString
Converts a literal to ByteString.
If not passing isUtf8
or isUtf8
is false, then literal
should be in the format of hex literal, i.e. /^([0-9a-fA-F]{2})*$/
Otherwise, literal
should be in the format of utf8 literal, i.e. hello world
Parameters
Name | Type | Description |
---|---|---|
literal | string | literal string, can be hex literal or utf8 literal, depends on the isUtf8 marker |
isUtf8? | boolean | marker indicating whether literal is utf8 or hex |
Returns
Defined in
dist/smart-contract/builtins/types.d.ts:97
toHex
▸ toHex(x
): string
Parameters
Name | Type |
---|---|
x | Object |
x.toString | (format : "hex" ) => string |
Returns
string
Defined in
node_modules/scryptlib/dist/utils.d.ts:18
toNumber
▸ toNumber(sighashType
): number
Parameters
Name | Type |
---|---|
sighashType | SigHashType |
Returns
number
Defined in
dist/smart-contract/utils/index.d.ts:6
utxoFromOutput
▸ utxoFromOutput(tx
, outputIndex
): UTXO
Parameters
Name | Type |
---|---|
tx | Transaction |
outputIndex | number |
Returns
Defined in
dist/bsv/utils.d.ts:6
xor
▸ xor(a
, b
): Int
Parameters
Name | Type |
---|---|
a | Int |
b | Int |
Returns
Int
Defined in
node_modules/scryptlib/dist/builtins.d.ts:17
assert Functions
assert
▸ assert(condition
, msg?
): asserts condition
assert(condition: boolean, errorMsg?: string)
Throw an Error with the optional error message if condition is false. Otherwise, nothing happens.
Parameters
Name | Type |
---|---|
condition | boolean |
msg? | string |
Returns
asserts condition
Defined in
dist/smart-contract/builtins/functions.d.ts:143
decorator Functions
method
▸ method(sigHashType?
): (target
: any
, methodName
: string
, descriptor
: PropertyDescriptor
) => PropertyDescriptor
Indicates whether the method is a contract method, and ordinary methods do not affect the execution of the contract
Parameters
Name | Type |
---|---|
sigHashType? | SigHashType |
Returns
fn
▸ (target
, methodName
, descriptor
): PropertyDescriptor
Parameters
Name | Type |
---|---|
target | any |
methodName | string |
descriptor | PropertyDescriptor |
Returns
PropertyDescriptor
Defined in
dist/smart-contract/decorators.d.ts:17
prop
▸ prop(state?
): (target
: any
, propertyName
: string
) => void
Indicates whether the property is an property of a contract, and ordinary class properties cannot be accessed in contract methods
Parameters
Name | Type | Description |
---|---|---|
state? | boolean | Whether the property is a property of a stateful contract |
Returns
fn
▸ (target
, propertyName
): void
Parameters
Name | Type |
---|---|
target | any |
propertyName | string |
Returns
void
Defined in
dist/smart-contract/decorators.d.ts:31