Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@xchainjs/xchain-client
Advanced tools
Returns the client.
getClient(): XChainClient
Used to set a type of NETWORK, which is either MAINNET or TESTNET.
enum Network {
TEST = 'testnet',
MAIN = 'mainnet',
}
setNetwork(net: Network): XChainClient
Returns the client.
Returns the current network, to set conditional responses for other functions (like which network to send transactions to, etc). Normally used internally, but can be used externally.
getNetwork(): Network
Returns the network.
Returns the correctly formatted url string for either paths for:
The default Explorer baseURL can be hard-coded.
enum Path {
address = 'address',
tx = 'tx',
}
getExplorerUrl(type: Path, param: string): string
The function should return the correctly formatted url string.
Sets the url to the remote node attached to the client, for getting on-chain data and broadcasting transactions. The default Node URL can be hard-coded, making this function optional.
setNodeURL(url: string)
Sets an API key if the client needs an API key to access its remote node. If no key is set, either the node has no API key or the client is expected to stay within node rate limits.
setNodeAPIKey(key: string)
Wallet calls to set the master BIP39 phrase.
setPhrase(phrase: string): address
The function should return the address generated by the phrase.
Returns the balance of an address. If address not passed, gets the balance of the current address.
CHAIN.SYMBOL-ID
getBalance(address?: Address): Promise<Balances>
Example of a third-party service query https://api.blockchair.com/bitcoin/addresses/balances?addresses=34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo
Example of a coin array:
[
{
"coin" : "BTC.BTC"
"amount" : 100000000
}
]
Gets a simplied array of recent transactions for an address.
getTransactions(params?: GetTxsParams): Promise<TxPage>
Example of third party service to help: https://api.blockchair.com/bitcoin/outputs?recipient=34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo
Example of return:
[
{
"from" : "34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo"
"to" : 34vRoCGJym3xR7yCVPFHoCNxv4Twseoxp4
"amount: 100000000,
"date" : date-time-group
}
]
Due to the complexity of this function and dependence of third-party services, this function can be omitted in early versions of the client.
General transfer function. The transaction should be signed and broadcast using the Node URL. The fee should always be rate, which is units per transaction size. The size should be calculated on the fly or hardcoded:
export type TxParams = {
asset: string // BTC.BTC
amount: number // in base format (10**8)
recipient: address // address
feeRate: number // feeRate
memo: string // optional memo to pass
}
transfer(params: TxParams): Promise<TransferResult>
The function should return the hash of the finalised transaction.
Specific vault transaction to deposit assets into THORChain. If the deposit function is the same as the transfer function, it should wrap it. If it is separate (smart contract call) that logic should be done here.
deposit(params: TxParams): Promise<TransferResult>
The function should return the hash of the finalised transaction.
This function calculates and returns the fee object.
getFees(): Promise<Fees>
This should return an object of fee rates for a simple transfer function.
Example, the following are sats/byte rates for Bitcoin. If this was ethereum, they would be GWEI.
[{"fast" : 100
"average" : 50
"slow" : 20}]
Edge cases
FAQs
A specification for a generalised interface for crypto wallets clients, to be used by XChainJS implementations. The client should not have any functionality to generate a key, instead, the `xchain-crypto` library should be used to ensure cross-chain compa
The npm package @xchainjs/xchain-client receives a total of 50 weekly downloads. As such, @xchainjs/xchain-client popularity was classified as not popular.
We found that @xchainjs/xchain-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 11 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.