Compare commits

...

6 Commits

Author SHA1 Message Date
Denis Angell
445d0c6633 Publish
- @transia/xrpl@2.7.3-alpha.25
2024-02-29 15:46:48 +01:00
Denis Angell
501d3158a0 fix account namespace error 2024-02-29 15:45:18 +01:00
Denis Angell
e27943aa3a add ID to cancel/create transactions 2024-02-29 15:43:33 +01:00
Denis Angell
c7aafb2595 add AccountNamespace and fix metadata 2024-02-29 15:42:17 +01:00
Denis Angell
036312d361 Publish
- @transia/ripple-binary-codec@1.4.6-alpha.8
 - @transia/xrpl@2.7.3-alpha.24
2024-01-27 18:19:08 +01:00
Denis Angell
3467680506 Update definitions.json 2024-01-27 18:18:29 +01:00
9 changed files with 109 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@transia/ripple-binary-codec",
"version": "1.4.6-alpha.7",
"version": "1.4.6-alpha.8",
"description": "XRP Ledger binary codec",
"files": [
"dist/*",

View File

@@ -141,40 +141,40 @@
[
"LedgerEntry",
{
"nth": 257,
"nth": 1,
"isVLEncoded": false,
"isSerialized": false,
"isSigningField": false,
"isSigningField": true,
"type": "LedgerEntry"
}
],
[
"Transaction",
{
"nth": 257,
"nth": 1,
"isVLEncoded": false,
"isSerialized": false,
"isSigningField": false,
"isSigningField": true,
"type": "Transaction"
}
],
[
"Validation",
{
"nth": 257,
"nth": 1,
"isVLEncoded": false,
"isSerialized": false,
"isSigningField": false,
"isSigningField": true,
"type": "Validation"
}
],
[
"Metadata",
{
"nth": 257,
"nth": 1,
"isVLEncoded": false,
"isSerialized": false,
"isSigningField": false,
"isSerialized": true,
"isSigningField": true,
"type": "Metadata"
}
],

View File

@@ -1,6 +1,6 @@
{
"name": "@transia/xrpl",
"version": "2.7.3-alpha.23",
"version": "2.7.3-alpha.25",
"license": "ISC",
"description": "A TypeScript/JavaScript API for interacting with the XRP Ledger in Node.js and the browser",
"files": [
@@ -23,7 +23,7 @@
},
"dependencies": {
"@transia/ripple-address-codec": "^4.2.8-alpha.0",
"@transia/ripple-binary-codec": "^1.4.6-alpha.7",
"@transia/ripple-binary-codec": "^1.4.6-alpha.8",
"@transia/ripple-keypairs": "^1.1.8-alpha.0",
"bignumber.js": "^9.0.0",
"bip32": "^2.0.6",

View File

@@ -0,0 +1,46 @@
import { HookState } from '../ledger'
import { BaseRequest, BaseResponse } from './baseMethod'
/**
* The `account_namespace` command retrieves the account namespace. All information retrieved is relative to a
* particular version of the ledger. Returns an {@link AccountNamespaceResponse}.
*
* @category Requests
*/
export interface AccountNamespaceRequest extends BaseRequest {
command: 'account_namespace'
/** A unique identifier for the account, most commonly the account's address. */
account: string
/** The hex namespace. */
namespace_id?: string
}
/**
* Response expected from an {@link AccountNamespaceRequest}.
*
* @category Responses
*/
export interface AccountNamespaceResponse extends BaseResponse {
result: {
/**
* The account requested.
*/
account: string
/**
* The namespace_id requested.
*/
namespace_id: string
/**
* A list of HookStates for the specified account namespace_id.
*/
namespace_entries: HookState[]
/**
* The ledger index of the current open ledger, which was used when
* retrieving this information.
*/
ledger_current_index: number
/** If true, this data comes from a validated ledger. */
validated: boolean
}
}

View File

@@ -8,6 +8,10 @@ import {
} from './accountCurrencies'
import { AccountInfoRequest, AccountInfoResponse } from './accountInfo'
import { AccountLinesRequest, AccountLinesResponse } from './accountLines'
import {
AccountNamespaceRequest,
AccountNamespaceResponse,
} from './accountNamespace'
import { AccountNFTsRequest, AccountNFTsResponse } from './accountNFTs'
import { AccountObjectsRequest, AccountObjectsResponse } from './accountObjects'
import {
@@ -83,6 +87,7 @@ type Request =
| AccountCurrenciesRequest
| AccountInfoRequest
| AccountLinesRequest
| AccountNamespaceRequest
| AccountNFTsRequest
| AccountObjectsRequest
| AccountOffersRequest
@@ -133,6 +138,7 @@ type Response =
| AccountCurrenciesResponse
| AccountInfoResponse
| AccountLinesResponse
| AccountNamespaceResponse
| AccountNFTsResponse
| AccountObjectsResponse
| AccountOffersResponse

View File

@@ -15,7 +15,12 @@ export interface EscrowCancel extends BaseTransaction {
* Transaction sequence (or Ticket number) of EscrowCreate transaction that.
* created the escrow to cancel.
*/
OfferSequence: number
OfferSequence?: number
/**
* The ID of the Escrow ledger object to cancel as a 64-character hexadecimal
* string.
*/
EscrowID?: string
}
/**
@@ -35,11 +40,17 @@ export function validateEscrowCancel(tx: Record<string, unknown>): void {
throw new ValidationError('EscrowCancel: Owner must be a string')
}
if (tx.OfferSequence === undefined) {
throw new ValidationError('EscrowCancel: missing OfferSequence')
if (tx.OfferSequence === undefined && tx.EscrowID === undefined) {
throw new ValidationError(
'EscrowCancel: must include OfferSequence or EscrowID',
)
}
if (typeof tx.OfferSequence !== 'number') {
throw new ValidationError('EscrowCancel: OfferSequence must be a number')
if (tx.OfferSequence !== undefined && typeof tx.OfferSequence !== 'number') {
throw new ValidationError('EscrowCancel: invalid OfferSequence')
}
if (tx.EscrowID !== undefined && typeof tx.EscrowID !== 'string') {
throw new ValidationError('EscrowCancel: invalid EscrowID')
}
}

View File

@@ -11,17 +11,16 @@ export interface HookExecution {
HookReturnCode: string
HookReturnString: string
HookStateChangeCount: number
Flags: number
}
}
export interface HookEmission {
HookEmission: {
EmitGeneration: number
EmitBurden: string
EmitParentTxnID: string
EmittedTxnID: string
HookAccount: string
HookHash: string
EmitNonce: string
EmitCallback: string
EmitHookHash: string
}
}

View File

@@ -15,7 +15,12 @@ export interface OfferCancel extends BaseTransaction {
* created by that transaction. It is not considered an error if the offer.
* specified does not exist.
*/
OfferSequence: number
OfferSequence?: number
/**
* The ID of the Escrow ledger object to cancel as a 64-character hexadecimal
* string.
*/
OfferID?: string
}
/**
@@ -27,11 +32,17 @@ export interface OfferCancel extends BaseTransaction {
export function validateOfferCancel(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.OfferSequence === undefined) {
throw new ValidationError('OfferCancel: missing field OfferSequence')
if (tx.OfferSequence === undefined && tx.OfferID === undefined) {
throw new ValidationError(
'OfferCancel: must include OfferSequence or OfferID',
)
}
if (typeof tx.OfferSequence !== 'number') {
throw new ValidationError('OfferCancel: OfferSequence must be a number')
if (tx.OfferSequence !== undefined && typeof tx.OfferSequence !== 'number') {
throw new ValidationError('OfferCancel: invalid OfferSequence')
}
if (tx.OfferID !== undefined && typeof tx.OfferID !== 'string') {
throw new ValidationError('OfferCancel: invalid OfferID')
}
}

View File

@@ -103,6 +103,11 @@ export interface OfferCreate extends BaseTransaction {
Expiration?: number
/** An offer to delete first, specified in the same way as OfferCancel. */
OfferSequence?: number
/**
* The ID of the Offer ledger object to cancel as a 64-character hexadecimal
* string.
*/
OfferID?: string
/** The amount and type of currency being provided by the offer creator. */
TakerGets: Amount
/** The amount and type of currency being requested by the offer creator. */
@@ -141,4 +146,8 @@ export function validateOfferCreate(tx: Record<string, unknown>): void {
if (tx.OfferSequence !== undefined && typeof tx.OfferSequence !== 'number') {
throw new ValidationError('OfferCreate: invalid OfferSequence')
}
if (tx.OfferID !== undefined && typeof tx.OfferID !== 'string') {
throw new ValidationError('OfferCreate: invalid OfferID')
}
}