@chainlink/cre-sdk 1.6.0-alpha.5 → 1.7.0-alpha.1

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 (42) hide show
  1. package/dist/sdk/cre/index.d.ts +0 -6
  2. package/dist/sdk/cre/index.js +0 -8
  3. package/dist/sdk/errors.d.ts +5 -0
  4. package/dist/sdk/errors.js +10 -0
  5. package/dist/sdk/impl/runtime-impl.d.ts +8 -12
  6. package/dist/sdk/impl/runtime-impl.js +61 -33
  7. package/dist/sdk/runtime.d.ts +1 -3
  8. package/dist/sdk/test/generated/index.d.ts +0 -2
  9. package/dist/sdk/test/generated/index.js +0 -2
  10. package/dist/sdk/testutils/test-runtime.d.ts +0 -2
  11. package/dist/sdk/testutils/test-runtime.js +0 -8
  12. package/dist/sdk/testutils/test-writer.d.ts +1 -7
  13. package/dist/sdk/testutils/test-writer.js +1 -13
  14. package/dist/sdk/types/global.d.ts +0 -8
  15. package/dist/sdk/wasm/host-bindings.d.ts +0 -1
  16. package/dist/sdk/wasm/host-bindings.js +0 -4
  17. package/dist/sdk/wasm/runner.js +1 -0
  18. package/dist/sdk/wasm/runtime.js +1 -4
  19. package/dist/sdk/workflow.d.ts +5 -2
  20. package/dist/sdk/workflow.js +0 -1
  21. package/package.json +2 -2
  22. package/scripts/src/generate-sdks.ts +0 -12
  23. package/dist/generated/capabilities/blockchain/aptos/v1alpha/client_pb.d.ts +0 -1023
  24. package/dist/generated/capabilities/blockchain/aptos/v1alpha/client_pb.js +0 -290
  25. package/dist/generated/capabilities/blockchain/solana/v1alpha/client_pb.d.ts +0 -2904
  26. package/dist/generated/capabilities/blockchain/solana/v1alpha/client_pb.js +0 -506
  27. package/dist/generated/workflows/v2/cre_info_pb.d.ts +0 -123
  28. package/dist/generated/workflows/v2/cre_info_pb.js +0 -17
  29. package/dist/generated/workflows/v2/workflow_key_pb.d.ts +0 -55
  30. package/dist/generated/workflows/v2/workflow_key_pb.js +0 -17
  31. package/dist/generated/workflows/v2/workflow_user_metric_pb.d.ts +0 -118
  32. package/dist/generated/workflows/v2/workflow_user_metric_pb.js +0 -41
  33. package/dist/generated-sdk/capabilities/blockchain/aptos/v1alpha/client_sdk_gen.d.ts +0 -52
  34. package/dist/generated-sdk/capabilities/blockchain/aptos/v1alpha/client_sdk_gen.js +0 -186
  35. package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.d.ts +0 -92
  36. package/dist/generated-sdk/capabilities/blockchain/solana/v1alpha/client_sdk_gen.js +0 -343
  37. package/dist/sdk/test/generated/capabilities/blockchain/aptos/v1alpha/aptos_mock_gen.d.ts +0 -25
  38. package/dist/sdk/test/generated/capabilities/blockchain/aptos/v1alpha/aptos_mock_gen.js +0 -111
  39. package/dist/sdk/test/generated/capabilities/blockchain/solana/v1alpha/solana_mock_gen.d.ts +0 -33
  40. package/dist/sdk/test/generated/capabilities/blockchain/solana/v1alpha/solana_mock_gen.js +0 -178
  41. package/dist/sdk/utils/secrets-error.d.ts +0 -3
  42. package/dist/sdk/utils/secrets-error.js +0 -6
