@alephium/web3 0.4.0 → 0.5.0-rc.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.
@@ -577,7 +577,8 @@ export interface ContractState {
577
577
 
578
578
  /** @format 32-byte-hash */
579
579
  initialStateHash?: string
580
- fields: Val[]
580
+ immFields: Val[]
581
+ mutFields: Val[]
581
582
  asset: AssetState
582
583
  }
583
584
 
@@ -884,7 +885,8 @@ export interface TestContract {
884
885
 
885
886
  /** @format contract */
886
887
  bytecode: string
887
- initialFields?: Val[]
888
+ initialImmFields?: Val[]
889
+ initialMutFields?: Val[]
888
890
  initialAsset?: AssetState
889
891
 
890
892
  /** @format int32 */
@@ -1332,7 +1334,7 @@ export class HttpClient<SecurityDataType = unknown> {
1332
1334
 
1333
1335
  /**
1334
1336
  * @title Alephium API
1335
- * @version 1.6.4
1337
+ * @version 1.7.0
1336
1338
  * @baseUrl ../
1337
1339
  */
1338
1340
  export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
package/src/api/types.ts CHANGED
@@ -227,3 +227,11 @@ function foldVals(vals: Val[], dims: number[]): Val {
227
227
  return result
228
228
  }
229
229
  }
230
+
231
+ export function typeLength(tpe: string): number {
232
+ if (tpe === 'U256' || tpe === 'I256' || tpe === 'Bool' || tpe === 'ByteVec' || tpe === 'Address') {
233
+ return 1
234
+ }
235
+ const [, dims] = decodeArrayType(tpe)
236
+ return dims.reduce((a, b) => a * b)
237
+ }
package/src/constants.ts CHANGED
@@ -19,3 +19,4 @@ along with the library. If not, see <http://www.gnu.org/licenses/>.
19
19
  export const TOTAL_NUMBER_OF_GROUPS = 4
20
20
  export const MIN_UTXO_SET_AMOUNT = BigInt(1000000000000)
21
21
  export const ALPH_TOKEN_ID = ''.padStart(64, '0')
22
+ export const ONE_ALPH = 10n ** 18n