near-api-ts 0.2.0

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 (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/dist/index.cjs +3222 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +838 -0
  6. package/dist/index.d.ts +838 -0
  7. package/dist/index.js +3169 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +44 -0
  10. package/src/_common/configs/constants.ts +23 -0
  11. package/src/_common/schemas/borsh/actions/addKey.ts +44 -0
  12. package/src/_common/schemas/borsh/actions/createAccount.ts +7 -0
  13. package/src/_common/schemas/borsh/actions/deleteAccount.ts +9 -0
  14. package/src/_common/schemas/borsh/actions/deleteKey.ts +11 -0
  15. package/src/_common/schemas/borsh/actions/deployContract.ts +9 -0
  16. package/src/_common/schemas/borsh/actions/deployGlobalContract.ts +24 -0
  17. package/src/_common/schemas/borsh/actions/functionCall.ts +12 -0
  18. package/src/_common/schemas/borsh/actions/signedDelegate.ts +13 -0
  19. package/src/_common/schemas/borsh/actions/stake.ts +12 -0
  20. package/src/_common/schemas/borsh/actions/transfer.ts +9 -0
  21. package/src/_common/schemas/borsh/actions/useGlobalContract.ts +23 -0
  22. package/src/_common/schemas/borsh/delegateAction.ts +41 -0
  23. package/src/_common/schemas/borsh/index.ts +3 -0
  24. package/src/_common/schemas/borsh/publicKey.ts +25 -0
  25. package/src/_common/schemas/borsh/signature.ts +25 -0
  26. package/src/_common/schemas/borsh/signedTransaction.ts +10 -0
  27. package/src/_common/schemas/borsh/transaction.ts +42 -0
  28. package/src/_common/schemas/valibot/common.ts +12 -0
  29. package/src/_common/schemas/valibot/cryptoHash.ts +12 -0
  30. package/src/_common/schemas/valibot/curveString.ts +23 -0
  31. package/src/_common/schemas/valibot/privateKey.ts +38 -0
  32. package/src/_common/schemas/valibot/publicKey.ts +33 -0
  33. package/src/_common/schemas/valibot/transaction.ts +42 -0
  34. package/src/_common/schemas/zod/common.ts +29 -0
  35. package/src/_common/transformers/contract.ts +11 -0
  36. package/src/_common/transformers/curveString.ts +27 -0
  37. package/src/_common/transformers/toBorshBytes/signedTransaction.ts +20 -0
  38. package/src/_common/transformers/toBorshBytes/transaction.ts +12 -0
  39. package/src/_common/transformers/toNative/actions/addKey.ts +34 -0
  40. package/src/_common/transformers/toNative/actions/createAccount.ts +5 -0
  41. package/src/_common/transformers/toNative/actions/deleteAccount.ts +12 -0
  42. package/src/_common/transformers/toNative/actions/deleteKey.ts +13 -0
  43. package/src/_common/transformers/toNative/actions/deployContract.ts +17 -0
  44. package/src/_common/transformers/toNative/actions/functionCall.ts +22 -0
  45. package/src/_common/transformers/toNative/actions/transfer.ts +13 -0
  46. package/src/_common/transformers/toNative/blockReference.ts +30 -0
  47. package/src/_common/transformers/toNative/publicKey.ts +8 -0
  48. package/src/_common/transformers/toNative/signature.ts +8 -0
  49. package/src/_common/transformers/toNative/signedTransaction.ts +13 -0
  50. package/src/_common/transformers/toNative/transaction.ts +67 -0
  51. package/src/_common/utils/common.ts +22 -0
  52. package/src/_common/utils/createCircularQueue.ts +46 -0
  53. package/src/_common/utils/createLinkedList.ts +30 -0
  54. package/src/_common/utils/snakeToCamelCase.ts +26 -0
  55. package/src/_common/utils/tokenConverter/convertTokensToUnits.ts +65 -0
  56. package/src/_common/utils/tokenConverter/convertUnitsToTokens.ts +71 -0
  57. package/src/_common/utils/tokenConverter/helpers.ts +26 -0
  58. package/src/client/createClient/account/getAccountKey.ts +51 -0
  59. package/src/client/createClient/account/getAccountKeys.ts +47 -0
  60. package/src/client/createClient/account/getAccountState.ts +65 -0
  61. package/src/client/createClient/account/helpers/transformKey.ts +36 -0
  62. package/src/client/createClient/block/getBlock.ts +24 -0
  63. package/src/client/createClient/contract/callContractReadFunction.ts +66 -0
  64. package/src/client/createClient/contract/getContractState.ts +60 -0
  65. package/src/client/createClient/createClient.ts +34 -0
  66. package/src/client/createClient/createSendRequest.ts +29 -0
  67. package/src/client/createClient/protocol/getGasPrice.ts +51 -0
  68. package/src/client/createClient/protocol/getProtocolConfig.ts +39 -0
  69. package/src/client/createClient/transaction/sendSignedTransaction.ts +31 -0
  70. package/src/client/presets/networks.ts +21 -0
  71. package/src/helpers/actionCreators/addFullAccessKey.ts +14 -0
  72. package/src/helpers/actionCreators/addFunctionCallKey.ts +20 -0
  73. package/src/helpers/actionCreators/createAccount.ts +5 -0
  74. package/src/helpers/actionCreators/deleteAccount.ts +11 -0
  75. package/src/helpers/actionCreators/deleteKey.ts +9 -0
  76. package/src/helpers/actionCreators/deployContract.ts +13 -0
  77. package/src/helpers/actionCreators/functionCall.ts +12 -0
  78. package/src/helpers/actionCreators/transfer.ts +9 -0
  79. package/src/helpers/crypto/getPublicKey.ts +59 -0
  80. package/src/helpers/crypto/getRandomPrivateKey.ts +19 -0
  81. package/src/helpers/crypto/getTransactionHash.ts +21 -0
  82. package/src/helpers/crypto/sign.ts +69 -0
  83. package/src/helpers/gas.ts +25 -0
  84. package/src/helpers/near.ts +118 -0
  85. package/src/index.ts +19 -0
  86. package/src/keyServices/memoryKeyService/createFindPrivateKey.ts +11 -0
  87. package/src/keyServices/memoryKeyService/createMemoryKeyService.ts +23 -0
  88. package/src/keyServices/memoryKeyService/createSignTransaction.ts +24 -0
  89. package/src/keyServices/memoryKeyService/parseKeySources.ts +49 -0
  90. package/src/signers/memorySigner/createMemorySigner.ts +35 -0
  91. package/src/signers/memorySigner/executors/executeTransaction.ts +30 -0
  92. package/src/signers/memorySigner/executors/helpers/getSignedTransaction.ts +32 -0
  93. package/src/signers/memorySigner/executors/signTransaction.ts +26 -0
  94. package/src/signers/memorySigner/keyPool/createFindKeyForTask.ts +27 -0
  95. package/src/signers/memorySigner/keyPool/createIsKeyForTaskExist.ts +22 -0
  96. package/src/signers/memorySigner/keyPool/createKeyPool.ts +37 -0
  97. package/src/signers/memorySigner/keyPool/getFullAccessKeyList.ts +39 -0
  98. package/src/signers/memorySigner/keyPool/getFunctionCallKeyList.ts +43 -0
  99. package/src/signers/memorySigner/keyPool/helpers/keyUtils.ts +13 -0
  100. package/src/signers/memorySigner/matcher/createMatcher.ts +42 -0
  101. package/src/signers/memorySigner/resolver/createResolver.ts +21 -0
  102. package/src/signers/memorySigner/state/createState.ts +27 -0
  103. package/src/signers/memorySigner/taskQueue/addTask/executeMultipleTransactions.ts +29 -0
  104. package/src/signers/memorySigner/taskQueue/addTask/executeTransaction.ts +28 -0
  105. package/src/signers/memorySigner/taskQueue/addTask/helpers/getSigningKeyPriority.ts +39 -0
  106. package/src/signers/memorySigner/taskQueue/addTask/signMultipleTransactions.ts +26 -0
  107. package/src/signers/memorySigner/taskQueue/addTask/signTransaction.ts +23 -0
  108. package/src/signers/memorySigner/taskQueue/createFindTaskForKey.ts +22 -0
  109. package/src/signers/memorySigner/taskQueue/createTaskQueue.ts +45 -0
  110. package/types/accountKey.ts +24 -0
  111. package/types/actions/addKey.ts +48 -0
  112. package/types/actions/createAccount.ts +9 -0
  113. package/types/actions/deleteAccount.ts +18 -0
  114. package/types/actions/deleteKey.ts +18 -0
  115. package/types/actions/deployContract.ts +19 -0
  116. package/types/actions/functionCall.ts +32 -0
  117. package/types/actions/transfer.ts +18 -0
  118. package/types/client/account/getAccountKey.ts +30 -0
  119. package/types/client/account/getAccountKeys.ts +28 -0
  120. package/types/client/account/getAccountState.ts +40 -0
  121. package/types/client/block/getBlock.ts +13 -0
  122. package/types/client/client.ts +52 -0
  123. package/types/client/contract/callContractReadFunction.ts +98 -0
  124. package/types/client/contract/getContractState.ts +33 -0
  125. package/types/client/protocol/getGasPrice.ts +16 -0
  126. package/types/client/protocol/getProtocolConfig.ts +17 -0
  127. package/types/client/transaction/sendSignedTransaction.ts +19 -0
  128. package/types/common.ts +79 -0
  129. package/types/contract.ts +13 -0
  130. package/types/crypto.ts +25 -0
  131. package/types/delegateAction.ts +0 -0
  132. package/types/keyServices/memoryKeyService.ts +26 -0
  133. package/types/signedTransaction.ts +14 -0
  134. package/types/signers/memorySigner.ts +59 -0
  135. package/types/transaction.ts +107 -0
  136. package/types/utils.ts +44 -0
@@ -0,0 +1,838 @@
1
+ import { RpcBlockResponse, RpcTransactionResponse } from '@near-js/jsonrpc-types';
2
+ import * as z from 'zod/mini';
3
+
4
+ /**
5
+ * Binary length: 32 bytes
6
+ */
7
+ type CryptoHash = string;
8
+ type BlockHash = CryptoHash;
9
+ type BlockHeight = number;
10
+ type BlockId = {
11
+ blockHash: BlockHash;
12
+ } | {
13
+ blockHeight: BlockHeight;
14
+ };
15
+ type LatestBlock = 'LatestOptimisticBlock' | 'LatestNearFinalBlock' | 'LatestFinalBlock';
16
+ type SyncCheckpoint = 'EarliestAvailableBlock' | 'GenesisBlock';
17
+ type BlockReference = LatestBlock | SyncCheckpoint | BlockId;
18
+ type Base58String = string;
19
+ type Base64String = string;
20
+ type Nonce = number;
21
+ type AccountId = string;
22
+ /**
23
+ * Contract function name has limit - max 256 characters
24
+ */
25
+ type ContractFunctionName = string;
26
+ type YoctoNear = bigint;
27
+ type Near = string;
28
+ type NearToken = Readonly<{
29
+ yoctoNear: YoctoNear;
30
+ near: Near;
31
+ add: (value: NearOption) => NearToken;
32
+ sub: (value: NearOption) => NearToken;
33
+ mul: (value: NearOption) => NearToken;
34
+ gt: (value: NearOption) => NearToken;
35
+ lt: (value: NearOption) => NearToken;
36
+ }>;
37
+ type Units = bigint | string;
38
+ type Tokens = string;
39
+ type NearOption = {
40
+ near: Tokens;
41
+ } | {
42
+ yoctoNear: Units;
43
+ };
44
+ type GasInput = bigint | number;
45
+ type TeraGasInput = string;
46
+ type GasOption = {
47
+ gas: GasInput;
48
+ } | {
49
+ teraGas: TeraGasInput;
50
+ };
51
+ type JsonLikeValue = string | number | boolean | null | JsonLikeValue[] | {
52
+ [key: string]: JsonLikeValue | undefined;
53
+ };
54
+ type MaybeJsonLikeValue = JsonLikeValue | undefined;
55
+
56
+ type GetAccountStateArgs = {
57
+ accountId: AccountId;
58
+ atMomentOf?: BlockReference;
59
+ };
60
+ type GetAccountStateResult = {
61
+ blockHash: BlockHash;
62
+ blockHeight: BlockHeight;
63
+ accountId: AccountId;
64
+ accountState: {
65
+ balance: {
66
+ total: NearToken;
67
+ locked: NearToken;
68
+ };
69
+ usedStorageBytes: number;
70
+ contractWasmHash: CryptoHash;
71
+ globalContractAccountId?: AccountId;
72
+ globalContractHash?: CryptoHash;
73
+ };
74
+ };
75
+ type GetAccountState = (args: GetAccountStateArgs) => Promise<GetAccountStateResult>;
76
+
77
+ type Ed25519Curve = 'ed25519';
78
+ type Secp256k1Curve = 'secp256k1';
79
+ type Ed25519CurveString = `${Ed25519Curve}:${Base58String}`;
80
+ type Secp256k1CurveString = `${Secp256k1Curve}:${Base58String}`;
81
+ type CurveString = Ed25519CurveString | Secp256k1CurveString;
82
+ type Ed25519PublicKey = Ed25519CurveString;
83
+ type Secp256k1PublicKey = Secp256k1CurveString;
84
+ type PublicKey = Ed25519PublicKey | Secp256k1PublicKey;
85
+ type PrivateKey = CurveString;
86
+ type Signature = CurveString;
87
+
88
+ type FullAccessKey = {
89
+ accessType: 'FullAccess';
90
+ publicKey: PublicKey;
91
+ nonce: Nonce;
92
+ };
93
+ type FunctionCallKey = {
94
+ accessType: 'FunctionCall';
95
+ publicKey: PublicKey;
96
+ nonce: Nonce;
97
+ contractAccountId: AccountId;
98
+ gasBudget?: NearToken;
99
+ allowedFunctions?: ContractFunctionName[];
100
+ };
101
+ type AccountKey = FullAccessKey | FunctionCallKey;
102
+
103
+ type GetAccountKeyArgs = {
104
+ accountId: AccountId;
105
+ publicKey: PublicKey;
106
+ atMomentOf?: BlockReference;
107
+ };
108
+ type GetAccountKeyResult = {
109
+ blockHash: BlockHash;
110
+ blockHeight: BlockHeight;
111
+ accountId: AccountId;
112
+ accountKey: AccountKey;
113
+ };
114
+ type GetAccountKey = (args: GetAccountKeyArgs) => Promise<GetAccountKeyResult>;
115
+
116
+ type GetAccountKeysArgs = {
117
+ accountId: AccountId;
118
+ atMomentOf?: BlockReference;
119
+ };
120
+ type GetAccountKeysResult = {
121
+ blockHash: BlockHash;
122
+ blockHeight: BlockHeight;
123
+ accountId: AccountId;
124
+ accountKeys: AccountKey[];
125
+ };
126
+ type GetAccountKeys = (args: GetAccountKeysArgs) => Promise<GetAccountKeysResult>;
127
+
128
+ type GetBlockArgs = {
129
+ blockReference?: BlockReference;
130
+ };
131
+ type GetBlockResult = RpcBlockResponse;
132
+ type GetBlock = (args?: GetBlockArgs) => Promise<GetBlockResult>;
133
+
134
+ type GetGasPriceArgs = {
135
+ atMomentOf?: 'LatestOptimisticBlock' | BlockId;
136
+ };
137
+ type GetGasPriceResult = {
138
+ gasPrice: NearToken;
139
+ };
140
+ type GetGasPrice = (args?: GetGasPriceArgs) => Promise<GetGasPriceResult>;
141
+
142
+ declare const TemporaryProtocolConfigShema: z.ZodMiniObject<{
143
+ runtimeConfig: z.ZodMiniObject<{
144
+ wasmConfig: z.ZodMiniObject<{
145
+ discardCustomSections: z.ZodMiniBoolean<boolean>;
146
+ ethImplicitAccounts: z.ZodMiniBoolean<boolean>;
147
+ extCosts: z.ZodMiniLazy<z.ZodMiniObject<{
148
+ altBn128G1MultiexpBase: z.ZodMiniNumber<number>;
149
+ altBn128G1MultiexpElement: z.ZodMiniNumber<number>;
150
+ altBn128G1SumBase: z.ZodMiniNumber<number>;
151
+ altBn128G1SumElement: z.ZodMiniNumber<number>;
152
+ altBn128PairingCheckBase: z.ZodMiniNumber<number>;
153
+ altBn128PairingCheckElement: z.ZodMiniNumber<number>;
154
+ base: z.ZodMiniNumber<number>;
155
+ bls12381G1MultiexpBase: z.ZodMiniNumber<number>;
156
+ bls12381G1MultiexpElement: z.ZodMiniNumber<number>;
157
+ bls12381G2MultiexpBase: z.ZodMiniNumber<number>;
158
+ bls12381G2MultiexpElement: z.ZodMiniNumber<number>;
159
+ bls12381MapFp2ToG2Base: z.ZodMiniNumber<number>;
160
+ bls12381MapFp2ToG2Element: z.ZodMiniNumber<number>;
161
+ bls12381MapFpToG1Base: z.ZodMiniNumber<number>;
162
+ bls12381MapFpToG1Element: z.ZodMiniNumber<number>;
163
+ bls12381P1DecompressBase: z.ZodMiniNumber<number>;
164
+ bls12381P1DecompressElement: z.ZodMiniNumber<number>;
165
+ bls12381P1SumBase: z.ZodMiniNumber<number>;
166
+ bls12381P1SumElement: z.ZodMiniNumber<number>;
167
+ bls12381P2DecompressBase: z.ZodMiniNumber<number>;
168
+ bls12381P2DecompressElement: z.ZodMiniNumber<number>;
169
+ bls12381P2SumBase: z.ZodMiniNumber<number>;
170
+ bls12381P2SumElement: z.ZodMiniNumber<number>;
171
+ bls12381PairingBase: z.ZodMiniNumber<number>;
172
+ bls12381PairingElement: z.ZodMiniNumber<number>;
173
+ contractCompileBase: z.ZodMiniNumber<number>;
174
+ contractCompileBytes: z.ZodMiniNumber<number>;
175
+ contractLoadingBase: z.ZodMiniNumber<number>;
176
+ contractLoadingBytes: z.ZodMiniNumber<number>;
177
+ ecrecoverBase: z.ZodMiniNumber<number>;
178
+ ed25519VerifyBase: z.ZodMiniNumber<number>;
179
+ ed25519VerifyByte: z.ZodMiniNumber<number>;
180
+ keccak256Base: z.ZodMiniNumber<number>;
181
+ keccak256Byte: z.ZodMiniNumber<number>;
182
+ keccak512Base: z.ZodMiniNumber<number>;
183
+ keccak512Byte: z.ZodMiniNumber<number>;
184
+ logBase: z.ZodMiniNumber<number>;
185
+ logByte: z.ZodMiniNumber<number>;
186
+ promiseAndBase: z.ZodMiniNumber<number>;
187
+ promiseAndPerPromise: z.ZodMiniNumber<number>;
188
+ promiseReturn: z.ZodMiniNumber<number>;
189
+ readCachedTrieNode: z.ZodMiniNumber<number>;
190
+ readMemoryBase: z.ZodMiniNumber<number>;
191
+ readMemoryByte: z.ZodMiniNumber<number>;
192
+ readRegisterBase: z.ZodMiniNumber<number>;
193
+ readRegisterByte: z.ZodMiniNumber<number>;
194
+ ripemd160Base: z.ZodMiniNumber<number>;
195
+ ripemd160Block: z.ZodMiniNumber<number>;
196
+ sha256Base: z.ZodMiniNumber<number>;
197
+ sha256Byte: z.ZodMiniNumber<number>;
198
+ storageHasKeyBase: z.ZodMiniNumber<number>;
199
+ storageHasKeyByte: z.ZodMiniNumber<number>;
200
+ storageIterCreateFromByte: z.ZodMiniNumber<number>;
201
+ storageIterCreatePrefixBase: z.ZodMiniNumber<number>;
202
+ storageIterCreatePrefixByte: z.ZodMiniNumber<number>;
203
+ storageIterCreateRangeBase: z.ZodMiniNumber<number>;
204
+ storageIterCreateToByte: z.ZodMiniNumber<number>;
205
+ storageIterNextBase: z.ZodMiniNumber<number>;
206
+ storageIterNextKeyByte: z.ZodMiniNumber<number>;
207
+ storageIterNextValueByte: z.ZodMiniNumber<number>;
208
+ storageLargeReadOverheadBase: z.ZodMiniNumber<number>;
209
+ storageLargeReadOverheadByte: z.ZodMiniNumber<number>;
210
+ storageReadBase: z.ZodMiniNumber<number>;
211
+ storageReadKeyByte: z.ZodMiniNumber<number>;
212
+ storageReadValueByte: z.ZodMiniNumber<number>;
213
+ storageRemoveBase: z.ZodMiniNumber<number>;
214
+ storageRemoveKeyByte: z.ZodMiniNumber<number>;
215
+ storageRemoveRetValueByte: z.ZodMiniNumber<number>;
216
+ storageWriteBase: z.ZodMiniNumber<number>;
217
+ storageWriteEvictedByte: z.ZodMiniNumber<number>;
218
+ storageWriteKeyByte: z.ZodMiniNumber<number>;
219
+ storageWriteValueByte: z.ZodMiniNumber<number>;
220
+ touchingTrieNode: z.ZodMiniNumber<number>;
221
+ utf16DecodingBase: z.ZodMiniNumber<number>;
222
+ utf16DecodingByte: z.ZodMiniNumber<number>;
223
+ utf8DecodingBase: z.ZodMiniNumber<number>;
224
+ utf8DecodingByte: z.ZodMiniNumber<number>;
225
+ validatorStakeBase: z.ZodMiniNumber<number>;
226
+ validatorTotalStakeBase: z.ZodMiniNumber<number>;
227
+ writeMemoryBase: z.ZodMiniNumber<number>;
228
+ writeMemoryByte: z.ZodMiniNumber<number>;
229
+ writeRegisterBase: z.ZodMiniNumber<number>;
230
+ writeRegisterByte: z.ZodMiniNumber<number>;
231
+ yieldCreateBase: z.ZodMiniNumber<number>;
232
+ yieldCreateByte: z.ZodMiniNumber<number>;
233
+ yieldResumeBase: z.ZodMiniNumber<number>;
234
+ yieldResumeByte: z.ZodMiniNumber<number>;
235
+ }, z.core.$strip>>;
236
+ fixContractLoadingCost: z.ZodMiniBoolean<boolean>;
237
+ globalContractHostFns: z.ZodMiniBoolean<boolean>;
238
+ growMemCost: z.ZodMiniNumber<number>;
239
+ implicitAccountCreation: z.ZodMiniBoolean<boolean>;
240
+ limitConfig: z.ZodMiniLazy<z.ZodMiniObject<{
241
+ accountIdValidityRulesVersion: z.ZodMiniOptional<z.ZodMiniLazy<z.ZodMiniNumber<number>>>;
242
+ initialMemoryPages: z.ZodMiniNumber<number>;
243
+ maxActionsPerReceipt: z.ZodMiniNumber<number>;
244
+ maxArgumentsLength: z.ZodMiniNumber<number>;
245
+ maxContractSize: z.ZodMiniNumber<number>;
246
+ maxElementsPerContractTable: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
247
+ maxFunctionsNumberPerContract: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
248
+ maxGasBurnt: z.ZodMiniNumber<number>;
249
+ maxLengthMethodName: z.ZodMiniNumber<number>;
250
+ maxLengthReturnedData: z.ZodMiniNumber<number>;
251
+ maxLengthStorageKey: z.ZodMiniNumber<number>;
252
+ maxLengthStorageValue: z.ZodMiniNumber<number>;
253
+ maxLocalsPerContract: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
254
+ maxMemoryPages: z.ZodMiniNumber<number>;
255
+ maxNumberBytesMethodNames: z.ZodMiniNumber<number>;
256
+ maxNumberInputDataDependencies: z.ZodMiniNumber<number>;
257
+ maxNumberLogs: z.ZodMiniNumber<number>;
258
+ maxNumberRegisters: z.ZodMiniNumber<number>;
259
+ maxPromisesPerFunctionCallAction: z.ZodMiniNumber<number>;
260
+ maxReceiptSize: z.ZodMiniNumber<number>;
261
+ maxRegisterSize: z.ZodMiniNumber<number>;
262
+ maxStackHeight: z.ZodMiniNumber<number>;
263
+ maxTablesPerContract: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniNumber<number>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
264
+ maxTotalLogLength: z.ZodMiniNumber<number>;
265
+ maxTotalPrepaidGas: z.ZodMiniNumber<number>;
266
+ maxTransactionSize: z.ZodMiniNumber<number>;
267
+ maxYieldPayloadSize: z.ZodMiniNumber<number>;
268
+ perReceiptStorageProofSizeLimit: z.ZodMiniNumber<number>;
269
+ registersMemoryLimit: z.ZodMiniNumber<number>;
270
+ yieldTimeoutLengthInBlocks: z.ZodMiniNumber<number>;
271
+ }, z.core.$strip>>;
272
+ regularOpCost: z.ZodMiniNumber<number>;
273
+ saturatingFloatToInt: z.ZodMiniBoolean<boolean>;
274
+ storageGetMode: z.ZodMiniLazy<z.ZodMiniEnum<{
275
+ FlatStorage: "FlatStorage";
276
+ Trie: "Trie";
277
+ }>>;
278
+ vmKind: z.ZodMiniLazy<z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
279
+ Wasmer0: "Wasmer0";
280
+ }>, z.ZodMiniEnum<{
281
+ Wasmtime: "Wasmtime";
282
+ }>, z.ZodMiniEnum<{
283
+ Wasmer2: "Wasmer2";
284
+ }>, z.ZodMiniEnum<{
285
+ NearVm: "NearVm";
286
+ }>, z.ZodMiniEnum<{
287
+ NearVm2: "NearVm2";
288
+ }>]>>;
289
+ }, z.core.$strip>;
290
+ accountCreationConfig: z.ZodMiniLazy<z.ZodMiniObject<{
291
+ minAllowedTopLevelAccountLength: z.ZodMiniNumber<number>;
292
+ registrarAccountId: z.ZodMiniLazy<z.ZodMiniString<string>>;
293
+ }, z.core.$strip>>;
294
+ congestionControlConfig: z.ZodMiniLazy<z.ZodMiniObject<{
295
+ allowedShardOutgoingGas: z.ZodMiniNumber<number>;
296
+ maxCongestionIncomingGas: z.ZodMiniNumber<number>;
297
+ maxCongestionMemoryConsumption: z.ZodMiniNumber<number>;
298
+ maxCongestionMissedChunks: z.ZodMiniNumber<number>;
299
+ maxCongestionOutgoingGas: z.ZodMiniNumber<number>;
300
+ maxOutgoingGas: z.ZodMiniNumber<number>;
301
+ maxTxGas: z.ZodMiniNumber<number>;
302
+ minOutgoingGas: z.ZodMiniNumber<number>;
303
+ minTxGas: z.ZodMiniNumber<number>;
304
+ outgoingReceiptsBigSizeLimit: z.ZodMiniNumber<number>;
305
+ outgoingReceiptsUsualSizeLimit: z.ZodMiniNumber<number>;
306
+ rejectTxCongestionThreshold: z.ZodMiniNumber<number>;
307
+ }, z.core.$strip>>;
308
+ storageAmountPerByte: z.ZodMiniString<string>;
309
+ transactionCosts: z.ZodMiniLazy<z.ZodMiniObject<{
310
+ actionCreationConfig: z.ZodMiniLazy<z.ZodMiniObject<{
311
+ addKeyCost: z.ZodMiniLazy<z.ZodMiniObject<{
312
+ fullAccessCost: z.ZodMiniLazy<z.ZodMiniObject<{
313
+ execution: z.ZodMiniNumber<number>;
314
+ sendNotSir: z.ZodMiniNumber<number>;
315
+ sendSir: z.ZodMiniNumber<number>;
316
+ }, z.core.$strip>>;
317
+ functionCallCost: z.ZodMiniLazy<z.ZodMiniObject<{
318
+ execution: z.ZodMiniNumber<number>;
319
+ sendNotSir: z.ZodMiniNumber<number>;
320
+ sendSir: z.ZodMiniNumber<number>;
321
+ }, z.core.$strip>>;
322
+ functionCallCostPerByte: z.ZodMiniLazy<z.ZodMiniObject<{
323
+ execution: z.ZodMiniNumber<number>;
324
+ sendNotSir: z.ZodMiniNumber<number>;
325
+ sendSir: z.ZodMiniNumber<number>;
326
+ }, z.core.$strip>>;
327
+ }, z.core.$strip>>;
328
+ createAccountCost: z.ZodMiniLazy<z.ZodMiniObject<{
329
+ execution: z.ZodMiniNumber<number>;
330
+ sendNotSir: z.ZodMiniNumber<number>;
331
+ sendSir: z.ZodMiniNumber<number>;
332
+ }, z.core.$strip>>;
333
+ delegateCost: z.ZodMiniLazy<z.ZodMiniObject<{
334
+ execution: z.ZodMiniNumber<number>;
335
+ sendNotSir: z.ZodMiniNumber<number>;
336
+ sendSir: z.ZodMiniNumber<number>;
337
+ }, z.core.$strip>>;
338
+ deleteAccountCost: z.ZodMiniLazy<z.ZodMiniObject<{
339
+ execution: z.ZodMiniNumber<number>;
340
+ sendNotSir: z.ZodMiniNumber<number>;
341
+ sendSir: z.ZodMiniNumber<number>;
342
+ }, z.core.$strip>>;
343
+ deleteKeyCost: z.ZodMiniLazy<z.ZodMiniObject<{
344
+ execution: z.ZodMiniNumber<number>;
345
+ sendNotSir: z.ZodMiniNumber<number>;
346
+ sendSir: z.ZodMiniNumber<number>;
347
+ }, z.core.$strip>>;
348
+ deployContractCost: z.ZodMiniLazy<z.ZodMiniObject<{
349
+ execution: z.ZodMiniNumber<number>;
350
+ sendNotSir: z.ZodMiniNumber<number>;
351
+ sendSir: z.ZodMiniNumber<number>;
352
+ }, z.core.$strip>>;
353
+ deployContractCostPerByte: z.ZodMiniLazy<z.ZodMiniObject<{
354
+ execution: z.ZodMiniNumber<number>;
355
+ sendNotSir: z.ZodMiniNumber<number>;
356
+ sendSir: z.ZodMiniNumber<number>;
357
+ }, z.core.$strip>>;
358
+ functionCallCost: z.ZodMiniLazy<z.ZodMiniObject<{
359
+ execution: z.ZodMiniNumber<number>;
360
+ sendNotSir: z.ZodMiniNumber<number>;
361
+ sendSir: z.ZodMiniNumber<number>;
362
+ }, z.core.$strip>>;
363
+ functionCallCostPerByte: z.ZodMiniLazy<z.ZodMiniObject<{
364
+ execution: z.ZodMiniNumber<number>;
365
+ sendNotSir: z.ZodMiniNumber<number>;
366
+ sendSir: z.ZodMiniNumber<number>;
367
+ }, z.core.$strip>>;
368
+ stakeCost: z.ZodMiniLazy<z.ZodMiniObject<{
369
+ execution: z.ZodMiniNumber<number>;
370
+ sendNotSir: z.ZodMiniNumber<number>;
371
+ sendSir: z.ZodMiniNumber<number>;
372
+ }, z.core.$strip>>;
373
+ transferCost: z.ZodMiniLazy<z.ZodMiniObject<{
374
+ execution: z.ZodMiniNumber<number>;
375
+ sendNotSir: z.ZodMiniNumber<number>;
376
+ sendSir: z.ZodMiniNumber<number>;
377
+ }, z.core.$strip>>;
378
+ }, z.core.$strip>>;
379
+ actionReceiptCreationConfig: z.ZodMiniLazy<z.ZodMiniObject<{
380
+ execution: z.ZodMiniNumber<number>;
381
+ sendNotSir: z.ZodMiniNumber<number>;
382
+ sendSir: z.ZodMiniNumber<number>;
383
+ }, z.core.$strip>>;
384
+ burntGasReward: z.ZodMiniArray<z.ZodMiniNumber<number>>;
385
+ dataReceiptCreationConfig: z.ZodMiniLazy<z.ZodMiniObject<{
386
+ baseCost: z.ZodMiniLazy<z.ZodMiniObject<{
387
+ execution: z.ZodMiniNumber<number>;
388
+ sendNotSir: z.ZodMiniNumber<number>;
389
+ sendSir: z.ZodMiniNumber<number>;
390
+ }, z.core.$strip>>;
391
+ costPerByte: z.ZodMiniLazy<z.ZodMiniObject<{
392
+ execution: z.ZodMiniNumber<number>;
393
+ sendNotSir: z.ZodMiniNumber<number>;
394
+ sendSir: z.ZodMiniNumber<number>;
395
+ }, z.core.$strip>>;
396
+ }, z.core.$strip>>;
397
+ pessimisticGasPriceInflationRatio: z.ZodMiniArray<z.ZodMiniNumber<number>>;
398
+ storageUsageConfig: z.ZodMiniLazy<z.ZodMiniObject<{
399
+ numBytesAccount: z.ZodMiniNumber<number>;
400
+ numExtraBytesRecord: z.ZodMiniNumber<number>;
401
+ }, z.core.$strip>>;
402
+ }, z.core.$strip>>;
403
+ witnessConfig: z.ZodMiniLazy<z.ZodMiniObject<{
404
+ combinedTransactionsSizeLimit: z.ZodMiniNumber<number>;
405
+ mainStorageProofSizeSoftLimit: z.ZodMiniNumber<number>;
406
+ newTransactionsValidationStateSizeSoftLimit: z.ZodMiniNumber<number>;
407
+ }, z.core.$strip>>;
408
+ }, z.core.$strip>;
409
+ avgHiddenValidatorSeatsPerShard: z.ZodMiniArray<z.ZodMiniNumber<number>>;
410
+ blockProducerKickoutThreshold: z.ZodMiniNumber<number>;
411
+ chainId: z.ZodMiniString<string>;
412
+ chunkProducerKickoutThreshold: z.ZodMiniNumber<number>;
413
+ chunkValidatorOnlyKickoutThreshold: z.ZodMiniNumber<number>;
414
+ dynamicResharding: z.ZodMiniBoolean<boolean>;
415
+ epochLength: z.ZodMiniNumber<number>;
416
+ fishermenThreshold: z.ZodMiniString<string>;
417
+ gasLimit: z.ZodMiniNumber<number>;
418
+ gasPriceAdjustmentRate: z.ZodMiniArray<z.ZodMiniNumber<number>>;
419
+ genesisHeight: z.ZodMiniNumber<number>;
420
+ genesisTime: z.ZodMiniString<string>;
421
+ maxGasPrice: z.ZodMiniString<string>;
422
+ maxInflationRate: z.ZodMiniArray<z.ZodMiniNumber<number>>;
423
+ maxKickoutStakePerc: z.ZodMiniNumber<number>;
424
+ minGasPrice: z.ZodMiniString<string>;
425
+ minimumStakeDivisor: z.ZodMiniNumber<number>;
426
+ minimumStakeRatio: z.ZodMiniArray<z.ZodMiniNumber<number>>;
427
+ minimumValidatorsPerShard: z.ZodMiniNumber<number>;
428
+ numBlockProducerSeats: z.ZodMiniNumber<number>;
429
+ numBlockProducerSeatsPerShard: z.ZodMiniArray<z.ZodMiniNumber<number>>;
430
+ numBlocksPerYear: z.ZodMiniNumber<number>;
431
+ onlineMaxThreshold: z.ZodMiniArray<z.ZodMiniNumber<number>>;
432
+ onlineMinThreshold: z.ZodMiniArray<z.ZodMiniNumber<number>>;
433
+ protocolRewardRate: z.ZodMiniArray<z.ZodMiniNumber<number>>;
434
+ protocolTreasuryAccount: z.ZodMiniLazy<z.ZodMiniString<string>>;
435
+ protocolUpgradeStakeThreshold: z.ZodMiniArray<z.ZodMiniNumber<number>>;
436
+ protocolVersion: z.ZodMiniNumber<number>;
437
+ shardLayout: z.ZodMiniLazy<z.ZodMiniUnion<readonly [z.ZodMiniObject<{
438
+ V0: z.ZodMiniLazy<z.ZodMiniObject<{
439
+ numShards: z.ZodMiniNumber<number>;
440
+ version: z.ZodMiniNumber<number>;
441
+ }, z.core.$strip>>;
442
+ }, z.core.$strip>, z.ZodMiniObject<{
443
+ V1: z.ZodMiniLazy<z.ZodMiniObject<{
444
+ boundaryAccounts: z.ZodMiniArray<z.ZodMiniLazy<z.ZodMiniString<string>>>;
445
+ shardsSplitMap: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniArray<z.ZodMiniLazy<z.ZodMiniNumber<number>>>>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
446
+ toParentShardMap: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniArray<z.ZodMiniLazy<z.ZodMiniNumber<number>>>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
447
+ version: z.ZodMiniNumber<number>;
448
+ }, z.core.$strip>>;
449
+ }, z.core.$strip>, z.ZodMiniObject<{
450
+ V2: z.ZodMiniLazy<z.ZodMiniObject<{
451
+ boundaryAccounts: z.ZodMiniArray<z.ZodMiniLazy<z.ZodMiniString<string>>>;
452
+ idToIndexMap: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniNumber<number>>;
453
+ indexToIdMap: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniLazy<z.ZodMiniNumber<number>>>;
454
+ shardIds: z.ZodMiniArray<z.ZodMiniLazy<z.ZodMiniNumber<number>>>;
455
+ shardsParentMap: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniLazy<z.ZodMiniNumber<number>>>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
456
+ shardsSplitMap: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniLazy<z.ZodMiniNumber<number>>>>, z.ZodMiniNull]>, z.ZodMiniNull]>>;
457
+ version: z.ZodMiniNumber<number>;
458
+ }, z.core.$strip>>;
459
+ }, z.core.$strip>]>>;
460
+ shuffleShardAssignmentForChunkProducers: z.ZodMiniBoolean<boolean>;
461
+ targetValidatorMandatesPerShard: z.ZodMiniNumber<number>;
462
+ transactionValidityPeriod: z.ZodMiniNumber<number>;
463
+ }, z.core.$strip>;
464
+ type TemporaryProtocolConfig = z.infer<typeof TemporaryProtocolConfigShema>;
465
+
466
+ type GetProtocolConfigArgs = {
467
+ atMomentOf?: BlockReference;
468
+ };
469
+ type GetProtocolConfigResult = TemporaryProtocolConfig;
470
+ type GetProtocolConfig = (args?: GetProtocolConfigArgs) => Promise<GetProtocolConfigResult>;
471
+
472
+ type CreateAccountAction = {
473
+ actionType: 'CreateAccount';
474
+ };
475
+
476
+ type TransferActionParams = {
477
+ amount: NearOption;
478
+ };
479
+ type TransferAction = {
480
+ actionType: 'Transfer';
481
+ params: TransferActionParams;
482
+ };
483
+
484
+ type FullAccessKeyParams = {
485
+ accessType: 'FullAccess';
486
+ publicKey: PublicKey;
487
+ };
488
+ type FunctionCallKeyParams = {
489
+ accessType: 'FunctionCall';
490
+ publicKey: PublicKey;
491
+ contractAccountId: AccountId;
492
+ gasBudget?: NearOption;
493
+ allowedFunctions?: ContractFunctionName[];
494
+ };
495
+ type AddKeyAction = {
496
+ actionType: 'AddKey';
497
+ params: FullAccessKeyParams | FunctionCallKeyParams;
498
+ };
499
+
500
+ type FnArgsJson<AJ extends JsonLikeValue> = {
501
+ fnArgsJson: AJ;
502
+ fnArgsBytes?: never;
503
+ };
504
+ type FnArgsBytes = {
505
+ fnArgsJson?: never;
506
+ fnArgsBytes?: Uint8Array;
507
+ };
508
+ type FnArgs<AJ extends MaybeJsonLikeValue = undefined> = [AJ] extends [
509
+ JsonLikeValue
510
+ ] ? FnArgsJson<AJ> : FnArgsBytes;
511
+
512
+ type FunctionCallBase = {
513
+ functionName: ContractFunctionName;
514
+ gasLimit: GasOption;
515
+ attachedDeposit?: NearOption;
516
+ };
517
+ type FunctionCallParams<AJ extends MaybeJsonLikeValue> = FunctionCallBase & FnArgs<AJ>;
518
+ type FunctionCallAction<AJ extends MaybeJsonLikeValue> = {
519
+ actionType: 'FunctionCall';
520
+ params: FunctionCallParams<AJ>;
521
+ };
522
+
523
+ type DeleteKeyActionParams = {
524
+ publicKey: PublicKey;
525
+ };
526
+ type DeleteKeyAction = {
527
+ actionType: 'DeleteKey';
528
+ params: DeleteKeyActionParams;
529
+ };
530
+
531
+ type DeleteAccountActionParams = {
532
+ beneficiaryAccountId: AccountId;
533
+ };
534
+ type DeleteAccountAction = {
535
+ actionType: 'DeleteAccount';
536
+ params: DeleteAccountActionParams;
537
+ };
538
+
539
+ type WasmBase64 = {
540
+ wasmBase64: Base64String;
541
+ wasmBytes?: never;
542
+ };
543
+ type WasmBytes = {
544
+ wasmBase64?: never;
545
+ wasmBytes: Uint8Array;
546
+ };
547
+ type DeployContractActionParams = WasmBase64 | WasmBytes;
548
+ type DeployContractAction = {
549
+ actionType: 'DeployContract';
550
+ params: DeployContractActionParams;
551
+ };
552
+
553
+ type Action = CreateAccountAction | TransferAction | AddKeyAction | DeployContractAction | FunctionCallAction<MaybeJsonLikeValue> | DeleteKeyAction | DeleteAccountAction;
554
+ type SingleAction = {
555
+ action: Action;
556
+ actions?: never;
557
+ };
558
+ type MultiActions = {
559
+ action?: never;
560
+ actions: Action[];
561
+ };
562
+ type TransactionBase = {
563
+ signerAccountId: AccountId;
564
+ signerPublicKey: PublicKey;
565
+ receiverAccountId: AccountId;
566
+ nonce: Nonce;
567
+ blockHash: BlockHash;
568
+ };
569
+ type Transaction = TransactionBase & (SingleAction | MultiActions);
570
+ type TransactionIntent = {
571
+ receiverAccountId: AccountId;
572
+ } & (SingleAction | MultiActions);
573
+ /**
574
+ * <h3>Transaction Execution Levels:</h3>
575
+ *
576
+ * **None**: Transaction is waiting to be included into the block
577
+ *
578
+ * **Included**: Transaction is included into the block. The block may be not finalized yet
579
+ *
580
+ * **ExecutedOptimistic**: Transaction is included into the block +
581
+ * all non-refund transaction receipts finished their execution.
582
+ * The corresponding blocks for tx and each receipt may be not finalized yet
583
+ *
584
+ * **IncludedFinal**: Transaction is included into finalized block
585
+ *
586
+ * **Executed**: Transaction is included into finalized block +
587
+ * All non-refund transaction receipts finished their execution.
588
+ * The corresponding blocks for each receipt may be not finalized yet
589
+ *
590
+ * **Final**: Transaction is included into finalized block +
591
+ * Execution of all transaction receipts is finalized, including refund receipts
592
+ */
593
+ type TransactionExecutionStatus = 'None' | 'Included' | 'ExecutedOptimistic' | 'IncludedFinal' | 'Executed' | 'Final';
594
+
595
+ type SignedTransaction = {
596
+ transaction: Transaction;
597
+ transactionHash: CryptoHash;
598
+ signature: Signature;
599
+ };
600
+
601
+ type SendSignedTransactionArgs = {
602
+ signedTransaction: SignedTransaction;
603
+ waitUntil?: TransactionExecutionStatus;
604
+ };
605
+ type SendSignedTransactionResult = RpcTransactionResponse;
606
+ type SendSignedTransaction = (args: SendSignedTransactionArgs) => Promise<SendSignedTransactionResult>;
607
+
608
+ type GetContractStateArgs = {
609
+ contractAccountId: AccountId;
610
+ keyPrefix?: string;
611
+ includeProof?: boolean;
612
+ atMomentOf?: BlockReference;
613
+ };
614
+ type StateRecord = {
615
+ key: Base64String;
616
+ value: Base64String;
617
+ };
618
+ type GetContractStateResult = {
619
+ blockHash: BlockHash;
620
+ blockHeight: BlockHeight;
621
+ contractAccountId: AccountId;
622
+ proof?: Base64String[];
623
+ contractState: StateRecord[];
624
+ };
625
+ type GetContractState = (args: GetContractStateArgs) => Promise<GetContractStateResult>;
626
+
627
+ /**
628
+ * Utility type that conditionally includes a key in an object:
629
+ *
630
+ * - If `V` is `undefined`, the key `K` is optional and must never be provided
631
+ * (acts as a "poison pill" to exclude the field).
632
+ * - Otherwise, the key `K` is required with value type `V`.
633
+ *
634
+ * Examples:
635
+ * ```ts
636
+ * type A = KeyIf<'foo', string>; // => { foo: string }
637
+ * type B = KeyIf<'bar', undefined>; // => { bar?: never }
638
+ *
639
+ * // When combined in an intersection:
640
+ * type C = KeyIf<'foo', string> & KeyIf<'bar', undefined>;
641
+ * // => { foo: string; bar?: never }
642
+ * ```
643
+ */
644
+ type KeyIf<K extends PropertyKey, V> = [V] extends [undefined] ? {
645
+ [P in K]?: never;
646
+ } : {
647
+ [P in K]: V;
648
+ };
649
+ /**
650
+ * Utility type that "prettifies" an object type for IDE hints.
651
+ *
652
+ * TypeScript often shows type aliases, intersections, and conditional types
653
+ * in their raw form (e.g. `Result<SomeType>` or `A & B`) instead of expanding
654
+ * them into a flat object structure.
655
+ *
656
+ * `Prettify<T>` remaps the properties of `T` into a new object type,
657
+ * effectively "flattening" the type so that IDE hovers display a clean,
658
+ * expanded shape.
659
+ *
660
+ * Notice: it doesn't touch the nested types - to do it you need to use a recursive type.
661
+ *
662
+ * Examples:
663
+ * ```ts
664
+ * type Raw = { a: number } & { b: string };
665
+ * // Hover shows: { a: number } & { b: string }
666
+ *
667
+ * type Pretty = Prettify<Raw>;
668
+ * // Hover shows: { a: number; b: string }
669
+ * ```
670
+ */
671
+ type Prettify<T> = {
672
+ [K in keyof T]: T[K];
673
+ } & {};
674
+
675
+ type RawCallResult = number[];
676
+ type RawCallLogs = string[];
677
+ type BaseDeserializeResult = ({ rawResult, }: {
678
+ rawResult: RawCallResult;
679
+ }) => unknown;
680
+ type MaybeBaseDeserializeResult = BaseDeserializeResult | undefined;
681
+ type BaseSerializeArgs<A> = (args: {
682
+ functionArgs: A;
683
+ }) => Uint8Array;
684
+ type BaseFnCallArgs = {
685
+ contractAccountId: AccountId;
686
+ functionName: ContractFunctionName;
687
+ withStateAt?: BlockReference;
688
+ };
689
+ type Options<A, SR extends BaseSerializeArgs<A> | undefined, DR extends MaybeBaseDeserializeResult> = [SR, DR] extends [undefined, undefined] ? {
690
+ options?: never;
691
+ } : {
692
+ options: KeyIf<'serializeArgs', SR> & KeyIf<'deserializeResult', DR>;
693
+ };
694
+ type FunctionArgs<A> = KeyIf<'functionArgs', A>;
695
+ type Result<R> = Prettify<{
696
+ blockHash: BlockHash;
697
+ blockHeight: BlockHeight;
698
+ logs: RawCallLogs;
699
+ result: R;
700
+ }>;
701
+ type CallResult<DR extends MaybeBaseDeserializeResult> = [DR] extends [
702
+ BaseDeserializeResult
703
+ ] ? Promise<Result<ReturnType<DR>>> : Promise<Result<unknown>>;
704
+ type FunctionArgsOf<SA> = SA extends (args: {
705
+ functionArgs: infer T;
706
+ }) => Uint8Array ? T : undefined;
707
+ type CallContractReadFunction = {
708
+ <A extends MaybeJsonLikeValue = undefined>(args: BaseFnCallArgs & FunctionArgs<A> & Options<undefined, undefined, undefined>): CallResult<undefined>;
709
+ <DR extends BaseDeserializeResult, A extends MaybeJsonLikeValue = undefined>(args: BaseFnCallArgs & FunctionArgs<A> & Options<undefined, undefined, DR>): CallResult<DR>;
710
+ <SA extends BaseSerializeArgs<A>, DR extends MaybeBaseDeserializeResult = undefined, A = FunctionArgsOf<SA>>(args: BaseFnCallArgs & FunctionArgs<A> & Options<A, SA, DR>): CallResult<DR>;
711
+ };
712
+
713
+ type Rpc = {
714
+ url: string;
715
+ headers?: Record<string, string>;
716
+ };
717
+ type Network = {
718
+ rpcs: {
719
+ regular: Rpc[];
720
+ archival: Rpc[];
721
+ };
722
+ };
723
+ type Input = {
724
+ network: Network;
725
+ };
726
+ type Client = {
727
+ getAccountState: GetAccountState;
728
+ getAccountKey: GetAccountKey;
729
+ getAccountKeys: GetAccountKeys;
730
+ getContractState: GetContractState;
731
+ callContractReadFunction: CallContractReadFunction;
732
+ getBlock: GetBlock;
733
+ getProtocolConfig: GetProtocolConfig;
734
+ getGasPrice: GetGasPrice;
735
+ sendSignedTransaction: SendSignedTransaction;
736
+ };
737
+ type CreateClient = (input: Input) => Client;
738
+
739
+ declare const createClient: CreateClient;
740
+
741
+ declare const mainnet: Network;
742
+ declare const testnet: Network;
743
+
744
+ type KeySource = {
745
+ privateKey: PrivateKey;
746
+ } | {
747
+ seedPhrase: string;
748
+ };
749
+ type SingleKeySource = {
750
+ keySource: KeySource;
751
+ keySources?: never;
752
+ };
753
+ type MultiKeySources = {
754
+ keySource?: never;
755
+ keySources: KeySource[];
756
+ };
757
+ type CreateMemoryKeyServiceInput = SingleKeySource | MultiKeySources;
758
+ type KeyPairs = Record<PublicKey, PrivateKey>;
759
+ type SignTransaction = (transaction: Transaction) => Promise<SignedTransaction>;
760
+ type MemoryKeyService = {
761
+ signTransaction: SignTransaction;
762
+ getKeyPairs: () => KeyPairs;
763
+ };
764
+
765
+ declare const createMemoryKeyService: (params: CreateMemoryKeyServiceInput) => Promise<MemoryKeyService>;
766
+
767
+ type ExecuteMultipleTransactionsResult = ({
768
+ status: 'Success';
769
+ result: SendSignedTransactionResult;
770
+ } | {
771
+ status: 'Error';
772
+ error: unknown;
773
+ } | {
774
+ status: 'Canceled';
775
+ })[];
776
+ type SignMultipleTransactionsResult = ({
777
+ status: 'Success';
778
+ result: SignedTransaction;
779
+ } | {
780
+ status: 'Error';
781
+ error: unknown;
782
+ } | {
783
+ status: 'Canceled';
784
+ })[];
785
+ type MemorySigner = {
786
+ executeTransaction: (args: TransactionIntent) => Promise<SendSignedTransactionResult>;
787
+ executeMultipleTransactions: (args: {
788
+ transactionIntents: TransactionIntent[];
789
+ }) => Promise<ExecuteMultipleTransactionsResult>;
790
+ signTransaction: (args: TransactionIntent) => Promise<SignedTransaction>;
791
+ signMultipleTransactions: (args: {
792
+ transactionIntents: TransactionIntent[];
793
+ }) => Promise<SignMultipleTransactionsResult>;
794
+ };
795
+ type CreateMemorySignerArgs = {
796
+ signerAccountId: AccountId;
797
+ client: Client;
798
+ keyService: MemoryKeyService;
799
+ keyPool?: {
800
+ signingKeys?: PublicKey[];
801
+ };
802
+ queue?: {
803
+ taskTtlMs?: number;
804
+ };
805
+ };
806
+ type CreateMemorySigner = (args: CreateMemorySignerArgs) => Promise<MemorySigner>;
807
+
808
+ declare const createMemorySigner: CreateMemorySigner;
809
+
810
+ declare const transfer: (params: TransferActionParams) => TransferAction;
811
+
812
+ declare const createAccount: () => CreateAccountAction;
813
+
814
+ declare const addFullAccessKey: ({ publicKey, }: Omit<FullAccessKeyParams, "accessType">) => AddKeyAction;
815
+
816
+ declare const addFunctionCallKey: ({ publicKey, contractAccountId, gasBudget, allowedFunctions, }: Omit<FunctionCallKeyParams, "accessType">) => AddKeyAction;
817
+
818
+ declare const functionCall: <AJ extends MaybeJsonLikeValue>(params: FunctionCallParams<AJ>) => FunctionCallAction<AJ>;
819
+
820
+ declare const deleteKey: (params: DeleteKeyActionParams) => DeleteKeyAction;
821
+
822
+ declare const deleteAccount: (params: DeleteAccountActionParams) => DeleteAccountAction;
823
+
824
+ declare const deployContract: (params: DeployContractActionParams) => DeployContractAction;
825
+
826
+ declare const yoctoNear: (units: Units) => NearToken;
827
+ declare const near: (tokens: Tokens) => NearToken;
828
+
829
+ declare const gas: (gas: GasInput) => {
830
+ gas: bigint;
831
+ teraGas: string;
832
+ };
833
+ declare const teraGas: (teraGas: TeraGasInput) => {
834
+ gas: bigint;
835
+ teraGas: string;
836
+ };
837
+
838
+ export { addFullAccessKey, addFunctionCallKey, createAccount, createClient, createMemoryKeyService, createMemorySigner, deleteAccount, deleteKey, deployContract, functionCall, gas, mainnet, near, teraGas, testnet, transfer, yoctoNear };