@splashprotocol/remote-builder 2.0.0-beta.8 → 2.0.0-beta.80

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.
@@ -4,13 +4,13 @@
4
4
  $ tsup src/index.ts --format esm,cjs --dts --clean
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.3.0
7
+ CLI tsup v8.4.0
8
8
  CLI Target: esnext
9
9
  CLI Cleaning output folder
10
10
  ESM Build start
11
11
  CJS Build start
12
12
 
13
- [4:51:26 PM]  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
13
+  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 2:10:33 PM
14
14
 
15
15
  package.json:16:6:
16
16
   16 │ "types": "./dist/index.d.ts"
@@ -31,7 +31,7 @@
31
31
 
32
32
 
33
33
 
34
- [4:51:26 PM]  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
34
+  WARN  ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json] 2:10:33 PM
35
35
 
36
36
  package.json:16:6:
37
37
   16 │ "types": "./dist/index.d.ts"
@@ -51,12 +51,12 @@
51
51
 
52
52
 
53
53
 
54
- ESM dist/index.js 1.47 KB
55
- ESM ⚡️ Build success in 25ms
56
- CJS dist/index.cjs 2.58 KB
57
- CJS ⚡️ Build success in 25ms
58
- DTS Build start
59
- DTS ⚡️ Build success in 937ms
60
- DTS dist/index.d.ts 1.87 KB
61
- DTS dist/index.d.cts 1.87 KB
62
- ✨ Done in 1.43s.
54
+ CJS dist/index.cjs 3.70 KB
55
+ CJS ⚡️ Build success in 24ms
56
+ ESM dist/index.js 2.39 KB
57
+ ESM ⚡️ Build success in 24ms
58
+ DTS Build start
59
+ DTS ⚡️ Build success in 1129ms
60
+ DTS dist/index.d.ts 2.78 KB
61
+ DTS dist/index.d.cts 2.78 KB
62
+ ✨ Done in 1.76s.
package/dist/index.cjs CHANGED
@@ -18,28 +18,42 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ InsufficientCollateralError: () => InsufficientCollateralError,
24
+ InsufficientFundsErrorForChange: () => InsufficientFundsErrorForChange,
25
+ NoCollateralError: () => NoCollateralError,
23
26
  RemoteTransaction: () => RemoteTransaction,
24
27
  SignedRemoteTransaction: () => SignedRemoteTransaction,
25
28
  SplashRemoteBuilder: () => SplashRemoteBuilder
26
29
  });
27
- module.exports = __toCommonJS(src_exports);
30
+ module.exports = __toCommonJS(index_exports);
28
31
 
29
32
  // src/core/models/RemoteTransaction/RemoteTransaction.ts
