@bitgo-beta/sdk-coin-canton 1.0.1-beta.8 → 1.0.1-beta.81

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.
Files changed (100) hide show
  1. package/dist/resources/hash/hash.d.ts +5 -0
  2. package/dist/resources/hash/hash.js +298 -0
  3. package/dist/resources/proto/damlTransaction.js +100 -0
  4. package/dist/resources/proto/damlTransactionNode.js +71 -0
  5. package/dist/resources/proto/damlTransactionNodeSeed.js +56 -0
  6. package/dist/resources/proto/metadata/metadataGlobalKeyMappingEntry.js +53 -0
  7. package/dist/resources/proto/metadata/metadataInputContract.js +80 -0
  8. package/dist/resources/proto/metadata/metadataSubmitterInfo.js +62 -0
  9. package/dist/resources/proto/metadata.js +189 -0
  10. package/dist/resources/proto/node/empty.js +36 -0
  11. package/dist/resources/proto/node/globalKey.js +81 -0
  12. package/dist/resources/proto/node/identifier.js +73 -0
  13. package/dist/resources/proto/node/node.js +664 -0
  14. package/dist/resources/proto/node/timestamp.js +145 -0
  15. package/dist/resources/proto/node/value.js +838 -0
  16. package/dist/resources/proto/preparedTransaction.d.ts +8 -0
  17. package/dist/resources/proto/preparedTransaction.js +66 -0
  18. package/dist/src/canton.d.ts +4 -2
  19. package/dist/src/canton.d.ts.map +1 -1
  20. package/dist/src/canton.js +44 -6
  21. package/dist/src/index.d.ts +1 -0
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +2 -1
  24. package/dist/src/lib/constant.d.ts +16 -0
  25. package/dist/src/lib/constant.d.ts.map +1 -0
  26. package/dist/src/lib/constant.js +19 -0
  27. package/dist/src/lib/iface.d.ts +101 -0
  28. package/dist/src/lib/iface.d.ts.map +1 -1
  29. package/dist/src/lib/iface.js +1 -1
  30. package/dist/src/lib/index.d.ts +7 -1
  31. package/dist/src/lib/index.d.ts.map +1 -1
  32. package/dist/src/lib/index.js +15 -3
  33. package/dist/src/lib/keyPair.d.ts +7 -1
  34. package/dist/src/lib/keyPair.d.ts.map +1 -1
  35. package/dist/src/lib/keyPair.js +24 -4
  36. package/dist/src/lib/oneStepPreApprovalBuilder.d.ts +51 -0
  37. package/dist/src/lib/oneStepPreApprovalBuilder.d.ts.map +1 -0
  38. package/dist/src/lib/oneStepPreApprovalBuilder.js +101 -0
  39. package/dist/src/lib/resourcesInterface.d.ts +214 -0
  40. package/dist/src/lib/resourcesInterface.d.ts.map +1 -0
  41. package/dist/src/lib/resourcesInterface.js +3 -0
  42. package/dist/src/lib/transaction/transaction.d.ts +23 -0
  43. package/dist/src/lib/transaction/transaction.d.ts.map +1 -0
  44. package/dist/src/lib/transaction/transaction.js +168 -0
  45. package/dist/src/lib/transactionBuilder.d.ts +10 -17
  46. package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
  47. package/dist/src/lib/transactionBuilder.js +31 -27
  48. package/dist/src/lib/transactionBuilderFactory.d.ts +15 -3
  49. package/dist/src/lib/transactionBuilderFactory.d.ts.map +1 -1
  50. package/dist/src/lib/transactionBuilderFactory.js +56 -6
  51. package/dist/src/lib/transferAcceptanceBuilder.d.ts +59 -0
  52. package/dist/src/lib/transferAcceptanceBuilder.d.ts.map +1 -0
  53. package/dist/src/lib/transferAcceptanceBuilder.js +116 -0
  54. package/dist/src/lib/transferAcknowledgeBuilder.d.ts +72 -0
  55. package/dist/src/lib/transferAcknowledgeBuilder.d.ts.map +1 -0
  56. package/dist/src/lib/transferAcknowledgeBuilder.js +133 -0
  57. package/dist/src/lib/transferBuilder.d.ts +5 -1
  58. package/dist/src/lib/transferBuilder.d.ts.map +1 -1
  59. package/dist/src/lib/transferBuilder.js +8 -1
  60. package/dist/src/lib/transferRejectionBuilder.d.ts +59 -0
  61. package/dist/src/lib/transferRejectionBuilder.d.ts.map +1 -0
  62. package/dist/src/lib/transferRejectionBuilder.js +116 -0
  63. package/dist/src/lib/utils.d.ts +101 -0
  64. package/dist/src/lib/utils.d.ts.map +1 -1
  65. package/dist/src/lib/utils.js +258 -3
  66. package/dist/src/lib/walletInitBuilder.d.ts +101 -0
  67. package/dist/src/lib/walletInitBuilder.d.ts.map +1 -0
  68. package/dist/src/lib/walletInitBuilder.js +232 -0
  69. package/dist/src/lib/walletInitialization/walletInitTransaction.d.ts +16 -0
  70. package/dist/src/lib/walletInitialization/walletInitTransaction.d.ts.map +1 -0
  71. package/dist/src/lib/walletInitialization/walletInitTransaction.js +87 -0
  72. package/dist/test/resources.d.ts +76 -0
  73. package/dist/test/resources.d.ts.map +1 -0
  74. package/dist/test/resources.js +91 -0
  75. package/dist/test/unit/builder/oneStepEnablement/oneStepEnablementBuilder.d.ts +2 -0
  76. package/dist/test/unit/builder/oneStepEnablement/oneStepEnablementBuilder.d.ts.map +1 -0
  77. package/dist/test/unit/builder/oneStepEnablement/oneStepEnablementBuilder.js +66 -0
  78. package/dist/test/unit/builder/transferAccept/transferAcceptBuilder.d.ts +2 -0
  79. package/dist/test/unit/builder/transferAccept/transferAcceptBuilder.d.ts.map +1 -0
  80. package/dist/test/unit/builder/transferAccept/transferAcceptBuilder.js +56 -0
  81. package/dist/test/unit/builder/transferAcknowledge/transferAcknowledgeBuilder.d.ts +2 -0
  82. package/dist/test/unit/builder/transferAcknowledge/transferAcknowledgeBuilder.d.ts.map +1 -0
  83. package/dist/test/unit/builder/transferAcknowledge/transferAcknowledgeBuilder.js +32 -0
  84. package/dist/test/unit/builder/transferReject/transferRejectBuilder.d.ts +2 -0
  85. package/dist/test/unit/builder/transferReject/transferRejectBuilder.d.ts.map +1 -0
  86. package/dist/test/unit/builder/transferReject/transferRejectBuilder.js +56 -0
  87. package/dist/test/unit/builder/walletInit/walletInitBuilder.d.ts +2 -0
  88. package/dist/test/unit/builder/walletInit/walletInitBuilder.d.ts.map +1 -0
  89. package/dist/test/unit/builder/walletInit/walletInitBuilder.js +65 -0
  90. package/dist/test/unit/keyPair.d.ts +2 -0
  91. package/dist/test/unit/keyPair.d.ts.map +1 -0
  92. package/dist/test/unit/keyPair.js +72 -0
  93. package/dist/test/unit/utils.d.ts +2 -0
  94. package/dist/test/unit/utils.d.ts.map +1 -0
  95. package/dist/test/unit/utils.js +76 -0
  96. package/dist/tsconfig.tsbuildinfo +1 -1
  97. package/package.json +29 -10
  98. package/dist/src/lib/transaction.d.ts +0 -8
  99. package/dist/src/lib/transaction.d.ts.map +0 -1
  100. package/dist/src/lib/transaction.js +0 -17
