mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-10 15:55:50 +00:00
Compare commits
8 Commits
@transia/r
...
@transia/x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c668f41b8 | ||
|
|
aeb29a20a1 | ||
|
|
8c814482e5 | ||
|
|
5b57ea8b77 | ||
|
|
7663e6049f | ||
|
|
420d6b2c35 | ||
|
|
02c41d2eb1 | ||
|
|
3f1a54f018 |
@@ -32,19 +32,19 @@ All of which works in Node.js (tested for v14+) & web browsers (tested for Chrom
|
|||||||
In an existing project (with package.json), install xrpl.js with:
|
In an existing project (with package.json), install xrpl.js with:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ npm install --save xrpl
|
$ npm install --save @transia/xrpl
|
||||||
```
|
```
|
||||||
|
|
||||||
Or with `yarn`:
|
Or with `yarn`:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ yarn add xrpl
|
$ yarn add @transia/xrpl
|
||||||
```
|
```
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const xrpl = require("xrpl");
|
const xrpl = require("@transia/xrpl");
|
||||||
async function main() {
|
async function main() {
|
||||||
const client = new xrpl.Client("wss://s.altnet.rippletest.net:51233");
|
const client = new xrpl.Client("wss://s.altnet.rippletest.net:51233");
|
||||||
await client.connect();
|
await client.connect();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@transia/ripple-binary-codec",
|
"name": "@transia/ripple-binary-codec",
|
||||||
"version": "1.4.6-alpha.5",
|
"version": "1.4.6-alpha.6",
|
||||||
"description": "XRP Ledger binary codec",
|
"description": "XRP Ledger binary codec",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/*",
|
"dist/*",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"LedgerHashes": 104,
|
"LedgerHashes": 104,
|
||||||
"Amendments": 102,
|
"Amendments": 102,
|
||||||
"FeeSettings": 115,
|
"FeeSettings": 115,
|
||||||
"ImportVlseq": 73,
|
"ImportVLSequence": 73,
|
||||||
"Escrow": 117,
|
"Escrow": 117,
|
||||||
"PayChannel": 120,
|
"PayChannel": 120,
|
||||||
"Check": 67,
|
"Check": 67,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@transia/xrpl",
|
"name": "@transia/xrpl",
|
||||||
"version": "2.7.3-alpha.18",
|
"version": "2.7.3-alpha.21",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
|
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@transia/ripple-address-codec": "^4.2.8-alpha.0",
|
"@transia/ripple-address-codec": "^4.2.8-alpha.0",
|
||||||
"@transia/ripple-binary-codec": "^1.4.6-alpha.5",
|
"@transia/ripple-binary-codec": "^1.4.6-alpha.6",
|
||||||
"@transia/ripple-keypairs": "^1.1.8-alpha.0",
|
"@transia/ripple-keypairs": "^1.1.8-alpha.0",
|
||||||
"bignumber.js": "^9.0.0",
|
"bignumber.js": "^9.0.0",
|
||||||
"bip32": "^2.0.6",
|
"bip32": "^2.0.6",
|
||||||
|
|||||||
@@ -14,6 +14,17 @@ export interface HookExecution {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface HookEmission {
|
||||||
|
HookEmission: {
|
||||||
|
EmitGeneration: number
|
||||||
|
EmitBurden: string
|
||||||
|
EmitParentTxnID: string
|
||||||
|
EmitNonce: string
|
||||||
|
EmitCallback: string
|
||||||
|
EmitHookHash: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export interface CreatedNode {
|
export interface CreatedNode {
|
||||||
CreatedNode: {
|
CreatedNode: {
|
||||||
LedgerEntryType: string
|
LedgerEntryType: string
|
||||||
@@ -75,6 +86,7 @@ export function isDeletedNode(node: Node): node is DeletedNode {
|
|||||||
|
|
||||||
export interface TransactionMetadata {
|
export interface TransactionMetadata {
|
||||||
HookExecutions?: HookExecution[]
|
HookExecutions?: HookExecution[]
|
||||||
|
HookEmissions?: HookEmission[]
|
||||||
AffectedNodes: Node[]
|
AffectedNodes: Node[]
|
||||||
DeliveredAmount?: Amount
|
DeliveredAmount?: Amount
|
||||||
// "unavailable" possible for transactions before 2014-01-20
|
// "unavailable" possible for transactions before 2014-01-20
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import {
|
|||||||
xAddressToClassicAddress,
|
xAddressToClassicAddress,
|
||||||
isValidXAddress,
|
isValidXAddress,
|
||||||
} from '@transia/ripple-address-codec'
|
} from '@transia/ripple-address-codec'
|
||||||
|
import { encode } from '@transia/ripple-binary-codec'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
|
|
||||||
import type { Client } from '..'
|
import type { Client } from '..'
|
||||||
@@ -11,7 +12,7 @@ import { Transaction } from '../models/transactions'
|
|||||||
import { setTransactionFlagsToNumber } from '../models/utils/flags'
|
import { setTransactionFlagsToNumber } from '../models/utils/flags'
|
||||||
import { xrpToDrops } from '../utils'
|
import { xrpToDrops } from '../utils'
|
||||||
|
|
||||||
import { getFeeXrp } from './getFeeXrp'
|
import { getFeeEstimateXrp, getFeeXrp } from './getFeeXrp'
|
||||||
|
|
||||||
// Expire unconfirmed transactions after 20 ledger versions, approximately 1 minute, by default
|
// Expire unconfirmed transactions after 20 ledger versions, approximately 1 minute, by default
|
||||||
const LEDGER_OFFSET = 20
|
const LEDGER_OFFSET = 20
|
||||||
@@ -60,7 +61,13 @@ async function autofill<T extends Transaction>(
|
|||||||
promises.push(checkAccountDeleteBlockers(this, tx))
|
promises.push(checkAccountDeleteBlockers(this, tx))
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises).then(() => tx)
|
await Promise.all(promises).then(() => tx)
|
||||||
|
const copyTx = { ...tx }
|
||||||
|
copyTx.SigningPubKey = ``
|
||||||
|
const tx_blob = encode(copyTx)
|
||||||
|
// eslint-disable-next-line require-atomic-updates -- ignore
|
||||||
|
tx.Fee = await getFeeEstimateXrp(this, tx_blob)
|
||||||
|
return tx
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValidAddresses(tx: Transaction): void {
|
function setValidAddresses(tx: Transaction): void {
|
||||||
|
|||||||
@@ -60,5 +60,5 @@ export async function getFeeEstimateXrp(
|
|||||||
command: 'fee',
|
command: 'fee',
|
||||||
tx_blob: txBlob,
|
tx_blob: txBlob,
|
||||||
})
|
})
|
||||||
return response.result.drops.base_fee
|
return response.result.drops.open_ledger_fee
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user