@zing-protocol/zing-sdk 0.0.17 → 0.1.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 (91) hide show
  1. package/dist/_generated/index.d.ts +0 -2
  2. package/dist/_generated/index.js +0 -2
  3. package/dist/_generated/utils/index.d.ts +21 -2
  4. package/dist/_generated/utils/index.js +35 -11
  5. package/dist/_generated/zing_framework/coin_utils.js +1 -4
  6. package/dist/_generated/zing_framework/derived_object_bag.d.ts +4 -3
  7. package/dist/_generated/zing_framework/derived_object_bag.js +12 -37
  8. package/dist/_generated/zing_framework/derived_table.d.ts +5 -4
  9. package/dist/_generated/zing_framework/derived_table.js +12 -33
  10. package/dist/_generated/zing_governance/admin.d.ts +4 -17
  11. package/dist/_generated/zing_governance/admin.js +3 -17
  12. package/dist/_generated/zing_governance/treasury.d.ts +5 -4
  13. package/dist/_generated/zing_governance/treasury.js +5 -15
  14. package/dist/_generated/zing_studio/app.d.ts +70 -2
  15. package/dist/_generated/zing_studio/app.js +154 -100
  16. package/dist/_generated/zing_studio/article.d.ts +6 -52
  17. package/dist/_generated/zing_studio/article.js +23 -74
  18. package/dist/_generated/zing_studio/config.d.ts +34 -3
  19. package/dist/_generated/zing_studio/config.js +47 -50
  20. package/dist/_generated/zing_studio/deps/sui/bag.d.ts +25 -3
  21. package/dist/_generated/zing_studio/deps/sui/bag.js +1 -2
  22. package/dist/_generated/zing_studio/deps/sui/balance.d.ts +1 -1
  23. package/dist/_generated/zing_studio/deps/sui/balance.js +1 -1
  24. package/dist/_generated/zing_studio/deps/sui/coin.d.ts +3 -5
  25. package/dist/_generated/zing_studio/deps/sui/coin.js +3 -3
  26. package/dist/_generated/zing_studio/deps/sui/table.d.ts +21 -4
  27. package/dist/_generated/zing_studio/deps/sui/table.js +2 -3
  28. package/dist/_generated/zing_studio/deps/walrus/blob.d.ts +2 -6
  29. package/dist/_generated/zing_studio/deps/walrus/blob.js +1 -2
  30. package/dist/_generated/zing_studio/deps/walrus/storage_resource.d.ts +1 -3
  31. package/dist/_generated/zing_studio/deps/walrus/storage_resource.js +1 -2
  32. package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.d.ts +1 -3
  33. package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.js +1 -2
  34. package/dist/_generated/zing_studio/deps/zing_framework/derived_table.d.ts +2 -4
  35. package/dist/_generated/zing_studio/deps/zing_framework/derived_table.js +2 -3
  36. package/dist/_generated/zing_studio/donation.d.ts +6 -14
  37. package/dist/_generated/zing_studio/donation.js +2 -2
  38. package/dist/_generated/zing_studio/enclave.d.ts +17 -10
  39. package/dist/_generated/zing_studio/enclave.js +16 -41
  40. package/dist/_generated/zing_studio/referral.js +15 -46
  41. package/dist/_generated/zing_studio/storage.d.ts +13 -17
  42. package/dist/_generated/zing_studio/storage.js +46 -100
  43. package/dist/_generated/zing_studio/studio.d.ts +6 -28
  44. package/dist/_generated/zing_studio/studio.js +23 -96
  45. package/dist/client/index.d.ts +18 -55
  46. package/dist/client/index.js +1 -28
  47. package/dist/getters.d.ts +17 -62
  48. package/dist/getters.js +62 -56
  49. package/dist/hooks/index.d.ts +0 -1
  50. package/dist/hooks/index.js +1 -1
  51. package/dist/hooks/useGetStudio.d.ts +4 -10
  52. package/dist/hooks/useReclaim.d.ts +0 -10
  53. package/dist/hooks/useReclaim.js +169 -92
  54. package/dist/hooks/useSignAndExecuteTransaction.js +4 -1
  55. package/dist/hooks/useZingInfiniteQueries.d.ts +3 -9
  56. package/dist/hooks/useZingInfiniteQueries.js +1 -0
  57. package/dist/hooks/useZingQueries.d.ts +8 -27
  58. package/dist/hooks/useZingQueries.js +1 -2
  59. package/dist/hooks/useZingQuery.d.ts +11 -36
  60. package/dist/hooks/useZingQuery.js +1 -2
  61. package/dist/lib/utils/index.d.ts +0 -1
  62. package/dist/lib/utils/index.js +0 -1
  63. package/dist/lib/utils/reclaim.d.ts +1 -29
  64. package/dist/lib/utils/reclaim.js +148 -87
  65. package/dist/mutations/signer.js +1 -1
  66. package/dist/mutations/walrus.js +1 -1
  67. package/package.json +1 -1
  68. package/dist/_generated/zing_framework/deps/sui/object.d.ts +0 -8
  69. package/dist/_generated/zing_framework/deps/sui/object.js +0 -13
  70. package/dist/_generated/zing_governance/deps/sui/object.d.ts +0 -8
  71. package/dist/_generated/zing_governance/deps/sui/object.js +0 -13
  72. package/dist/_generated/zing_identity/config.d.ts +0 -87
  73. package/dist/_generated/zing_identity/config.js +0 -98
  74. package/dist/_generated/zing_identity/deps/std/type_name.d.ts +0 -17
  75. package/dist/_generated/zing_identity/deps/std/type_name.js +0 -22
  76. package/dist/_generated/zing_identity/deps/sui/object.d.ts +0 -8
  77. package/dist/_generated/zing_identity/deps/sui/object.js +0 -13
  78. package/dist/_generated/zing_identity/deps/sui/object_table.d.ts +0 -12
  79. package/dist/_generated/zing_identity/deps/sui/object_table.js +0 -23
  80. package/dist/_generated/zing_identity/deps/sui/table.d.ts +0 -12
  81. package/dist/_generated/zing_identity/deps/sui/table.js +0 -35
  82. package/dist/_generated/zing_identity/deps/sui/vec_set.d.ts +0 -17
  83. package/dist/_generated/zing_identity/deps/sui/vec_set.js +0 -22
  84. package/dist/_generated/zing_identity/ecdsa.d.ts +0 -81
  85. package/dist/_generated/zing_identity/ecdsa.js +0 -87
  86. package/dist/_generated/zing_identity/identity.d.ts +0 -262
  87. package/dist/_generated/zing_identity/identity.js +0 -294
  88. package/dist/_generated/zing_identity/reclaim.d.ts +0 -356
  89. package/dist/_generated/zing_identity/reclaim.js +0 -414
  90. package/dist/_generated/zing_studio/nitro_attestation.d.ts +0 -148
  91. package/dist/_generated/zing_studio/nitro_attestation.js +0 -183