@@ -0,0 +1,145 @@
1
+ const {
2
+ MessageType,
3
+ UnknownFieldHandler,
4
+ reflectionMergePartial,
5
+ WireType,
6
+ PbLong,
7
+ typeofJsonValue,
8
+ } = require('@protobuf-ts/runtime');
9
+
10
+ class Timestamp$Type extends MessageType {
11
+ constructor() {
12
+ super('google.protobuf.Timestamp', [
13
+ {
14
+ no: 1,
15
+ name: 'seconds',
16
+ kind: 'scalar',
17
+ T: 3 /*ScalarType.INT64*/,
18
+ L: 0 /*LongType.BIGINT*/,
19
+ },
20
+ { no: 2, name: 'nanos', kind: 'scalar', T: 5 /*ScalarType.INT32*/ },
21
+ ]);
22
+ }
23
+ /**
24
+ * Creates a new `Timestamp` for the current time.
25
+ */
26
+ now() {
27
+ const msg = this.create();
28
+ const ms = Date.now();
29
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
30
+ msg.nanos = (ms % 1000) * 1000000;
31
+ return msg;
32
+ }
33
+ /**
34
+ * Converts a `Timestamp` to a JavaScript Date.
35
+ */
36
+ toDate(message) {
37
+ return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
38
+ }
39
+ /**
40
+ * Converts a JavaScript Date to a `Timestamp`.
41
+ */
42
+ fromDate(date) {
43
+ const msg = this.create();
44
+ const ms = date.getTime();
45
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
46
+ msg.nanos = ((ms % 1000) + (ms < 0 && ms % 1000 !== 0 ? 1000 : 0)) * 1000000;
47
+ return msg;
48
+ }
49
+ /**
50
+ * In JSON format, the `Timestamp` type is encoded as a string
51
+ * in the RFC 3339 format.
52
+ */
53
+ internalJsonWrite(message, options) {
54
+ const ms = PbLong.from(message.seconds).toNumber() * 1000;
55
+ if (ms < Date.parse('0001-01-01T00:00:00Z') || ms > Date.parse('9999-12-31T23:59:59Z'))
56
+ throw new Error(
57
+ 'Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.'
58
+ );
59
+ if (message.nanos < 0) throw new Error('Unable to encode invalid Timestamp to JSON. Nanos must not be negative.');
60
+ let z = 'Z';
61
+ if (message.nanos > 0) {
62
+ const nanosStr = (message.nanos + 1000000000).toString().substring(1);
63
+ if (nanosStr.substring(3) === '000000') z = '.' + nanosStr.substring(0, 3) + 'Z';
64
+ else if (nanosStr.substring(6) === '000') z = '.' + nanosStr.substring(0, 6) + 'Z';
65
+ else z = '.' + nanosStr + 'Z';
66
+ }
67
+ return new Date(ms).toISOString().replace('.000Z', z);
68
+ }
69
+ /**
70
+ * In JSON format, the `Timestamp` type is encoded as a string
71
+ * in the RFC 3339 format.
72
+ */
73
+ internalJsonRead(json, options, target) {
74
+ if (typeof json !== 'string') throw new Error('Unable to parse Timestamp from JSON ' + typeofJsonValue(json) + '.');
75
+ const matches = json.match(
76
+ /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/
77
+ );
78
+ if (!matches) throw new Error('Unable to parse Timestamp from JSON. Invalid format.');
79
+ const ms = Date.parse(
80
+ matches[1] +
81
+ '-' +
82
+ matches[2] +
83
+ '-' +
84
+ matches[3] +
85
+ 'T' +
86
+ matches[4] +
87
+ ':' +
88
+ matches[5] +
89
+ ':' +
90
+ matches[6] +
91
+ (matches[8] ? matches[8] : 'Z')
92
+ );
93
+ if (Number.isNaN(ms)) throw new Error('Unable to parse Timestamp from JSON. Invalid value.');
94
+ if (ms < Date.parse('0001-01-01T00:00:00Z') || ms > Date.parse('9999-12-31T23:59:59Z'))
95
+ throw new Error(
96
+ 'Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.'
97
+ );
98
+ if (!target) target = this.create();
99
+ target.seconds = PbLong.from(ms / 1000).toBigInt();
100
+ target.nanos = 0;
101
+ if (matches[7]) target.nanos = parseInt('1' + matches[7] + '0'.repeat(9 - matches[7].length), 10) - 1000000000;
102
+ return target;
103
+ }
104
+ create(value) {
105
+ const message = Object.create(this.messagePrototype);
106
+ message.seconds = 0n;
107
+ message.nanos = 0;
108
+ if (value !== undefined) reflectionMergePartial(this, message, value);
109
+ return message;
110
+ }
111
+ internalBinaryRead(reader, length, options, target) {
112
+ const message = target ?? this.create(),
113
+ end = reader.pos + length;
114
+ while (reader.pos < end) {
115
+ const [fieldNo, wireType] = reader.tag();
116
+ switch (fieldNo) {
117
+ case /* int64 seconds */ 1:
118
+ message.seconds = reader.int64().toBigInt();
119
+ break;
120
+ case /* int32 nanos */ 2:
121
+ message.nanos = reader.int32();
122
+ break;
123
+ default:
124
+ const u = options.readUnknownField;
125
+ if (u === 'throw') throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
126
+ const d = reader.skip(wireType);
127
+ if (u !== false) (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
128
+ }
129
+ }
130
+ return message;
131
+ }
132
+ internalBinaryWrite(message, writer, options) {
133
+ /* int64 seconds = 1; */
134
+ if (message.seconds !== 0n) writer.tag(1, WireType.Varint).int64(message.seconds);
135
+ /* int32 nanos = 2; */
136
+ if (message.nanos !== 0) writer.tag(2, WireType.Varint).int32(message.nanos);
137
+ const u = options.writeUnknownFields;
138
+ if (u !== false) (u === true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
139
+ return writer;
140
+ }
141
+ }
142
+ /**
143
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
144
+ */
145
+ module.exports.Timestamp = new Timestamp$Type();