30
33
  var RemoteTransaction = class _RemoteTransaction {
31
- constructor(serialization, builder) {
34
+ constructor(serialization, builder, additionalData, partial) {
32
35
  this.builder = builder;
36
+ this.partial = partial;
33
37
  this.serialization = serialization;
38
+ this.additionalData = additionalData;
34
39
  }
35
- static new(serialization, builder) {
36
- return new _RemoteTransaction(serialization, builder);
40
+ static new(serialization, builder, additionalData, partial) {
41
+ return new _RemoteTransaction(
42
+ serialization,
43
+ builder,
44
+ additionalData,
45
+ partial
46
+ );
37
47
  }
38
48
  /**
39
49
  * Transaction serialization
40
50
  * @type {S}
41
51
  */
42
52
  serialization;
53
+ /**
54
+ * Transaction additional data
55
+ */
56
+ additionalData;
43
57
  sign() {
44
58
  return this.builder.sign(this);
45
59
  }
@@ -64,30 +78,54 @@ var SplashRemoteBuilder = class _SplashRemoteBuilder {
64
78
  throw new Error("not implemented.");
65
79
  }
66
80
  trade() {
67
- return Promise.resolve(RemoteTransaction.new("", this));
81
+ return Promise.resolve(RemoteTransaction.new("", this, void 0));
82
+ }
83
+ cancelOperation(outputReference) {
84
+ console.log(outputReference);
85
+ return Promise.resolve(RemoteTransaction.new("", this, void 0));
68
86
  }
69
87
  };
70
88
 
71
89
  // src/core/models/SignedRemoteTransaction/SignedRemoteTransaction.ts
72
90
  var SignedRemoteTransaction = class _SignedRemoteTransaction {
73
- constructor(serialization, builder) {
91
+ constructor(serialization, builder, additionalData) {
74
92
  this.builder = builder;
75
93
  this.serialization = serialization;
94
+ this.additionalData = additionalData;
76
95
  }
77
- static new(serialization, builder) {
78
- return new _SignedRemoteTransaction(serialization, builder);
96
+ static new(serialization, builder, additionalData) {
97
+ return new _SignedRemoteTransaction(serialization, builder, additionalData);
79
98
  }
80
99
  /**
81
100
  * Transaction serialization
82
101
  * @type {S}
83
102
  */
84
103
  serialization;
104
+ /**
105
+ * Transaction additional data
106
+ */
107
+ additionalData;
85
108
  submit() {
86
109
  return this.builder.submit(this);
87
110
  }
88
111
  };
112
+
113
+ // src/core/errors/InsufficientCollateralError.ts
114
+ var InsufficientCollateralError = class extends Error {
115
+ };
116
+
117
+ // src/core/errors/NoCollateralError.ts
118
+ var NoCollateralError = class extends Error {
119
+ };
120
+
121
+ // src/core/errors/InsufficientFundsErrorForChange.ts
122
+ var InsufficientFundsErrorForChange = class extends Error {
123
+ };
89
124
  // Annotate the CommonJS export names for ESM import in node:
90
125
  0 && (module.exports = {
126
+ InsufficientCollateralError,
127
+ InsufficientFundsErrorForChange,
128
+ NoCollateralError,
91
129
  RemoteTransaction,
92
130
  SignedRemoteTransaction,
93
131
  SplashRemoteBuilder
package/dist/index.d.cts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { Api, Backend, SplashBackend } from '@splashprotocol/api';
2
- import { TransactionHash, CborHexString } from '@splashprotocol/core';
2
+ import { TransactionHash, CborHexString, OutputReference, OutputReferenceHash } from '@splashprotocol/core';
3
3
 
4
- declare class SignedRemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>> {
4
+ declare class SignedRemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData> {
5
5
  private builder;
6
- static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>>(serialization: S, builder: RB): SignedRemoteTransaction<S, RB>;
6
+ static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData>(serialization: S, builder: RB, additionalData: AdditionalData): SignedRemoteTransaction<S, RB, AdditionalData>;
7
7
  /**
8
8
  * Transaction serialization
9
9
  * @type {S}
10
10
  */
11
11
  readonly serialization: S;
12
+ /**
13
+ * Transaction additional data
14
+ */
15
+ readonly additionalData: AdditionalData;
12
16
  private constructor();
13
17
  submit(): Promise<TransactionHash>;
14
18
  }
@@ -16,32 +20,47 @@ declare class SignedRemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}
16
20
  /**
17
21
  * Remote transaction representation
18
22
  */
19
- declare class RemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>> {
23
+ declare class RemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData> {
20
24
  private builder;
21
- static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>>(serialization: S, builder: RB): RemoteTransaction<S, RB>;
25
+ readonly partial?: boolean | undefined;
26
+ static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData>(serialization: S, builder: RB, additionalData: AdditionalData, partial?: boolean): RemoteTransaction<S, RB, AdditionalData>;
22
27
  /**
23
28
  * Transaction serialization
24
29
  * @type {S}
25
30
  */
26
31
  readonly serialization: S;
32
+ /**
33
+ * Transaction additional data
34
+ */
35
+ readonly additionalData: AdditionalData;
27
36
  private constructor();
28
- sign(): Promise<SignedRemoteTransaction<S, RB>>;
37
+ sign(): Promise<SignedRemoteTransaction<S, RB, AdditionalData>>;
29
38
  signAndSubmit(): Promise<TransactionHash>;
30
39
  }
31
40
 
32
41
  interface RemoteBuilder<A extends Api<Backend<{}>>, S> {
33
42
  readonly api: A;
34
- sign(tx: RemoteTransaction<S, RemoteBuilder<A, S>>): Promise<SignedRemoteTransaction<S, RemoteBuilder<A, S>>>;
35
- submit(signedTx: SignedRemoteTransaction<S, RemoteBuilder<A, S>>): Promise<TransactionHash>;
43
+ sign<AD>(tx: RemoteTransaction<S, RemoteBuilder<A, S>, AD>): Promise<SignedRemoteTransaction<S, RemoteBuilder<A, S>, AD>>;
44
+ submit<AD>(signedTx: SignedRemoteTransaction<S, RemoteBuilder<A, S>, AD>): Promise<TransactionHash>;
36
45
  }
37
46
 
38
47
  declare class SplashRemoteBuilder implements RemoteBuilder<Api<SplashBackend>, CborHexString> {
39
48
  static new(api: Api<SplashBackend>): SplashRemoteBuilder;
40
49
  readonly api: Api<SplashBackend>;
41
50
  private constructor();
42
- sign(): Promise<SignedRemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>>>;
51
+ sign(): Promise<SignedRemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>, any>>;
43
52
  submit(): Promise<TransactionHash>;
44
- trade(): Promise<RemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>>>;
53
+ trade(): Promise<RemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>, any>>;
54
+ cancelOperation(outputReference: OutputReference | OutputReferenceHash): Promise<RemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>, any>>;
55
+ }
56
+
57
+ declare class InsufficientCollateralError extends Error {
58
+ }
59
+
60
+ declare class NoCollateralError extends Error {
61
+ }
62
+
63
+ declare class InsufficientFundsErrorForChange extends Error {
45
64
  }
46
65
 
47
- export { type RemoteBuilder, RemoteTransaction, SignedRemoteTransaction, SplashRemoteBuilder };
66
+ export { InsufficientCollateralError, InsufficientFundsErrorForChange, NoCollateralError, type RemoteBuilder, RemoteTransaction, SignedRemoteTransaction, SplashRemoteBuilder };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { Api, Backend, SplashBackend } from '@splashprotocol/api';
2
- import { TransactionHash, CborHexString } from '@splashprotocol/core';
2
+ import { TransactionHash, CborHexString, OutputReference, OutputReferenceHash } from '@splashprotocol/core';
3
3
 
4
- declare class SignedRemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>> {
4
+ declare class SignedRemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData> {
5
5
  private builder;
6
- static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>>(serialization: S, builder: RB): SignedRemoteTransaction<S, RB>;
6
+ static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData>(serialization: S, builder: RB, additionalData: AdditionalData): SignedRemoteTransaction<S, RB, AdditionalData>;
7
7
  /**
8
8
  * Transaction serialization
9
9
  * @type {S}
10
10
  */
11
11
  readonly serialization: S;
12
+ /**
13
+ * Transaction additional data
14
+ */
15
+ readonly additionalData: AdditionalData;
12
16
  private constructor();
13
17
  submit(): Promise<TransactionHash>;
14
18
  }
@@ -16,32 +20,47 @@ declare class SignedRemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}
16
20
  /**
17
21
  * Remote transaction representation
18
22
  */
19
- declare class RemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>> {
23
+ declare class RemoteTransaction<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData> {
20
24
  private builder;
21
- static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>>(serialization: S, builder: RB): RemoteTransaction<S, RB>;
25
+ readonly partial?: boolean | undefined;
26
+ static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData>(serialization: S, builder: RB, additionalData: AdditionalData, partial?: boolean): RemoteTransaction<S, RB, AdditionalData>;
22
27
  /**
23
28
  * Transaction serialization
24
29
  * @type {S}
25
30
  */
26
31
  readonly serialization: S;
32
+ /**
33
+ * Transaction additional data
34
+ */
35
+ readonly additionalData: AdditionalData;
27
36
  private constructor();
28
- sign(): Promise<SignedRemoteTransaction<S, RB>>;
37
+ sign(): Promise<SignedRemoteTransaction<S, RB, AdditionalData>>;
29
38
  signAndSubmit(): Promise<TransactionHash>;
30
39
  }
31
40
 
32
41
  interface RemoteBuilder<A extends Api<Backend<{}>>, S> {
33
42
  readonly api: A;
34
- sign(tx: RemoteTransaction<S, RemoteBuilder<A, S>>): Promise<SignedRemoteTransaction<S, RemoteBuilder<A, S>>>;
35
- submit(signedTx: SignedRemoteTransaction<S, RemoteBuilder<A, S>>): Promise<TransactionHash>;
43
+ sign<AD>(tx: RemoteTransaction<S, RemoteBuilder<A, S>, AD>): Promise<SignedRemoteTransaction<S, RemoteBuilder<A, S>, AD>>;
44
+ submit<AD>(signedTx: SignedRemoteTransaction<S, RemoteBuilder<A, S>, AD>): Promise<TransactionHash>;
36
45
  }
37
46
 
38
47
  declare class SplashRemoteBuilder implements RemoteBuilder<Api<SplashBackend>, CborHexString> {
39
48
  static new(api: Api<SplashBackend>): SplashRemoteBuilder;
40
49
  readonly api: Api<SplashBackend>;
41
50
  private constructor();
42
- sign(): Promise<SignedRemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>>>;
51
+ sign(): Promise<SignedRemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>, any>>;
43
52
  submit(): Promise<TransactionHash>;
44
- trade(): Promise<RemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>>>;
53
+ trade(): Promise<RemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>, any>>;
54
+ cancelOperation(outputReference: OutputReference | OutputReferenceHash): Promise<RemoteTransaction<CborHexString, RemoteBuilder<Api<SplashBackend>, CborHexString>, any>>;
55
+ }
56
+
57
+ declare class InsufficientCollateralError extends Error {
58
+ }
59
+
60
+ declare class NoCollateralError extends Error {
61
+ }
62
+
63
+ declare class InsufficientFundsErrorForChange extends Error {
45
64
  }
46
65
 
47
- export { type RemoteBuilder, RemoteTransaction, SignedRemoteTransaction, SplashRemoteBuilder };
66
+ export { InsufficientCollateralError, InsufficientFundsErrorForChange, NoCollateralError, type RemoteBuilder, RemoteTransaction, SignedRemoteTransaction, SplashRemoteBuilder };
package/dist/index.js CHANGED
@@ -1,17 +1,28 @@
1
1
  // src/core/models/RemoteTransaction/RemoteTransaction.ts
2
2
  var RemoteTransaction = class _RemoteTransaction {
3
- constructor(serialization, builder) {
3
+ constructor(serialization, builder, additionalData, partial) {
4
4
  this.builder = builder;
5
+ this.partial = partial;
5
6
  this.serialization = serialization;
7
+ this.additionalData = additionalData;
6
8
  }
7
- static new(serialization, builder) {
8
- return new _RemoteTransaction(serialization, builder);
9
+ static new(serialization, builder, additionalData, partial) {
10
+ return new _RemoteTransaction(
11
+ serialization,
12
+ builder,
13
+ additionalData,
14
+ partial
15
+ );
9
16
  }
10
17
  /**
11
18
  * Transaction serialization
12
19
  * @type {S}
13
20
  */
14
21
  serialization;
22
+ /**
23
+ * Transaction additional data
24
+ */
25
+ additionalData;
15
26
  sign() {
16
27
  return this.builder.sign(this);
17
28
  }
@@ -36,29 +47,53 @@ var SplashRemoteBuilder = class _SplashRemoteBuilder {
36
47
  throw new Error("not implemented.");
37
48
  }
38
49
  trade() {
39
- return Promise.resolve(RemoteTransaction.new("", this));
50
+ return Promise.resolve(RemoteTransaction.new("", this, void 0));
51
+ }
52
+ cancelOperation(outputReference) {
53
+ console.log(outputReference);
54
+ return Promise.resolve(RemoteTransaction.new("", this, void 0));
40
55
  }
41
56
  };
42
57
 
43
58
  // src/core/models/SignedRemoteTransaction/SignedRemoteTransaction.ts
44
59
  var SignedRemoteTransaction = class _SignedRemoteTransaction {
45
- constructor(serialization, builder) {
60
+ constructor(serialization, builder, additionalData) {
46
61
  this.builder = builder;
47
62
  this.serialization = serialization;
63
+ this.additionalData = additionalData;
48
64
  }
49
- static new(serialization, builder) {
50
- return new _SignedRemoteTransaction(serialization, builder);
65
+ static new(serialization, builder, additionalData) {
66
+ return new _SignedRemoteTransaction(serialization, builder, additionalData);
51
67
  }
52
68
  /**
53
69
  * Transaction serialization
54
70
  * @type {S}
55
71
  */
56
72
  serialization;
73
+ /**
74
+ * Transaction additional data
75
+ */
76
+ additionalData;
57
77
  submit() {
58
78
  return this.builder.submit(this);
59
79
  }
60
80
  };
81
+
82
+ // src/core/errors/InsufficientCollateralError.ts
83
+ var InsufficientCollateralError = class extends Error {
84
+ };
85
+
86
+ // src/core/errors/NoCollateralError.ts
87
+ var NoCollateralError = class extends Error {
88
+ };
89
+
90
+ // src/core/errors/InsufficientFundsErrorForChange.ts
91
+ var InsufficientFundsErrorForChange = class extends Error {
92
+ };
61
93
  export {
94
+ InsufficientCollateralError,
95
+ InsufficientFundsErrorForChange,
96
+ NoCollateralError,
62
97
  RemoteTransaction,
63
98
  SignedRemoteTransaction,
64
99
  SplashRemoteBuilder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splashprotocol/remote-builder",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.80",
4
4
  "type": "module",
5
5
  "description": "Api client of splash protocol",
6
6
  "scripts": {
@@ -33,7 +33,8 @@
33
33
  ]
34
34
  },
35
35
  "peerDependencies": {
36
- "@splashprotocol/api": "2.0.0-beta.8",
37
- "@splashprotocol/core": "2.0.0-beta.8"
36
+ "@splashprotocol/api": "2.0.0-beta.57",
37
+ "@splashprotocol/core": "2.0.0-beta.19",
38
+ "@splashprotocol/browser-wallet": "1.0.0-beta.21"
38
39
  }
39
40
  }
@@ -1,7 +1,12 @@
1
1
  import { RemoteBuilder } from '../core/types/RemoteBuilder.ts';
2
2
  import { Api, SplashBackend } from '@splashprotocol/api';
3
3
  import { RemoteTransaction } from '../core/models/RemoteTransaction/RemoteTransaction.ts';
4
- import { CborHexString, TransactionHash } from '@splashprotocol/core';
4
+ import {
5
+ CborHexString,
6
+ OutputReference,
7
+ OutputReferenceHash,
8
+ TransactionHash,
9
+ } from '@splashprotocol/core';
5
10
  import { SignedRemoteTransaction } from '../core/models/SignedRemoteTransaction/SignedRemoteTransaction.ts';
6
11
 
7
12
  export class SplashRemoteBuilder
@@ -20,7 +25,8 @@ export class SplashRemoteBuilder
20
25
  sign(): Promise<
21
26
  SignedRemoteTransaction<
22
27
  CborHexString,
23
- RemoteBuilder<Api<SplashBackend>, CborHexString>
28
+ RemoteBuilder<Api<SplashBackend>, CborHexString>,
29
+ any
24
30
  >
25
31
  > {
26
32
  throw new Error('not implemented.');
@@ -33,9 +39,23 @@ export class SplashRemoteBuilder
33
39
  trade(): Promise<
34
40
  RemoteTransaction<
35
41
  CborHexString,
36
- RemoteBuilder<Api<SplashBackend>, CborHexString>
42
+ RemoteBuilder<Api<SplashBackend>, CborHexString>,
43
+ any
37
44
  >
38
45
  > {
39
- return Promise.resolve(RemoteTransaction.new('', this));
46
+ return Promise.resolve(RemoteTransaction.new('', this, undefined));
47
+ }
48
+
49
+ cancelOperation(
50
+ outputReference: OutputReference | OutputReferenceHash,
51
+ ): Promise<
52
+ RemoteTransaction<
53
+ CborHexString,
54
+ RemoteBuilder<Api<SplashBackend>, CborHexString>,
55
+ any
56
+ >
57
+ > {
58
+ console.log(outputReference);
59
+ return Promise.resolve(RemoteTransaction.new('', this, undefined));
40
60
  }
41
61
  }
@@ -0,0 +1 @@
1
+ export class InsufficientCollateralError extends Error {}
@@ -0,0 +1 @@
1
+ export class InsufficientFundsErrorForChange extends Error {}
@@ -0,0 +1 @@
1
+ export class NoCollateralError extends Error {}
@@ -9,12 +9,20 @@ import { TransactionHash } from '@splashprotocol/core';
9
9
  export class RemoteTransaction<
10
10
  S,
11
11
  RB extends RemoteBuilder<Api<Backend<{}>>, S>,
12
+ AdditionalData,
12
13
  > {
13
- static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>>(
14
+ static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData>(
14
15
  serialization: S,
15
16
  builder: RB,
16
- ): RemoteTransaction<S, RB> {
17
- return new RemoteTransaction(serialization, builder);
17
+ additionalData: AdditionalData,
18
+ partial?: boolean,
19
+ ): RemoteTransaction<S, RB, AdditionalData> {
20
+ return new RemoteTransaction(
21
+ serialization,
22
+ builder,
23
+ additionalData,
24
+ partial,
25
+ );
18
26
  }
19
27
 
20
28
  /**
@@ -23,14 +31,22 @@ export class RemoteTransaction<
23
31
  */
24
32
  readonly serialization: S;
25
33
 
34
+ /**
35
+ * Transaction additional data
36
+ */
37
+ readonly additionalData: AdditionalData;
38
+
26
39
  private constructor(
27
40
  serialization: S,
28
41
  private builder: RB,
42
+ additionalData: AdditionalData,
43
+ public readonly partial?: boolean,
29
44
  ) {
30
45
  this.serialization = serialization;
46
+ this.additionalData = additionalData;
31
47
  }
32
48
 
33
- sign(): Promise<SignedRemoteTransaction<S, RB>> {
49
+ sign(): Promise<SignedRemoteTransaction<S, RB, AdditionalData>> {
34
50
  return this.builder.sign(this) as any;
35
51
  }
36
52
 
@@ -5,12 +5,14 @@ import { TransactionHash } from '@splashprotocol/core';
5
5
  export class SignedRemoteTransaction<
6
6
  S,
7
7
  RB extends RemoteBuilder<Api<Backend<{}>>, S>,
8
+ AdditionalData,
8
9
  > {
9
- static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>>(
10
+ static new<S, RB extends RemoteBuilder<Api<Backend<{}>>, S>, AdditionalData>(
10
11
  serialization: S,
11
12
  builder: RB,
12
- ): SignedRemoteTransaction<S, RB> {
13
- return new SignedRemoteTransaction(serialization, builder);
13
+ additionalData: AdditionalData,
14
+ ): SignedRemoteTransaction<S, RB, AdditionalData> {
15
+ return new SignedRemoteTransaction(serialization, builder, additionalData);
14
16
  }
15
17
 
16
18
  /**
@@ -19,11 +21,18 @@ export class SignedRemoteTransaction<
19
21
  */
20
22
  readonly serialization: S;
21
23
 
24
+ /**
25
+ * Transaction additional data
26
+ */
27
+ readonly additionalData: AdditionalData;
28
+
22
29
  private constructor(
23
30
  serialization: S,
24
31
  private builder: RB,
32
+ additionalData: AdditionalData,
25
33
  ) {
26
34
  this.serialization = serialization;
35
+ this.additionalData = additionalData;
27
36
  }
28
37
 
29
38
  submit(): Promise<TransactionHash> {
@@ -6,11 +6,11 @@ import { TransactionHash } from '@splashprotocol/core';
6
6
  export interface RemoteBuilder<A extends Api<Backend<{}>>, S> {
7
7
  readonly api: A;
8
8
 
9
- sign(
10
- tx: RemoteTransaction<S, RemoteBuilder<A, S>>,
11
- ): Promise<SignedRemoteTransaction<S, RemoteBuilder<A, S>>>;
9
+ sign<AD>(
10
+ tx: RemoteTransaction<S, RemoteBuilder<A, S>, AD>,
11
+ ): Promise<SignedRemoteTransaction<S, RemoteBuilder<A, S>, AD>>;
12
12
 
13
- submit(
14
- signedTx: SignedRemoteTransaction<S, RemoteBuilder<A, S>>,
13
+ submit<AD>(
14
+ signedTx: SignedRemoteTransaction<S, RemoteBuilder<A, S>, AD>,
15
15
  ): Promise<TransactionHash>;
16
16
  }
package/src/index.ts CHANGED
@@ -2,3 +2,6 @@ export * from './core/types/RemoteBuilder.ts';
2
2
  export * from './builders/SplashRemoteBuilder.ts';
3
3
  export * from './core/models/SignedRemoteTransaction/SignedRemoteTransaction.ts';
4
4
  export * from './core/models/RemoteTransaction/RemoteTransaction.ts';
5
+ export * from './core/errors/InsufficientCollateralError.ts';
6
+ export * from './core/errors/NoCollateralError.ts';
7
+ export * from './core/errors/InsufficientFundsErrorForChange.ts';