@@ -1,98 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import * as type_name from "./deps/std/type_name.js";
5
- import * as object from "./deps/sui/object.js";
6
- import * as vec_set from "./deps/sui/vec_set.js";
7
- import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
8
- import { bcs } from "@mysten/sui/bcs";
9
- const $moduleName = "@local-pkg/zing_identity::config";
10
- export const Config = new MoveStruct({
11
- name: `${$moduleName}::Config`,
12
- fields: {
13
- id: object.UID,
14
- registry: vec_set.VecSet(type_name.TypeName),
15
- versions: vec_set.VecSet(bcs.u64()),
16
- base_read_fee: bcs.u64(),
17
- },
18
- });
19
- export function packageVersion(options = {}) {
20
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
21
- return (tx) => tx.moveCall({
22
- package: packageAddress,
23
- module: "config",
24
- function: "package_version",
25
- });
26
- }
27
- export function baseReadFee(options) {
28
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
29
- const argumentsTypes = [
30
- `${packageAddress}::config::Config`,
31
- ];
32
- const parameterNames = ["self"];
33
- return (tx) => tx.moveCall({
34
- package: packageAddress,
35
- module: "config",
36
- function: "base_read_fee",
37
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
38
- });
39
- }
40
- export function addVersion(options) {
41
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
42
- const argumentsTypes = [
43
- `${packageAddress}::config::Config`,
44
- `${packageAddress}::admin::AdminCap`,
45
- "u64",
46
- ];
47
- const parameterNames = ["self", "Cap", "version"];
48
- return (tx) => tx.moveCall({
49
- package: packageAddress,
50
- module: "config",
51
- function: "add_version",
52
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
53
- });
54
- }
55
- export function removeVersion(options) {
56
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
57
- const argumentsTypes = [
58
- `${packageAddress}::config::Config`,
59
- `${packageAddress}::admin::AdminCap`,
60
- "u64",
61
- ];
62
- const parameterNames = ["self", "Cap", "version"];
63
- return (tx) => tx.moveCall({
64
- package: packageAddress,
65
- module: "config",
66
- function: "remove_version",
67
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
68
- });
69
- }
70
- export function updateReadFee(options) {
71
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
72
- const argumentsTypes = [
73
- `${packageAddress}::config::Config`,
74
- `${packageAddress}::admin::AdminCap`,
75
- "u64",
76
- ];
77
- const parameterNames = ["self", "Cap", "fee"];
78
- return (tx) => tx.moveCall({
79
- package: packageAddress,
80
- module: "config",
81
- function: "update_read_fee",
82
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
83
- });
84
- }
85
- export function derivedObjectKey(options) {
86
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
87
- const argumentsTypes = [
88
- "0x0000000000000000000000000000000000000000000000000000000000000001::ascii::String",
89
- ];
90
- const parameterNames = ["name"];
91
- return (tx) => tx.moveCall({
92
- package: packageAddress,
93
- module: "config",
94
- function: "derived_object_key",
95
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
96
- typeArguments: options.typeArguments,
97
- });
98
- }
@@ -1,17 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /** Functionality for converting Move types into values. Use with care! */
5
- import { MoveStruct } from "../../../utils/index.js";
6
- export declare const TypeName: MoveStruct<{
7
- /**
8
- * String representation of the type. All types are represented using their source
9
- * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
10
- * Struct types are represented as fully qualified type names; e.g.
11
- * `00000000000000000000000000000001::string::String` or
12
- * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
13
- * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
14
- * 32 depending on the Move platform)
15
- */
16
- name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
17
- }, "std::type_name::TypeName">;
@@ -1,22 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /** Functionality for converting Move types into values. Use with care! */
5
- import { MoveStruct } from "../../../utils/index.js";
6
- import { bcs } from "@mysten/sui/bcs";
7
- const $moduleName = "std::type_name";
8
- export const TypeName = new MoveStruct({
9
- name: `${$moduleName}::TypeName`,
10
- fields: {
11
- /**
12
- * String representation of the type. All types are represented using their source
13
- * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
14
- * Struct types are represented as fully qualified type names; e.g.
15
- * `00000000000000000000000000000001::string::String` or
16
- * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
17
- * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
18
- * 32 depending on the Move platform)
19
- */
20
- name: bcs.string(),
21
- },
22
- });
@@ -1,8 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /** Sui object identifiers */
5
- import { MoveStruct } from "../../../utils/index.js";
6
- export declare const UID: MoveStruct<{
7
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
- }, "0x2::object::UID">;
@@ -1,13 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /** Sui object identifiers */
5
- import { MoveStruct } from "../../../utils/index.js";
6
- import { bcs } from "@mysten/sui/bcs";
7
- const $moduleName = "0x2::object";
8
- export const UID = new MoveStruct({
9
- name: `${$moduleName}::UID`,
10
- fields: {
11
- id: bcs.Address,
12
- },
13
- });
@@ -1,12 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from "../../../utils/index.js";
5
- export declare const ObjectTable: MoveStruct<{
6
- /** the ID of this table */
7
- id: MoveStruct<{
8
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
9
- }, "0x2::object::UID">;
10
- /** the number of key-value pairs in the table */
11
- size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
12
- }, "0x2::object_table::ObjectTable">;
@@ -1,23 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * Similar to `sui::table`, an `ObjectTable<K, V>` is a map-like collection. But
6
- * unlike `sui::table`, the values bound to these dynamic fields _must_ be objects
7
- * themselves. This allows for the objects to still exist within in storage, which
8
- * may be important for external tools. The difference is otherwise not observable
9
- * from within Move.
10
- */
11
- import * as object from "./object.js";
12
- import { MoveStruct } from "../../../utils/index.js";
13
- import { bcs } from "@mysten/sui/bcs";
14
- const $moduleName = "0x2::object_table";
15
- export const ObjectTable = new MoveStruct({
16
- name: `${$moduleName}::ObjectTable`,
17
- fields: {
18
- /** the ID of this table */
19
- id: object.UID,
20
- /** the number of key-value pairs in the table */
21
- size: bcs.u64(),
22
- },
23
- });
@@ -1,12 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from "../../../utils/index.js";
5
- export declare const Table: MoveStruct<{
6
- /** the ID of this table */
7
- id: MoveStruct<{
8
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
9
- }, "0x2::object::UID">;
10
- /** the number of key-value pairs in the table */
11
- size: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
12
- }, "0x2::table::Table">;
@@ -1,35 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * A table is a map-like collection. But unlike a traditional collection, it's keys
6
- * and values are not stored within the `Table` value, but instead are stored using
7
- * Sui's object system. The `Table` struct acts only as a handle into the object
8
- * system to retrieve those keys and values. Note that this means that `Table`
9
- * values with exactly the same key-value mapping will not be equal, with `==`, at
10
- * runtime. For example
11
- *
12
- * ```
13
- * let table1 = table::new<u64, bool>();
14
- * let table2 = table::new<u64, bool>();
15
- * table::add(&mut table1, 0, false);
16
- * table::add(&mut table1, 1, true);
17
- * table::add(&mut table2, 0, false);
18
- * table::add(&mut table2, 1, true);
19
- * // table1 does not equal table2, despite having the same entries
20
- * assert!(&table1 != &table2);
21
- * ```
22
- */
23
- import * as object from "./object.js";
24
- import { MoveStruct } from "../../../utils/index.js";
25
- import { bcs } from "@mysten/sui/bcs";
26
- const $moduleName = "0x2::table";
27
- export const Table = new MoveStruct({
28
- name: `${$moduleName}::Table`,
29
- fields: {
30
- /** the ID of this table */
31
- id: object.UID,
32
- /** the number of key-value pairs in the table */
33
- size: bcs.u64(),
34
- },
35
- });
@@ -1,17 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from "../../../utils/index.js";
5
- import { bcs } from "@mysten/sui/bcs";
6
- import type { BcsType } from "@mysten/sui/bcs";
7
- /**
8
- * A set data structure backed by a vector. The set is guaranteed not to contain
9
- * duplicate keys. All operations are O(N) in the size of the set
10
- *
11
- * - the intention of this data structure is only to provide the convenience of
12
- * programming against a set API. Sets that need sorted iteration rather than
13
- * insertion order iteration should be handwritten.
14
- */
15
- export declare function VecSet<K extends BcsType<any>>(...typeParameters: [K]): MoveStruct<{
16
- contents: ReturnType<typeof bcs.vector<K>>;
17
- }>;
@@ -1,22 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from "../../../utils/index.js";
5
- import { bcs } from "@mysten/sui/bcs";
6
- const $moduleName = "0x2::vec_set";
7
- /**
8
- * A set data structure backed by a vector. The set is guaranteed not to contain
9
- * duplicate keys. All operations are O(N) in the size of the set
10
- *
11
- * - the intention of this data structure is only to provide the convenience of
12
- * programming against a set API. Sets that need sorted iteration rather than
13
- * insertion order iteration should be handwritten.
14
- */
15
- export function VecSet(...typeParameters) {
16
- return new MoveStruct({
17
- name: `${$moduleName}::VecSet<${typeParameters[0].name}>`,
18
- fields: {
19
- contents: bcs.vector(typeParameters[0]),
20
- },
21
- });
22
- }
@@ -1,81 +0,0 @@
1
- import { MoveStruct } from "../utils/index.js";
2
- import type { RawTransactionArgument } from "../utils/index.js";
3
- import type { Transaction } from "@mysten/sui/transactions";
4
- export declare const VerifiedEvent: MoveStruct<{
5
- is_verified: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
6
- }, "@local-pkg/zing_identity::ecdsa::VerifiedEvent">;
7
- export declare const Output: MoveStruct<{
8
- id: MoveStruct<{
9
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
10
- }, "0x2::object::UID">;
11
- value: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
12
- length: number;
13
- }, string>;
14
- }, "@local-pkg/zing_identity::ecdsa::Output">;
15
- export interface Keccak256Arguments {
16
- data: RawTransactionArgument<number[]>;
17
- recipient: RawTransactionArgument<string>;
18
- }
19
- export interface Keccak256Options {
20
- package?: string;
21
- arguments: Keccak256Arguments | [
22
- data: RawTransactionArgument<number[]>,
23
- recipient: RawTransactionArgument<string>
24
- ];
25
- }
26
- /** Hash the data using Keccak256, output an object with the hash to recipient. */
27
- export declare function keccak256(options: Keccak256Options): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
28
- export interface EcrecoverArguments {
29
- signature: RawTransactionArgument<number[]>;
30
- msg: RawTransactionArgument<number[]>;
31
- recipient: RawTransactionArgument<string>;
32
- }
33
- export interface EcrecoverOptions {
34
- package?: string;
35
- arguments: EcrecoverArguments | [
36
- signature: RawTransactionArgument<number[]>,
37
- msg: RawTransactionArgument<number[]>,
38
- recipient: RawTransactionArgument<string>
39
- ];
40
- }
41
- /**
42
- * Recover the public key using the signature and message, assuming the signature
43
- * was produced over the Keccak256 hash of the message. Output an object with the
44
- * recovered pubkey to recipient.
45
- */
46
- export declare function ecrecover(options: EcrecoverOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
47
- export interface EcrecoverToEthAddressArguments {
48
- signature: RawTransactionArgument<number[]>;
49
- msg: RawTransactionArgument<number[]>;
50
- }
51
- export interface EcrecoverToEthAddressOptions {
52
- package?: string;
53
- arguments: EcrecoverToEthAddressArguments | [
54
- signature: RawTransactionArgument<number[]>,
55
- msg: RawTransactionArgument<number[]>
56
- ];
57
- }
58
- /**
59
- * Recover the Ethereum address using the signature and message, assuming the
60
- * signature was produced over the Keccak256 hash of the message. Output an object
61
- * with the recovered address to recipient.
62
- */
63
- export declare function ecrecoverToEthAddress(options: EcrecoverToEthAddressOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
64
- export interface Secp256k1VerifyArguments {
65
- signature: RawTransactionArgument<number[]>;
66
- publicKey: RawTransactionArgument<number[]>;
67
- msg: RawTransactionArgument<number[]>;
68
- }
69
- export interface Secp256k1VerifyOptions {
70
- package?: string;
71
- arguments: Secp256k1VerifyArguments | [
72
- signature: RawTransactionArgument<number[]>,
73
- publicKey: RawTransactionArgument<number[]>,
74
- msg: RawTransactionArgument<number[]>
75
- ];
76
- }
77
- /**
78
- * Verified the secp256k1 signature using public key and message assuming Keccak
79
- * was using when signing. Emit an is_verified event of the verification result.
80
- */
81
- export declare function secp256k1Verify(options: Secp256k1VerifyOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -1,87 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import * as object from "./deps/sui/object.js";
5
- import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
6
- import { bcs } from "@mysten/sui/bcs";
7
- const $moduleName = "@local-pkg/zing_identity::ecdsa";
8
- export const VerifiedEvent = new MoveStruct({
9
- name: `${$moduleName}::VerifiedEvent`,
10
- fields: {
11
- is_verified: bcs.bool(),
12
- },
13
- });
14
- export const Output = new MoveStruct({
15
- name: `${$moduleName}::Output`,
16
- fields: {
17
- id: object.UID,
18
- value: bcs.vector(bcs.u8()),
19
- },
20
- });
21
- /** Hash the data using Keccak256, output an object with the hash to recipient. */
22
- export function keccak256(options) {
23
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
24
- const argumentsTypes = ["vector<u8>", "address"];
25
- const parameterNames = ["data", "recipient"];
26
- return (tx) => tx.moveCall({
27
- package: packageAddress,
28
- module: "ecdsa",
29
- function: "keccak256",
30
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
31
- });
32
- }
33
- /**
34
- * Recover the public key using the signature and message, assuming the signature
35
- * was produced over the Keccak256 hash of the message. Output an object with the
36
- * recovered pubkey to recipient.
37
- */
38
- export function ecrecover(options) {
39
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
40
- const argumentsTypes = [
41
- "vector<u8>",
42
- "vector<u8>",
43
- "address",
44
- ];
45
- const parameterNames = ["signature", "msg", "recipient"];
46
- return (tx) => tx.moveCall({
47
- package: packageAddress,
48
- module: "ecdsa",
49
- function: "ecrecover",
50
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
51
- });
52
- }
53
- /**
54
- * Recover the Ethereum address using the signature and message, assuming the
55
- * signature was produced over the Keccak256 hash of the message. Output an object
56
- * with the recovered address to recipient.
57
- */
58
- export function ecrecoverToEthAddress(options) {
59
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
60
- const argumentsTypes = ["vector<u8>", "vector<u8>"];
61
- const parameterNames = ["signature", "msg"];
62
- return (tx) => tx.moveCall({
63
- package: packageAddress,
64
- module: "ecdsa",
65
- function: "ecrecover_to_eth_address",
66
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
67
- });
68
- }
69
- /**
70
- * Verified the secp256k1 signature using public key and message assuming Keccak
71
- * was using when signing. Emit an is_verified event of the verification result.
72
- */
73
- export function secp256k1Verify(options) {
74
- const packageAddress = options.package ?? "@local-pkg/zing_identity";
75
- const argumentsTypes = [
76
- "vector<u8>",
77
- "vector<u8>",
78
- "vector<u8>",
79
- ];
80
- const parameterNames = ["signature", "publicKey", "msg"];
81
- return (tx) => tx.moveCall({
82
- package: packageAddress,
83
- module: "ecdsa",
84
- function: "secp256k1_verify",
85
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
86
- });
87
- }