@xyo-network/xl1-protocol-sdk 1.16.11 → 1.16.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import type { Address, Hash, Hex, Promisable } from '@xylabs/sdk-js';
2
2
  import type { Payload } from '@xyo-network/payload-model';
3
3
  import type { AllowedBlockPayload, AttoXL1, SignedHydratedTransaction, SignedHydratedTransactionWithHashMeta, TransactionFeesBigInt, UnsignedHydratedTransaction } from '@xyo-network/xl1-protocol';
4
+ import type { ConfirmSubmittedTransactionOptions } from '../transaction/index.ts';
4
5
  import type { DataLakeRunner } from './DataLake.ts';
5
6
  import type { XyoGateway } from './XyoGateway.ts';
6
7
  export interface TransactionOptions {
@@ -13,6 +14,7 @@ export interface TransactionOptions {
13
14
  export interface XyoGatewayRunnerMethods {
14
15
  addPayloadsToChain(onChain: AllowedBlockPayload[], offChain: Payload[], options?: TransactionOptions): Promisable<[Hash, SignedHydratedTransactionWithHashMeta]>;
15
16
  addTransactionToChain(tx: UnsignedHydratedTransaction | SignedHydratedTransaction): Promisable<[Hash, SignedHydratedTransactionWithHashMeta]>;
17
+ confirmSubmittedTransaction(txHash: Hash, options?: ConfirmSubmittedTransactionOptions): Promisable<SignedHydratedTransaction>;
16
18
  send(to: Address, amount: AttoXL1, options?: TransactionOptions): Promisable<Hash>;
17
19
  sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promisable<Hash>;
18
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"XyoGatewayRunner.d.ts","sourceRoot":"","sources":["../../../src/provider/XyoGatewayRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAC/B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EACV,mBAAmB,EAAE,OAAO,EAAE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E,OAAO,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IAClF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;CAC9F;AAED,MAAM,WAAW,gBAAiB,SAAQ,uBAAuB,EAAE,UAAU;IAC3E,SAAS,EAAE,cAAc,EAAE,CAAA;IAC3B,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAAA;IAC7C,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC"}
@@ -2,6 +2,7 @@ import type { Address, Hash, Promisable } from '@xylabs/sdk-js';
2
2
  import type { Payload, WithHashMeta } from '@xyo-network/payload-model';
3
3
  import { type AllowedBlockPayload, type AttoXL1, type SignedHydratedTransaction, type SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-protocol';
4
4
  import type { DataLakeRunner, TransactionOptions, XyoConnection, XyoGatewayRunner, XyoSigner } from '../../provider/index.ts';
5
+ import type { ConfirmSubmittedTransactionOptions } from '../../transaction/index.ts';
5
6
  export declare class SimpleXyoGatewayRunner implements XyoGatewayRunner {
6
7
  private readonly _connection;
7
8
  private _dataLakes;
@@ -13,6 +14,7 @@ export declare class SimpleXyoGatewayRunner implements XyoGatewayRunner {
13
14
  addDataLake(dataLake: DataLakeRunner): number;
14
15
  addPayloadsToChain(onChain: AllowedBlockPayload[], offChain: Payload[], options?: TransactionOptions): Promise<[Hash, SignedHydratedTransactionWithHashMeta]>;
15
16
  addTransactionToChain(tx: SignedHydratedTransaction): Promise<[Hash, SignedHydratedTransactionWithHashMeta]>;
17
+ confirmSubmittedTransaction(txHash: Hash, options?: ConfirmSubmittedTransactionOptions): Promise<SignedHydratedTransaction>;
16
18
  /** @deprecated use connectionInstance instead */
17
19
  connection(): Promisable<XyoConnection>;
18
20
  removeDataLake(index: number): void;
@@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AAE,cAAc,EAAO;IAM1F,IAAI,kBAAkB,IAAI,aAAa,CAEtC;IAED,IAAI,SAAS,IAAI,cAAc,EAAE,CAEhC;IAED,IAAI,cAAc,IAAI,SAAS,CAE9B;IAED,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM;IAKvC,kBAAkB,CACtB,OAAO,EAAE,mBAAmB,EAAE,EAC9B,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,qCAAqC,CAAC,CAAC;IAkBnD,qBAAqB,CAAC,EAAE,EAAE,yBAAyB,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,qCAAqC,CAAC,CAAC;IAY5G,2BAA2B,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,kCAAkC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAQjI,iDAAiD;IACjD,UAAU,IAAI,UAAU,CAAC,aAAa,CAAC;IAIvC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBhG,6CAA6C;IAC7C,MAAM,IAAI,UAAU,CAAC,SAAS,CAAC;cAIf,sBAAsB,CAAC,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOzF"}
@@ -1,6 +1,5 @@
1
- import type { Logger } from '@xylabs/sdk-js';
2
- import type { Signed } from '@xyo-network/boundwitness-model';
3
- import type { SignedHydratedTransaction, TransactionBoundWitness } from '@xyo-network/xl1-protocol';
1
+ import type { Hash, Logger } from '@xylabs/sdk-js';
2
+ import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol';
4
3
  import type { XyoViewer } from '../provider/index.ts';
5
4
  export type ConfirmSubmittedTransactionOptions = {
6
5
  /**
@@ -21,9 +20,9 @@ export type ConfirmSubmittedTransactionOptions = {
21
20
  /**
22
21
  * Confirms a submitted transaction by checking if it has been included in the blockchain.
23
22
  * @param viewer The viewer
24
- * @param transaction The transaction to confirm
23
+ * @param txHash The hash of the transaction to confirm
25
24
  * @param options Options for confirmation
26
25
  * @returns The confirmed transaction or throws an error if not confirmed
27
26
  */
28
- export declare const confirmSubmittedTransaction: (viewer: XyoViewer, transaction: Signed<TransactionBoundWitness>, options?: ConfirmSubmittedTransactionOptions) => Promise<SignedHydratedTransaction>;
27
+ export declare const confirmSubmittedTransaction: (viewer: XyoViewer, txHash: Hash, options?: ConfirmSubmittedTransactionOptions) => Promise<SignedHydratedTransaction>;
29
28
  //# sourceMappingURL=confirmSubmittedTransaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"confirmSubmittedTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/confirmSubmittedTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAE7D,OAAO,KAAK,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAKrD,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,SAAS,EACjB,aAAa,MAAM,CAAC,uBAAuB,CAAC,EAC5C,UAAU,kCAAkC,KAC3C,OAAO,CAAC,yBAAyB,CAqBnC,CAAA"}
1
+ {"version":3,"file":"confirmSubmittedTransaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/confirmSubmittedTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAKrD,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,SAAS,EACjB,QAAQ,IAAI,EACZ,UAAU,kCAAkC,KAC3C,OAAO,CAAC,yBAAyB,CAoBnC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/xl1-protocol-sdk",
4
- "version": "1.16.11",
4
+ "version": "1.16.13",
5
5
  "description": "XYO Layer One SDK Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -7,6 +7,7 @@ import type {
7
7
  UnsignedHydratedTransaction,
8
8
  } from '@xyo-network/xl1-protocol'
9
9
 
10
+ import type { ConfirmSubmittedTransactionOptions } from '../transaction/index.ts'
10
11
  import type { DataLakeRunner } from './DataLake.ts'
11
12
  import type { XyoGateway } from './XyoGateway.ts'
12
13
 
@@ -30,6 +31,8 @@ export interface XyoGatewayRunnerMethods {
30
31
  tx: UnsignedHydratedTransaction | SignedHydratedTransaction,
31
32
  ): Promisable<[Hash, SignedHydratedTransactionWithHashMeta]>
32
33
 
34
+ confirmSubmittedTransaction(txHash: Hash, options?: ConfirmSubmittedTransactionOptions): Promisable<SignedHydratedTransaction>
35
+
33
36
  send(to: Address, amount: AttoXL1, options?: TransactionOptions): Promisable<Hash>
34
37
  sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promisable<Hash>
35
38
  }
@@ -21,7 +21,8 @@ import type {
21
21
  XyoConnection, XyoGatewayRunner,
22
22
  XyoSigner,
23
23
  } from '../../provider/index.ts'
24
- import { buildUnsignedTransaction } from '../../transaction/index.ts'
24
+ import type { ConfirmSubmittedTransactionOptions } from '../../transaction/index.ts'
25
+ import { buildUnsignedTransaction, confirmSubmittedTransaction } from '../../transaction/index.ts'
25
26
 
26
27
  export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
27
28
  private readonly _connection: XyoConnection
@@ -85,6 +86,14 @@ export class SimpleXyoGatewayRunner implements XyoGatewayRunner {
85
86
  ), signedTx]
86
87
  }
87
88
 
89
+ async confirmSubmittedTransaction(txHash: Hash, options?: ConfirmSubmittedTransactionOptions): Promise<SignedHydratedTransaction> {
90
+ return await confirmSubmittedTransaction(
91
+ assertEx(this.connectionInstance.viewer, () => 'Connection viewer is undefined'),
92
+ txHash,
93
+ options,
94
+ )
95
+ }
96
+
88
97
  /** @deprecated use connectionInstance instead */
89
98
  connection(): Promisable<XyoConnection> {
90
99
  return this.connectionInstance
@@ -1,8 +1,6 @@
1
- import type { Logger } from '@xylabs/sdk-js'
1
+ import type { Hash, Logger } from '@xylabs/sdk-js'
2
2
  import { delay, isDefined } from '@xylabs/sdk-js'
3
- import type { Signed } from '@xyo-network/boundwitness-model'
4
- import { PayloadBuilder } from '@xyo-network/payload-builder'
5
- import type { SignedHydratedTransaction, TransactionBoundWitness } from '@xyo-network/xl1-protocol'
3
+ import type { SignedHydratedTransaction } from '@xyo-network/xl1-protocol'
6
4
 
7
5
  import type { XyoViewer } from '../provider/index.ts'
8
6
 
@@ -29,29 +27,28 @@ export type ConfirmSubmittedTransactionOptions = {
29
27
  /**
30
28
  * Confirms a submitted transaction by checking if it has been included in the blockchain.
31
29
  * @param viewer The viewer
32
- * @param transaction The transaction to confirm
30
+ * @param txHash The hash of the transaction to confirm
33
31
  * @param options Options for confirmation
34
32
  * @returns The confirmed transaction or throws an error if not confirmed
35
33
  */
36
34
  export const confirmSubmittedTransaction = async (
37
35
  viewer: XyoViewer,
38
- transaction: Signed<TransactionBoundWitness>,
36
+ txHash: Hash,
39
37
  options?: ConfirmSubmittedTransactionOptions,
40
38
  ): Promise<SignedHydratedTransaction> => {
41
39
  const { attempts: maxAttempts = DEFAULT_CONFIRMATION_ATTEMPTS, delay: attemptDelay = DEFAULT_DELAY_BETWEEN_ATTEMPTS } = options ?? {}
42
- const txBWHash = await PayloadBuilder.hash(transaction)
43
- options?.logger?.log('🚀 confirming transaction:', txBWHash, '\n')
40
+ options?.logger?.log('🚀 confirming transaction:', txHash, '\n')
44
41
  let attempts = 0
45
42
  while (true) {
46
- const tx = await viewer.transactionByHash(txBWHash) ?? undefined
43
+ const tx = await viewer.transactionByHash(txHash) ?? undefined
47
44
  if (isDefined(tx)) {
48
- options?.logger?.log('✅ Transaction confirmed:', txBWHash, '\n')
45
+ options?.logger?.log('✅ Transaction confirmed:', txHash, '\n')
49
46
  return tx
50
47
  } else {
51
48
  attempts++
52
49
  if (attempts > maxAttempts) {
53
50
  options?.logger?.error(`⚠️ Transaction not confirmed after ${maxAttempts} attempts`)
54
- throw new Error(`Transaction ${txBWHash} not confirmed after ${maxAttempts} attempts`)
51
+ throw new Error(`Transaction ${txHash} not confirmed after ${maxAttempts} attempts`)
55
52
  } else {
56
53
  options?.logger?.log(`🔄 Transaction not confirmed yet, attempt ${attempts}. Retrying...`, '\n')
57
54
  await delay(attemptDelay)