Quais Javascript SDK
This library is still under development and not ready for production use. A complete, compact and simple library for Quai and Qi, written in TypeScript. Features
- Keep your private keys in your client, safe and sound
- Import and export BIP 39 mnemonic phrases (12 word backup phrases) and HD Wallets (English as well as Czech, French, Italian, Japanese, Korean, Simplified Chinese, Spanish, Traditional Chinese)
- Meta-classes create JavaScript objects from any contract ABI, including ABIv2 and Human-Readable ABI
- Connect to Quai nodes over JSON-RPC, quaiscan, or Pelagus
- Small (~136kb compressed; 460kb uncompressed)
- Tree-shaking focused; include only what you need during bundling
- Complete functionality for all your Quai desires
- Extensive documentation coming soon
- Large collection of test cases which are maintained and added to
- Fully written in TypeScript, with strict types for security and safety
- MIT License (including ALL dependencies); completely open source to do with as you please
- 0.1.17: Full support for Quai Network’s Iron Age Testnet.
- 1.0.0-alpha: Full support for Quai Network’s Golden Age Testnet.
Keep Updated
For advisories and important notices, follow @quainetwork on Twitter as well as watch this GitHub project. For more general news, discussions, and feedback, join the Quai Developer Discord.Installing
NodeJS./dist/ folder in this repo.
Using Local Version as Dependency in Other Projects
For developers looking to contribute to quais or integrate it into their projects with local modifications, setting up a local development environment is essential. This section guides you through the process of building quais and linking it to another project on your machine using npm link. Prepare quais for Symbolic Linking-
Clone the quais repository and navigate into it.
-
Install dependencies.
-
Create a global symbolic link for quais. This makes the quais package available to link in any other project. Whenever a local change is made to quais that you want to test in another project, you must run this command again to update the symbolic link.
Caution - The
update-symlinkcommand updates the globally available symbolic link to the build of the current branch you are on when the command is run. This can potentially lead to incompatible version usage if quais is linked to multiple projects locally.
- Navigate to your project.
- Link the globally linked quais package to your project. This replaces the npm-installed quais package with the symlinked version.
- Build your project: Depending on your project’s setup, you may need to rebuild it to ensure that the linked quais library is correctly integrated. npm run build
npm run update-symlink) after making changes to ensure they are reflected in your project.
Reverting to the Published Package
If you need to revert back to the official quais package published on npm, you can unlink quais and reinstall the package.
-
Unlink quais by removing the symlink.
-
Reinstall quais: Install the quais package from npm to use the published version.
Documentation
Documentation for the Quais SDK is under heavy development and will be updated often soon. In the meantime, please refer to the reference material below:Extension Packages
Thequais package only includes the most common and most core
functionality to interact with Quai Network. There are many other
packages designed to further enhance the functionality and experience.
- QuaisPolling - A package to poll Quai Network for events and logs
- MulticallProvider - A Provider which bundles multiple call requests into a single
callto reduce latency and backend request capacity
License
MIT License (including all dependencies).API Index
Address
- Addressable
- AddressLike
- computeAddress
- getAddress
- getCreate2Address
- getCreateAddress
- isAddress
- isAddressable
- isQiAddress
- isQuaiAddress
- recoverAddress
- resolveAddress
- validateAddress
Application Binary Interface
- AbiCoder
- ConstructorFragment
- ErrorDescription
- ErrorFragment
- EventFragment
- FallbackFragment
- Fragment
- FunctionFragment
- Indexed
- Interface
- LogDescription
- NamedFragment
- ParamType
- Result
- StructFragment
- TransactionDescription
- Typed
- JsonFragment
- JsonFragmentType
- FormatType
- FragmentType
- InterfaceAbi
- ParamTypeWalkAsyncFunc
- ParamTypeWalkFunc
- checkResultErrors
Constants
- Shard
- Zone
- AllowedCoinType
- MaxInt256
- MaxUint256
- MessagePrefix
- MinInt256
- N
- WeiPerEther
- ZeroAddress
- ZeroHash
- quaisymbol
Contract
- BaseContract
- Contract
- ContractEventPayload
- ContractFactory
- ContractTransactionReceipt
- ContractTransactionResponse
- ContractUnknownEventPayload
- EventLog
- UndecodedEventLog
- BaseContractMethod
- ConstantContractMethod
- ContractDeployTransaction
- ContractEvent
- ContractInterface
- ContractMethod
- ContractRunner
- ContractTransaction
- DeferredTopicFilter
- Overrides
- WrappedFallback
- ContractEventName
Crypto
- Signature
- SigningKey
- ProgressCallback
- SignatureLike
- computeHmac
- keccak256
- lock
- pbkdf2
- randomBytes
- ripemd160
- scrypt
- scryptSync
- sha256
- sha512
Encoding
- UnicodeNormalizationForm
- Utf8ErrorFunc
- Utf8ErrorReason
- decodeBase58
- decodeBase64
- decodeBytes32
- encodeBase58
- encodeBase64
- encodeBytes32
- toUtf8Bytes
- toUtf8CodePoints
- toUtf8String
Hash
- TypedDataEncoder
- TypedDataDomain
- TypedDataField
- hashMessage
- id
- solidityPacked
- solidityPackedKeccak256
- solidityPackedSha256
- verifyMessage
- verifyTypedData
Other
- AddressStatus
- NeuteredAddressInfo
- OutpointInfo
- QiAddressInfo
- SerializedHDWallet
- SerializedQiHDWallet
- ErrorCode
Providers
- AbstractProvider
- Block
- BrowserProvider
- FeeData
- JsonRpcApiProvider
- JsonRpcProvider
- JsonRpcSigner
- Log
- Network
- QiTransactionResponse
- QuaiTransactionResponse
- SocketBlockSubscriber
- SocketEventSubscriber
- SocketPendingSubscriber
- SocketProvider
- SocketSubscriber
- TransactionReceipt
- UnmanagedSubscriber
- WebSocketProvider
- BlockParams
- Eip1193Provider
- EventFilter
- Filter
- FilterByBlockHash
- LogParams
- MinedBlock
- Provider
- Subscriber
- TransactionReceiptParams
- WebSocketLike
- BlockTag
- DebugEventBrowserProvider
- JsonRpcApiProviderOptions
- JsonRpcError
- JsonRpcPayload
- JsonRpcResult
- MinedTransactionResponse
- Networkish
- OrphanFilter
- PerformActionFilter
- PerformActionRequest
- PerformActionTransaction
- PreparedTransactionRequest
- ProviderEvent
- Subscription
- TopicFilter
- TransactionRequest
- TransactionResponse
- TransactionResponseParams
- WebSocketCreator
- copyRequest
Signers
Transaction
- FewestCoinSelector
- QiTransaction
- QuaiTransaction
- UTXO
- TransactionLike
- AccessList
- AccessListEntry
- AccessListish
- denominations
- accessListify
Utils
- EventPayload
- FetchRequest
- FetchResponse
- FixedNumber
- ActionRejectedError
- BadDataError
- BufferOverrunError
- CallExceptionError
- CancelledError
- EventEmitterable
- InsufficientFundsError
- InvalidArgumentError
- MissingArgumentError
- NetworkError
- NonceExpiredError
- NotImplementedError
- NumericFaultError
- ReplacementUnderpricedError
- ServerError
- TimeoutError
- TransactionReplacedError
- UnexpectedArgumentError
- UnknownError
- UnsupportedOperationError
- quaisError
- BigNumberish
- BytesLike
- CallExceptionAction
- CallExceptionTransaction
- CodedquaisError
- FetchGatewayFunc
- FetchGetUrlFunc
- FetchPreflightFunc
- FetchProcessFunc
- FetchRetryFunc
- FixedFormat
- GetUrlResponse
- Listener
- Numeric
- concat
- dataLength
- dataSlice
- formatQi
- formatQuai
- formatUnits
- fromTwos
- getAddressDetails
- getBigInt
- getBytes
- getBytesCopy
- getNumber
- getTxType
- getUint
- getZoneForAddress
- hexlify
- isBytesLike
- isCallException
- isError
- isHexString
- makeError
- mask
- parseQi
- parseQuai
- parseUnits
- stripZerosLeft
- toBeArray
- toBeHex
- toBigInt
- toNumber
- toQuantity
- toTwos
- uuidV4
- zeroPadBytes
- zeroPadValue
Wallet
- Mnemonic
- QiHDWallet
- QuaiHDWallet
- Wallet
- EncryptOptions
- KeystoreAccount
- decryptKeystoreJson
- decryptKeystoreJsonSync
- encryptKeystoreJson
- encryptKeystoreJsonSync
- isKeystoreJson