@@ -1,178 +0,0 @@
1
- import { fromJson } from '@bufbuild/protobuf';
2
- import { anyPack, anyUnpack } from '@bufbuild/protobuf/wkt';
3
- import { GetAccountInfoWithOptsReplySchema, GetAccountInfoWithOptsRequestSchema, GetBalanceReplySchema, GetBalanceRequestSchema, GetBlockReplySchema, GetBlockRequestSchema, GetFeeForMessageReplySchema, GetFeeForMessageRequestSchema, GetMultipleAccountsWithOptsReplySchema, GetMultipleAccountsWithOptsRequestSchema, GetSignatureStatusesReplySchema, GetSignatureStatusesRequestSchema, GetSlotHeightReplySchema, GetSlotHeightRequestSchema, GetTransactionReplySchema, GetTransactionRequestSchema, WriteReportReplySchema, WriteReportRequestSchema, } from '../../../../../../../generated/capabilities/blockchain/solana/v1alpha/client_pb';
4
- import { __getTestMockInstance, __setTestMockInstance, registerTestCapability, } from '../../../../../../testutils/test-runtime';
5
- /**
6
- * Mock for ClientCapability. Use testInstance() to obtain an instance; do not construct directly.
7
- * Set per-method properties (e.g. performAction) to define return values. If a method is invoked without a handler set, an error is thrown.
8
- */
9
- export class SolanaMock {
10
- static CAPABILITY_ID = 'solana@1.0.0';
11
- /** Set to define the return value for GetAccountInfoWithOpts. May return a plain object (GetAccountInfoWithOptsReplyJson) or the message type. */
12
- getAccountInfoWithOpts;
13
- /** Set to define the return value for GetBalance. May return a plain object (GetBalanceReplyJson) or the message type. */
14
- getBalance;
15
- /** Set to define the return value for GetBlock. May return a plain object (GetBlockReplyJson) or the message type. */
16
- getBlock;
17
- /** Set to define the return value for GetFeeForMessage. May return a plain object (GetFeeForMessageReplyJson) or the message type. */
18
- getFeeForMessage;
19
- /** Set to define the return value for GetMultipleAccountsWithOpts. May return a plain object (GetMultipleAccountsWithOptsReplyJson) or the message type. */
20
- getMultipleAccountsWithOpts;
21
- /** Set to define the return value for GetSignatureStatuses. May return a plain object (GetSignatureStatusesReplyJson) or the message type. */
22
- getSignatureStatuses;
23
- /** Set to define the return value for GetSlotHeight. May return a plain object (GetSlotHeightReplyJson) or the message type. */
24
- getSlotHeight;
25
- /** Set to define the return value for GetTransaction. May return a plain object (GetTransactionReplyJson) or the message type. */
26
- getTransaction;
27
- /** Set to define the return value for WriteReport. May return a plain object (WriteReportReplyJson) or the message type. */
28
- writeReport;
29
- constructor(chainSelector) {
30
- const self = this;
31
- const qualifiedId = `solana:ChainSelector:${chainSelector}@1.0.0`;
32
- try {
33
- registerTestCapability(qualifiedId, (req) => {
34
- switch (req.method) {
35
- case 'GetAccountInfoWithOpts': {
36
- const input = anyUnpack(req.payload, GetAccountInfoWithOptsRequestSchema);
37
- const handler = self.getAccountInfoWithOpts;
38
- if (typeof handler !== 'function')
39
- throw new Error("GetAccountInfoWithOpts: no implementation provided; set the mock's getAccountInfoWithOpts property to define the return value.");
40
- const raw = handler(input);
41
- const output = raw && typeof raw.$typeName === 'string'
42
- ? raw
43
- : fromJson(GetAccountInfoWithOptsReplySchema, raw);
44
- return {
45
- response: {
46
- case: 'payload',
47
- value: anyPack(GetAccountInfoWithOptsReplySchema, output),
48
- },
49
- };
50
- }
51
- case 'GetBalance': {
52
- const input = anyUnpack(req.payload, GetBalanceRequestSchema);
53
- const handler = self.getBalance;
54
- if (typeof handler !== 'function')
55
- throw new Error("GetBalance: no implementation provided; set the mock's getBalance property to define the return value.");
56
- const raw = handler(input);
57
- const output = raw && typeof raw.$typeName === 'string'
58
- ? raw
59
- : fromJson(GetBalanceReplySchema, raw);
60
- return { response: { case: 'payload', value: anyPack(GetBalanceReplySchema, output) } };
61
- }
62
- case 'GetBlock': {
63
- const input = anyUnpack(req.payload, GetBlockRequestSchema);
64
- const handler = self.getBlock;
65
- if (typeof handler !== 'function')
66
- throw new Error("GetBlock: no implementation provided; set the mock's getBlock property to define the return value.");
67
- const raw = handler(input);
68
- const output = raw && typeof raw.$typeName === 'string'
69
- ? raw
70
- : fromJson(GetBlockReplySchema, raw);
71
- return { response: { case: 'payload', value: anyPack(GetBlockReplySchema, output) } };
72
- }
73
- case 'GetFeeForMessage': {
74
- const input = anyUnpack(req.payload, GetFeeForMessageRequestSchema);
75
- const handler = self.getFeeForMessage;
76
- if (typeof handler !== 'function')
77
- throw new Error("GetFeeForMessage: no implementation provided; set the mock's getFeeForMessage property to define the return value.");
78
- const raw = handler(input);
79
- const output = raw && typeof raw.$typeName === 'string'
80
- ? raw
81
- : fromJson(GetFeeForMessageReplySchema, raw);
82
- return {
83
- response: { case: 'payload', value: anyPack(GetFeeForMessageReplySchema, output) },
84
- };
85
- }
86
- case 'GetMultipleAccountsWithOpts': {
87
- const input = anyUnpack(req.payload, GetMultipleAccountsWithOptsRequestSchema);
88
- const handler = self.getMultipleAccountsWithOpts;
89
- if (typeof handler !== 'function')
90
- throw new Error("GetMultipleAccountsWithOpts: no implementation provided; set the mock's getMultipleAccountsWithOpts property to define the return value.");
91
- const raw = handler(input);
92
- const output = raw && typeof raw.$typeName === 'string'
93
- ? raw
94
- : fromJson(GetMultipleAccountsWithOptsReplySchema, raw);
95
- return {
96
- response: {
97
- case: 'payload',
98
- value: anyPack(GetMultipleAccountsWithOptsReplySchema, output),
99
- },
100
- };
101
- }
102
- case 'GetSignatureStatuses': {
103
- const input = anyUnpack(req.payload, GetSignatureStatusesRequestSchema);
104
- const handler = self.getSignatureStatuses;
105
- if (typeof handler !== 'function')
106
- throw new Error("GetSignatureStatuses: no implementation provided; set the mock's getSignatureStatuses property to define the return value.");
107
- const raw = handler(input);
108
- const output = raw && typeof raw.$typeName === 'string'
109
- ? raw
110
- : fromJson(GetSignatureStatusesReplySchema, raw);
111
- return {
112
- response: {
113
- case: 'payload',
114
- value: anyPack(GetSignatureStatusesReplySchema, output),
115
- },
116
- };
117
- }
118
- case 'GetSlotHeight': {
119
- const input = anyUnpack(req.payload, GetSlotHeightRequestSchema);
120
- const handler = self.getSlotHeight;
121
- if (typeof handler !== 'function')
122
- throw new Error("GetSlotHeight: no implementation provided; set the mock's getSlotHeight property to define the return value.");
123
- const raw = handler(input);
124
- const output = raw && typeof raw.$typeName === 'string'
125
- ? raw
126
- : fromJson(GetSlotHeightReplySchema, raw);
127
- return {
128
- response: { case: 'payload', value: anyPack(GetSlotHeightReplySchema, output) },
129
- };
130
- }
131
- case 'GetTransaction': {
132
- const input = anyUnpack(req.payload, GetTransactionRequestSchema);
133
- const handler = self.getTransaction;
134
- if (typeof handler !== 'function')
135
- throw new Error("GetTransaction: no implementation provided; set the mock's getTransaction property to define the return value.");
136
- const raw = handler(input);
137
- const output = raw && typeof raw.$typeName === 'string'
138
- ? raw
139
- : fromJson(GetTransactionReplySchema, raw);
140
- return {
141
- response: { case: 'payload', value: anyPack(GetTransactionReplySchema, output) },
142
- };
143
- }
144
- case 'WriteReport': {
145
- const input = anyUnpack(req.payload, WriteReportRequestSchema);
146
- const handler = self.writeReport;
147
- if (typeof handler !== 'function')
148
- throw new Error("WriteReport: no implementation provided; set the mock's writeReport property to define the return value.");
149
- const raw = handler(input);
150
- const output = raw && typeof raw.$typeName === 'string'
151
- ? raw
152
- : fromJson(WriteReportReplySchema, raw);
153
- return { response: { case: 'payload', value: anyPack(WriteReportReplySchema, output) } };
154
- }
155
- default:
156
- return { response: { case: 'error', value: `unknown method ${req.method}` } };
157
- }
158
- });
159
- }
160
- catch {
161
- throw new Error("Capability mocks must be used within the CRE test framework's test() method.");
162
- }
163
- }
164
- /**
165
- * Returns the mock instance for this capability and the specified tags.
166
- * Multiple calls with the same tag values return the same instance.
167
- * Must be called within the test framework's test() method.
168
- */
169
- static testInstance(chainSelector) {
170
- const qualifiedId = `solana:ChainSelector:${chainSelector}@1.0.0`;
171
- let instance = __getTestMockInstance(qualifiedId);
172
- if (!instance) {
173
- instance = new SolanaMock(chainSelector);
174
- __setTestMockInstance(qualifiedId, instance);
175
- }
176
- return instance;
177
- }
178
- }
@@ -1,3 +0,0 @@
1
- export declare class SecretsError extends Error {
2
- constructor(message: string);
3
- }
@@ -1,6 +0,0 @@
1
- export class SecretsError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = 'SecretsError';
5
- }
6
- }