@midnames/sdk 0.1.1 → 0.1.2

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.
@@ -556,21 +556,21 @@ class Contract {
556
556
  if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.originalState != undefined && contextOrig_0.transactionContext != undefined)) {
557
557
  __compactRuntime.type_error('register_domain_for',
558
558
  'argument 1 (as invoked from Typescript)',
559
- 'leaf.compact line 162 char 1',
559
+ 'leaf.compact line 159 char 1',
560
560
  'CircuitContext',
561
561
  contextOrig_0)
562
562
  }
563
563
  if (!(typeof(owner_0) === 'object' && owner_0.bytes.buffer instanceof ArrayBuffer && owner_0.bytes.BYTES_PER_ELEMENT === 1 && owner_0.bytes.length === 32)) {
564
564
  __compactRuntime.type_error('register_domain_for',
565
565
  'argument 1 (argument 2 as invoked from Typescript)',
566
- 'leaf.compact line 162 char 1',
566
+ 'leaf.compact line 159 char 1',
567
567
  'struct ZswapCoinPublicKey<bytes: Bytes<32>>',
568
568
  owner_0)
569
569
  }
570
570
  if (!(typeof(resolver_0) === 'object' && resolver_0.bytes.buffer instanceof ArrayBuffer && resolver_0.bytes.BYTES_PER_ELEMENT === 1 && resolver_0.bytes.length === 32)) {
571
571
  __compactRuntime.type_error('register_domain_for',
572
572
  'argument 3 (argument 4 as invoked from Typescript)',
573
- 'leaf.compact line 162 char 1',
573
+ 'leaf.compact line 159 char 1',
574
574
  'struct ContractAddress<bytes: Bytes<32>>',
575
575
  resolver_0)
576
576
  }
@@ -602,14 +602,14 @@ class Contract {
602
602
  if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.originalState != undefined && contextOrig_0.transactionContext != undefined)) {
603
603
  __compactRuntime.type_error('set_resolver',
604
604
  'argument 1 (as invoked from Typescript)',
605
- 'leaf.compact line 181 char 1',
605
+ 'leaf.compact line 178 char 1',
606
606
  'CircuitContext',
607
607
  contextOrig_0)
608
608
  }
609
609
  if (!(typeof(resolver_0) === 'object' && resolver_0.bytes.buffer instanceof ArrayBuffer && resolver_0.bytes.BYTES_PER_ELEMENT === 1 && resolver_0.bytes.length === 32)) {
610
610
  __compactRuntime.type_error('set_resolver',
611
611
  'argument 2 (argument 3 as invoked from Typescript)',
612
- 'leaf.compact line 181 char 1',
612
+ 'leaf.compact line 178 char 1',
613
613
  'struct ContractAddress<bytes: Bytes<32>>',
614
614
  resolver_0)
615
615
  }
@@ -639,14 +639,14 @@ class Contract {
639
639
  if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.originalState != undefined && contextOrig_0.transactionContext != undefined)) {
640
640
  __compactRuntime.type_error('update_domain_target',
641
641
  'argument 1 (as invoked from Typescript)',
642
- 'leaf.compact line 195 char 1',
642
+ 'leaf.compact line 192 char 1',
643
643
  'CircuitContext',
644
644
  contextOrig_0)
645
645
  }
646
646
  if (!(typeof(new_target_0) === 'object' && typeof(new_target_0.is_left) === 'boolean' && typeof(new_target_0.left) === 'object' && new_target_0.left.bytes.buffer instanceof ArrayBuffer && new_target_0.left.bytes.BYTES_PER_ELEMENT === 1 && new_target_0.left.bytes.length === 32 && typeof(new_target_0.right) === 'object' && new_target_0.right.bytes.buffer instanceof ArrayBuffer && new_target_0.right.bytes.BYTES_PER_ELEMENT === 1 && new_target_0.right.bytes.length === 32)) {
647
647
  __compactRuntime.type_error('update_domain_target',
648
648
  'argument 1 (argument 2 as invoked from Typescript)',
649
- 'leaf.compact line 195 char 1',
649
+ 'leaf.compact line 192 char 1',
650
650
  'struct Either<is_left: Boolean, left: struct ZswapCoinPublicKey<bytes: Bytes<32>>, right: struct ContractAddress<bytes: Bytes<32>>>',
651
651
  new_target_0)
652
652
  }
@@ -676,14 +676,14 @@ class Contract {
676
676
  if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.originalState != undefined && contextOrig_0.transactionContext != undefined)) {
677
677
  __compactRuntime.type_error('transfer_domain',
678
678
  'argument 1 (as invoked from Typescript)',
679
- 'leaf.compact line 201 char 1',
679
+ 'leaf.compact line 198 char 1',
680
680
  'CircuitContext',
681
681
  contextOrig_0)
682
682
  }
683
683
  if (!(typeof(new_owner_0) === 'object' && new_owner_0.bytes.buffer instanceof ArrayBuffer && new_owner_0.bytes.BYTES_PER_ELEMENT === 1 && new_owner_0.bytes.length === 32)) {
684
684
  __compactRuntime.type_error('transfer_domain',
685
685
  'argument 2 (argument 3 as invoked from Typescript)',
686
- 'leaf.compact line 201 char 1',
686
+ 'leaf.compact line 198 char 1',
687
687
  'struct ZswapCoinPublicKey<bytes: Bytes<32>>',
688
688
  new_owner_0)
689
689
  }
@@ -703,6 +703,42 @@ class Contract {
703
703
  new_owner_0);
704
704
  partialProofData.output = { value: [], alignment: [] };
705
705
  return { result: result_0, context: context, proofData: partialProofData };
706
+ },
707
+ change_owner: (...args_1) => {
708
+ if (args_1.length !== 2) {
709
+ throw new __compactRuntime.CompactError(`change_owner: expected 2 arguments (as invoked from Typescript), received ${args_1.length}`);
710
+ }
711
+ const contextOrig_0 = args_1[0];
712
+ const new_owner_0 = args_1[1];
713
+ if (!(typeof(contextOrig_0) === 'object' && contextOrig_0.originalState != undefined && contextOrig_0.transactionContext != undefined)) {
714
+ __compactRuntime.type_error('change_owner',
715
+ 'argument 1 (as invoked from Typescript)',
716
+ 'leaf.compact line 220 char 1',
717
+ 'CircuitContext',
718
+ contextOrig_0)
719
+ }
720
+ if (!(typeof(new_owner_0) === 'object' && new_owner_0.bytes.buffer instanceof ArrayBuffer && new_owner_0.bytes.BYTES_PER_ELEMENT === 1 && new_owner_0.bytes.length === 32)) {
721
+ __compactRuntime.type_error('change_owner',
722
+ 'argument 1 (argument 2 as invoked from Typescript)',
723
+ 'leaf.compact line 220 char 1',
724
+ 'struct ZswapCoinPublicKey<bytes: Bytes<32>>',
725
+ new_owner_0)
726
+ }
727
+ const context = { ...contextOrig_0 };
728
+ const partialProofData = {
729
+ input: {
730
+ value: _descriptor_2.toValue(new_owner_0),
731
+ alignment: _descriptor_2.alignment()
732
+ },
733
+ output: undefined,
734
+ publicTranscript: [],
735
+ privateTranscriptOutputs: []
736
+ };
737
+ const result_0 = this._change_owner_0(context,
738
+ partialProofData,
739
+ new_owner_0);
740
+ partialProofData.output = { value: [], alignment: [] };
741
+ return { result: result_0, context: context, proofData: partialProofData };
706
742
  }
707
743
  };
708
744
  this.impureCircuits = {
@@ -717,7 +753,8 @@ class Contract {
717
753
  register_domain_for: this.circuits.register_domain_for,
718
754
  set_resolver: this.circuits.set_resolver,
719
755
  update_domain_target: this.circuits.update_domain_target,
720
- transfer_domain: this.circuits.transfer_domain
756
+ transfer_domain: this.circuits.transfer_domain,
757
+ change_owner: this.circuits.change_owner
721
758
  };
722
759
  }
723
760
  initialState(...args_0) {
@@ -815,6 +852,7 @@ class Contract {
815
852
  state_0.setOperation('set_resolver', new __compactRuntime.ContractOperation());
816
853
  state_0.setOperation('update_domain_target', new __compactRuntime.ContractOperation());
817
854
  state_0.setOperation('transfer_domain', new __compactRuntime.ContractOperation());
855
+ state_0.setOperation('change_owner', new __compactRuntime.ContractOperation());
818
856
  const context = {
819
857
  originalState: state_0,
820
858
  currentPrivateState: constructorContext_0.initialPrivateState,
@@ -854,8 +892,8 @@ class Contract {
854
892
  value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(2n),
855
893
  alignment: _descriptor_21.alignment() }).encode() } },
856
894
  { push: { storage: true,
857
- value: __compactRuntime.StateValue.newCell({ value: _descriptor_2.toValue({ bytes: new Uint8Array(32) }),
858
- alignment: _descriptor_2.alignment() }).encode() } },
895
+ value: __compactRuntime.StateValue.newCell({ value: _descriptor_20.toValue({ is_some: false, value: '' }),
896
+ alignment: _descriptor_20.alignment() }).encode() } },
859
897
  { ins: { cached: false, n: 1 } }]);
860
898
  Contract._query(context,
861
899
  partialProofData,
@@ -864,8 +902,8 @@ class Contract {
864
902
  value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(3n),
865
903
  alignment: _descriptor_21.alignment() }).encode() } },
866
904
  { push: { storage: true,
867
- value: __compactRuntime.StateValue.newCell({ value: _descriptor_20.toValue({ is_some: false, value: '' }),
868
- alignment: _descriptor_20.alignment() }).encode() } },
905
+ value: __compactRuntime.StateValue.newCell({ value: _descriptor_2.toValue({ bytes: new Uint8Array(32) }),
906
+ alignment: _descriptor_2.alignment() }).encode() } },
869
907
  { ins: { cached: false, n: 1 } }]);
870
908
  Contract._query(context,
871
909
  partialProofData,
@@ -935,7 +973,7 @@ class Contract {
935
973
  partialProofData,
936
974
  [
937
975
  { push: { storage: false,
938
- value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(2n),
976
+ value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(3n),
939
977
  alignment: _descriptor_21.alignment() }).encode() } },
940
978
  { push: { storage: true,
941
979
  value: __compactRuntime.StateValue.newCell({ value: _descriptor_2.toValue(tmp_0),
@@ -975,7 +1013,7 @@ class Contract {
975
1013
  partialProofData,
976
1014
  [
977
1015
  { push: { storage: false,
978
- value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(3n),
1016
+ value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(2n),
979
1017
  alignment: _descriptor_21.alignment() }).encode() } },
980
1018
  { push: { storage: true,
981
1019
  value: __compactRuntime.StateValue.newCell({ value: _descriptor_20.toValue(domain_0),
@@ -1284,7 +1322,7 @@ class Contract {
1284
1322
  pushPath: false,
1285
1323
  path: [
1286
1324
  { tag: 'value',
1287
- value: { value: _descriptor_21.toValue(2n),
1325
+ value: { value: _descriptor_21.toValue(3n),
1288
1326
  alignment: _descriptor_21.alignment() } }] } },
1289
1327
  { popeq: { cached: false,
1290
1328
  result: undefined } }]).value),
@@ -1312,7 +1350,7 @@ class Contract {
1312
1350
  pushPath: false,
1313
1351
  path: [
1314
1352
  { tag: 'value',
1315
- value: { value: _descriptor_21.toValue(2n),
1353
+ value: { value: _descriptor_21.toValue(3n),
1316
1354
  alignment: _descriptor_21.alignment() } }] } },
1317
1355
  { popeq: { cached: false,
1318
1356
  result: undefined } }]).value),
@@ -1340,7 +1378,7 @@ class Contract {
1340
1378
  pushPath: false,
1341
1379
  path: [
1342
1380
  { tag: 'value',
1343
- value: { value: _descriptor_21.toValue(2n),
1381
+ value: { value: _descriptor_21.toValue(3n),
1344
1382
  alignment: _descriptor_21.alignment() } }] } },
1345
1383
  { popeq: { cached: false,
1346
1384
  result: undefined } }]).value),
@@ -1454,7 +1492,7 @@ class Contract {
1454
1492
  pushPath: false,
1455
1493
  path: [
1456
1494
  { tag: 'value',
1457
- value: { value: _descriptor_21.toValue(2n),
1495
+ value: { value: _descriptor_21.toValue(3n),
1458
1496
  alignment: _descriptor_21.alignment() } }] } },
1459
1497
  { popeq: { cached: false,
1460
1498
  result: undefined } }]).value)),
@@ -1555,7 +1593,7 @@ class Contract {
1555
1593
  pushPath: false,
1556
1594
  path: [
1557
1595
  { tag: 'value',
1558
- value: { value: _descriptor_21.toValue(2n),
1596
+ value: { value: _descriptor_21.toValue(3n),
1559
1597
  alignment: _descriptor_21.alignment() } }] } },
1560
1598
  { popeq: { cached: false,
1561
1599
  result: undefined } }]).value),
@@ -1603,7 +1641,7 @@ class Contract {
1603
1641
  pushPath: false,
1604
1642
  path: [
1605
1643
  { tag: 'value',
1606
- value: { value: _descriptor_21.toValue(2n),
1644
+ value: { value: _descriptor_21.toValue(3n),
1607
1645
  alignment: _descriptor_21.alignment() } }] } },
1608
1646
  { popeq: { cached: false,
1609
1647
  result: undefined } }]).value),
@@ -1638,7 +1676,7 @@ class Contract {
1638
1676
  pushPath: false,
1639
1677
  path: [
1640
1678
  { tag: 'value',
1641
- value: { value: _descriptor_21.toValue(2n),
1679
+ value: { value: _descriptor_21.toValue(3n),
1642
1680
  alignment: _descriptor_21.alignment() } }] } },
1643
1681
  { popeq: { cached: false,
1644
1682
  result: undefined } }]).value),
@@ -1662,42 +1700,18 @@ class Contract {
1662
1700
  return [];
1663
1701
  }
1664
1702
  _clear_all_fields_0(context, partialProofData, domain_0) {
1665
- __compactRuntime.assert(_descriptor_5.fromValue(Contract._query(context,
1666
- partialProofData,
1667
- [
1668
- { dup: { n: 0 } },
1669
- { idx: { cached: false,
1670
- pushPath: false,
1671
- path: [
1672
- { tag: 'value',
1673
- value: { value: _descriptor_21.toValue(5n),
1674
- alignment: _descriptor_21.alignment() } }] } },
1675
- { push: { storage: false,
1676
- value: __compactRuntime.StateValue.newCell({ value: _descriptor_0.toValue(domain_0),
1677
- alignment: _descriptor_0.alignment() }).encode() } },
1678
- 'member',
1679
- { popeq: { cached: true,
1680
- result: undefined } }]).value),
1681
- 'Domain does not exist');
1682
- const current_data_0 = _descriptor_4.fromValue(Contract._query(context,
1683
- partialProofData,
1684
- [
1685
- { dup: { n: 0 } },
1686
- { idx: { cached: false,
1687
- pushPath: false,
1688
- path: [
1689
- { tag: 'value',
1690
- value: { value: _descriptor_21.toValue(5n),
1691
- alignment: _descriptor_21.alignment() } }] } },
1692
- { idx: { cached: false,
1693
- pushPath: false,
1694
- path: [
1695
- { tag: 'value',
1696
- value: { value: _descriptor_0.toValue(domain_0),
1697
- alignment: _descriptor_0.alignment() } }] } },
1698
- { popeq: { cached: false,
1699
- result: undefined } }]).value);
1700
- __compactRuntime.assert(this._equal_12(current_data_0.owner,
1703
+ __compactRuntime.assert(this._equal_12(_descriptor_2.fromValue(Contract._query(context,
1704
+ partialProofData,
1705
+ [
1706
+ { dup: { n: 0 } },
1707
+ { idx: { cached: false,
1708
+ pushPath: false,
1709
+ path: [
1710
+ { tag: 'value',
1711
+ value: { value: _descriptor_21.toValue(3n),
1712
+ alignment: _descriptor_21.alignment() } }] } },
1713
+ { popeq: { cached: false,
1714
+ result: undefined } }]).value),
1701
1715
  this._ownPublicKey_0(context,
1702
1716
  partialProofData)),
1703
1717
  'Not the domain owner');
@@ -1745,7 +1759,7 @@ class Contract {
1745
1759
  pushPath: false,
1746
1760
  path: [
1747
1761
  { tag: 'value',
1748
- value: { value: _descriptor_21.toValue(2n),
1762
+ value: { value: _descriptor_21.toValue(3n),
1749
1763
  alignment: _descriptor_21.alignment() } }] } },
1750
1764
  { popeq: { cached: false,
1751
1765
  result: undefined } }]).value),
@@ -1897,7 +1911,7 @@ class Contract {
1897
1911
  pushPath: false,
1898
1912
  path: [
1899
1913
  { tag: 'value',
1900
- value: { value: _descriptor_21.toValue(2n),
1914
+ value: { value: _descriptor_21.toValue(3n),
1901
1915
  alignment: _descriptor_21.alignment() } }] } },
1902
1916
  { popeq: { cached: false,
1903
1917
  result: undefined } }]).value),
@@ -2049,6 +2063,34 @@ class Contract {
2049
2063
  { ins: { cached: true, n: 2 } }]);
2050
2064
  return [];
2051
2065
  }
2066
+ _change_owner_0(context, partialProofData, new_owner_0) {
2067
+ __compactRuntime.assert(this._equal_17(_descriptor_2.fromValue(Contract._query(context,
2068
+ partialProofData,
2069
+ [
2070
+ { dup: { n: 0 } },
2071
+ { idx: { cached: false,
2072
+ pushPath: false,
2073
+ path: [
2074
+ { tag: 'value',
2075
+ value: { value: _descriptor_21.toValue(3n),
2076
+ alignment: _descriptor_21.alignment() } }] } },
2077
+ { popeq: { cached: false,
2078
+ result: undefined } }]).value),
2079
+ this._ownPublicKey_0(context,
2080
+ partialProofData)),
2081
+ 'Not the contract owner');
2082
+ Contract._query(context,
2083
+ partialProofData,
2084
+ [
2085
+ { push: { storage: false,
2086
+ value: __compactRuntime.StateValue.newCell({ value: _descriptor_21.toValue(3n),
2087
+ alignment: _descriptor_21.alignment() }).encode() } },
2088
+ { push: { storage: true,
2089
+ value: __compactRuntime.StateValue.newCell({ value: _descriptor_2.toValue(new_owner_0),
2090
+ alignment: _descriptor_2.alignment() }).encode() } },
2091
+ { ins: { cached: false, n: 1 } }]);
2092
+ return [];
2093
+ }
2052
2094
  _equal_0(x0, y0) {
2053
2095
  {
2054
2096
  let x1 = x0.is_some;
@@ -2227,6 +2269,14 @@ class Contract {
2227
2269
  }
2228
2270
  return true;
2229
2271
  }
2272
+ _equal_17(x0, y0) {
2273
+ {
2274
+ let x1 = x0.bytes;
2275
+ let y1 = y0.bytes;
2276
+ if (!x1.every((x, i) => y1[i] === x)) { return false; }
2277
+ }
2278
+ return true;
2279
+ }
2230
2280
  static _query(context, partialProofData, prog) {
2231
2281
  var res;
2232
2282
  try {
@@ -2294,20 +2344,6 @@ function ledger(state) {
2294
2344
  { popeq: { cached: false,
2295
2345
  result: undefined } }]).value);
2296
2346
  },
2297
- get DOMAIN_OWNER() {
2298
- return _descriptor_2.fromValue(Contract._query(context,
2299
- partialProofData,
2300
- [
2301
- { dup: { n: 0 } },
2302
- { idx: { cached: false,
2303
- pushPath: false,
2304
- path: [
2305
- { tag: 'value',
2306
- value: { value: _descriptor_21.toValue(2n),
2307
- alignment: _descriptor_21.alignment() } }] } },
2308
- { popeq: { cached: false,
2309
- result: undefined } }]).value);
2310
- },
2311
2347
  get DOMAIN() {
2312
2348
  return _descriptor_20.fromValue(Contract._query(context,
2313
2349
  partialProofData,
@@ -2317,11 +2353,25 @@ function ledger(state) {
2317
2353
  pushPath: false,
2318
2354
  path: [
2319
2355
  { tag: 'value',
2320
- value: { value: _descriptor_21.toValue(3n),
2356
+ value: { value: _descriptor_21.toValue(2n),
2321
2357
  alignment: _descriptor_21.alignment() } }] } },
2322
2358
  { popeq: { cached: false,
2323
2359
  result: undefined } }]).value);
2324
2360
  },
2361
+ get DOMAIN_OWNER() {
2362
+ return _descriptor_2.fromValue(Contract._query(context,
2363
+ partialProofData,
2364
+ [
2365
+ { dup: { n: 0 } },
2366
+ { idx: { cached: false,
2367
+ pushPath: false,
2368
+ path: [
2369
+ { tag: 'value',
2370
+ value: { value: _descriptor_21.toValue(3n),
2371
+ alignment: _descriptor_21.alignment() } }] } },
2372
+ { popeq: { cached: false,
2373
+ result: undefined } }]).value);
2374
+ },
2325
2375
  get DOMAIN_TARGET() {
2326
2376
  return _descriptor_7.fromValue(Contract._query(context,
2327
2377
  partialProofData,
@@ -0,0 +1,8 @@
1
+ {
2
+ "version": 3,
3
+ "file": "index.cjs",
4
+ "sourceRoot": "../../../../",
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;KAAA;IAsC9D;qCAAA;;;;;;;;;;;wFAAoC;KAAA;IACpC;qCAAA;;;;;;;;;;;wFAAoC;KAAA;;;;;;;;;;;;;;"
8
+ }
@@ -45,6 +45,8 @@ export type ImpureCircuits<T> = {
45
45
  transfer_domain(context: __compactRuntime.CircuitContext<T>,
46
46
  domain_0: string,
47
47
  new_owner_0: { bytes: Uint8Array }): __compactRuntime.CircuitResults<T, []>;
48
+ change_owner(context: __compactRuntime.CircuitContext<T>,
49
+ new_owner_0: { bytes: Uint8Array }): __compactRuntime.CircuitResults<T, []>;
48
50
  }
49
51
 
50
52
  export type PureCircuits = {
@@ -82,13 +84,15 @@ export type Circuits<T> = {
82
84
  transfer_domain(context: __compactRuntime.CircuitContext<T>,
83
85
  domain_0: string,
84
86
  new_owner_0: { bytes: Uint8Array }): __compactRuntime.CircuitResults<T, []>;
87
+ change_owner(context: __compactRuntime.CircuitContext<T>,
88
+ new_owner_0: { bytes: Uint8Array }): __compactRuntime.CircuitResults<T, []>;
85
89
  }
86
90
 
87
91
  export type Ledger = {
88
92
  readonly PARENT_DOMAIN: Maybe<string>;
89
93
  readonly PARENT_RESOLVER: { bytes: Uint8Array };
90
- readonly DOMAIN_OWNER: { bytes: Uint8Array };
91
94
  readonly DOMAIN: Maybe<string>;
95
+ readonly DOMAIN_OWNER: { bytes: Uint8Array };
92
96
  readonly DOMAIN_TARGET: Either<{ bytes: Uint8Array }, { bytes: Uint8Array }>;
93
97
  domains: {
94
98
  isEmpty(): boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"witnesses.js","sourceRoot":"","sources":["../src/witnesses.ts"],"names":[],"mappings":"AAIA,wCAAwC;AACxC,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC"}
@@ -1,4 +1,6 @@
1
+ import React from 'react';
1
2
  import type { PublicDataProvider } from '@midnight-ntwrk/midnight-js-types';
3
+ import type { DomainProfileData } from '../types.js';
2
4
  import { MidNamesError } from '../types.js';
3
5
  export type DomainProfileWidgetProps = {
4
6
  fullDomain: string;
@@ -6,5 +8,28 @@ export type DomainProfileWidgetProps = {
6
8
  className?: string;
7
9
  showStatus?: boolean;
8
10
  onError?: (error: MidNamesError) => void;
11
+ variant?: 'full' | 'compact' | 'inline' | 'minimal';
12
+ showBanner?: boolean;
13
+ showAvatar?: boolean;
14
+ showBio?: boolean;
15
+ showDomainInfo?: boolean;
16
+ showSocialLinks?: boolean;
17
+ showCopyButtons?: boolean;
18
+ fields?: ('target' | 'owner' | 'resolver')[];
19
+ customFields?: string[];
20
+ theme?: 'light' | 'dark' | 'auto';
21
+ borderRadius?: 'none' | 'sm' | 'md' | 'lg';
22
+ padding?: 'none' | 'sm' | 'md' | 'lg';
23
+ renderActions?: (data: DomainProfileData | null) => React.ReactNode;
24
+ onFieldClick?: (field: string, value: string) => void;
25
+ onCopySuccess?: (field: string, value: string) => void;
9
26
  };
10
- export declare function DomainProfileWidget({ fullDomain, publicDataProvider, className, showStatus, onError }: DomainProfileWidgetProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare function CopyableValue({ value, className, showCopy, onCopySuccess, onFieldClick, fieldName }: {
28
+ value?: string | null;
29
+ className?: string;
30
+ showCopy?: boolean;
31
+ onCopySuccess?: (field: string, value: string) => void;
32
+ onFieldClick?: (field: string, value: string) => void;
33
+ fieldName?: string;
34
+ }): import("react/jsx-runtime").JSX.Element;
35
+ export declare function DomainProfileWidget({ fullDomain, publicDataProvider, className, showStatus, onError, variant, showBanner, showAvatar, showBio, showDomainInfo, showSocialLinks, showCopyButtons, fields, customFields, theme, borderRadius, padding, renderActions, onFieldClick, onCopySuccess, }: DomainProfileWidgetProps): import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ function truncate(addr, head = 10, tail = 6) {
11
11
  return addr;
12
12
  return `${addr.slice(0, head)}…${addr.slice(-tail)}`;
13
13
  }
14
- function CopyableValue({ value, className }) {
14
+ export function CopyableValue({ value, className, showCopy = true, onCopySuccess, onFieldClick, fieldName }) {
15
15
  const [copied, setCopied] = useState(false);
16
16
  const [hovered, setHovered] = useState(false);
17
17
  if (!value)
@@ -21,15 +21,38 @@ function CopyableValue({ value, className }) {
21
21
  await navigator.clipboard.writeText(value);
22
22
  setCopied(true);
23
23
  setTimeout(() => setCopied(false), 1500);
24
+ if (onCopySuccess && fieldName) {
25
+ onCopySuccess(fieldName, value);
26
+ }
24
27
  }
25
28
  catch {
26
29
  // Silently fail if clipboard API is not available
27
30
  }
28
31
  };
29
- return (_jsxs("span", { className: `${className} midnames-copyable`, onClick: copy, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), title: value, children: [truncate(value), _jsx("span", { className: "midnames-copy-icon-container", children: copied ? (_jsx(Check, { className: "midnames-copy-icon midnames-copy-success" })) : (_jsx(Copy, { className: `midnames-copy-icon midnames-copy-hover ${hovered ? 'midnames-copy-visible' : 'midnames-copy-invisible'}` })) })] }));
32
+ const handleClick = () => {
33
+ if (onFieldClick && fieldName) {
34
+ onFieldClick(fieldName, value);
35
+ }
36
+ if (showCopy) {
37
+ copy();
38
+ }
39
+ };
40
+ return (_jsxs("span", { className: `${className} ${showCopy || onFieldClick ? 'midnames-copyable' : ''}`, onClick: handleClick, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), title: value, children: [truncate(value), showCopy && (_jsx("span", { className: "midnames-copy-icon-container", children: copied ? (_jsx(Check, { className: "midnames-copy-icon midnames-copy-success" })) : (_jsx(Copy, { className: `midnames-copy-icon midnames-copy-hover ${hovered ? 'midnames-copy-visible' : 'midnames-copy-invisible'}` })) }))] }));
30
41
  }
31
- export function DomainProfileWidget({ fullDomain, publicDataProvider, className, showStatus = true, onError }) {
32
- var _a, _b, _c, _d, _e;
42
+ export function DomainProfileWidget({ fullDomain, publicDataProvider, className, showStatus = true, onError,
43
+ // Variant and layout
44
+ variant = 'full',
45
+ // Visibility controls
46
+ showBanner = true, showAvatar = true, showBio = true, showDomainInfo = true, showSocialLinks = true, showCopyButtons = true,
47
+ // Field selection
48
+ fields = ['target', 'owner', 'resolver'], customFields = [],
49
+ // Styling
50
+ theme = 'auto', borderRadius = 'md', padding = 'md',
51
+ // Custom rendering
52
+ renderActions,
53
+ // Event callbacks
54
+ onFieldClick, onCopySuccess, }) {
55
+ var _a, _b, _c;
33
56
  const [loading, setLoading] = useState(false);
34
57
  const [data, setData] = useState(null);
35
58
  const [error, setError] = useState(null);
@@ -93,8 +116,50 @@ export function DomainProfileWidget({ fullDomain, publicDataProvider, className,
93
116
  return 'error';
94
117
  return (data === null || data === void 0 ? void 0 : data.info) ? 'registered' : 'available';
95
118
  }, [loading, data === null || data === void 0 ? void 0 : data.info, error]);
119
+ // Build CSS classes based on props
120
+ const cardClasses = useMemo(() => {
121
+ const classes = ['midnames-card'];
122
+ if (variant !== 'full') {
123
+ classes.push(`midnames-card-${variant}`);
124
+ }
125
+ if (theme !== 'auto') {
126
+ classes.push(`midnames-theme-${theme}`);
127
+ }
128
+ if (borderRadius !== 'md') {
129
+ classes.push(`midnames-border-${borderRadius}`);
130
+ }
131
+ if (padding !== 'md') {
132
+ classes.push(`midnames-padding-${padding}`);
133
+ }
134
+ if (className) {
135
+ classes.push(className);
136
+ }
137
+ return classes.join(' ');
138
+ }, [variant, theme, borderRadius, padding, className]);
139
+ // Filter fields to show
140
+ const fieldsToShow = useMemo(() => {
141
+ var _a, _b;
142
+ const fieldsData = [];
143
+ if (fields.includes('target')) {
144
+ fieldsData.push({ key: 'target', label: 'Resolved Target', value: resolvedTarget, fieldName: 'target' });
145
+ }
146
+ if (fields.includes('owner')) {
147
+ fieldsData.push({ key: 'owner', label: 'Owner', value: ((_a = data === null || data === void 0 ? void 0 : data.info) === null || _a === void 0 ? void 0 : _a.owner) || null, fieldName: 'owner' });
148
+ }
149
+ if (fields.includes('resolver')) {
150
+ fieldsData.push({ key: 'resolver', label: 'Resolver', value: ((_b = data === null || data === void 0 ? void 0 : data.info) === null || _b === void 0 ? void 0 : _b.resolver) || null, fieldName: 'resolver' });
151
+ }
152
+ // Add custom fields
153
+ customFields.forEach(fieldKey => {
154
+ const fieldValue = fieldsMap[fieldKey.toLowerCase()];
155
+ if (fieldValue) {
156
+ fieldsData.push({ key: fieldKey, label: fieldKey, value: fieldValue, fieldName: fieldKey });
157
+ }
158
+ });
159
+ return fieldsData;
160
+ }, [fields, customFields, resolvedTarget, data === null || data === void 0 ? void 0 : data.info, fieldsMap]);
96
161
  if (error && !loading) {
97
- return (_jsx("div", { className: `midnames-card ${className !== null && className !== void 0 ? className : ''}`, children: _jsxs("div", { className: "midnames-error", children: [_jsx("div", { className: "midnames-error-title", children: "Error loading domain" }), _jsx("div", { className: "midnames-error-message", children: error.message }), _jsxs("div", { className: "midnames-error-code", children: ["Code: ", error.code] })] }) }));
162
+ return (_jsx("div", { className: cardClasses, children: _jsxs("div", { className: "midnames-error", children: [_jsx("div", { className: "midnames-error-title", children: "Error loading domain" }), _jsx("div", { className: "midnames-error-message", children: error.message }), _jsxs("div", { className: "midnames-error-code", children: ["Code: ", error.code] })] }) }));
98
163
  }
99
- return (_jsxs("div", { className: `midnames-card ${className !== null && className !== void 0 ? className : ''}`, children: [bannerUrl && _jsx("img", { src: bannerUrl, alt: "", className: "midnames-banner" }), _jsxs("div", { className: "midnames-header", children: [_jsx("div", { className: "midnames-avatar", children: avatarUrl ? (_jsx("img", { src: avatarUrl, alt: "", onError: (e) => (e.currentTarget.style.display = 'none') })) : (_jsx("span", { children: (_c = (_b = (_a = (displayName || (data === null || data === void 0 ? void 0 : data.fullDomain) || '?')[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : '?' })) }), _jsxs("div", { className: "midnames-ident", children: [_jsx("div", { className: "midnames-name", children: displayName || (data === null || data === void 0 ? void 0 : data.fullDomain) || fullDomain }), _jsx("div", { className: "midnames-domain", children: (data === null || data === void 0 ? void 0 : data.fullDomain) || fullDomain })] }), showStatus && (_jsx("div", { className: `midnames-status midnames-status-${status}`, children: loading ? 'Checking…' : status === 'registered' ? 'Registered' : status === 'available' ? 'Available' : status === 'error' ? 'Error' : 'Unknown' }))] }), bio && _jsx("p", { className: "midnames-bio", children: bio }), _jsxs("div", { className: "midnames-grid", children: [_jsxs("div", { className: "midnames-box", children: [_jsx("div", { className: "midnames-box-label", children: "Resolved Target" }), _jsx(CopyableValue, { value: resolvedTarget, className: "midnames-box-value" })] }), _jsxs("div", { className: "midnames-box", children: [_jsx("div", { className: "midnames-box-label", children: "Owner" }), _jsx(CopyableValue, { value: (_d = data === null || data === void 0 ? void 0 : data.info) === null || _d === void 0 ? void 0 : _d.owner, className: "midnames-box-value" })] }), _jsxs("div", { className: "midnames-box", children: [_jsx("div", { className: "midnames-box-label", children: "Resolver" }), _jsx(CopyableValue, { value: (_e = data === null || data === void 0 ? void 0 : data.info) === null || _e === void 0 ? void 0 : _e.resolver, className: "midnames-box-value" })] })] }), _jsxs("div", { className: "midnames-links", children: [website && (_jsx("a", { className: "midnames-chip", href: website.startsWith('http') ? website : `https://${website}`, target: "_blank", rel: "noreferrer", children: website.replace(/^https?:\/\//, '') })), twitter && (_jsxs("a", { className: "midnames-chip", href: `https://x.com/${twitter}`, target: "_blank", rel: "noreferrer", children: ["@", twitter] })), github && (_jsx("a", { className: "midnames-chip", href: `https://github.com/${github}`, target: "_blank", rel: "noreferrer", children: github })), location && _jsx("span", { className: "midnames-chip", children: location })] })] }));
164
+ return (_jsxs("div", { className: cardClasses, children: [showBanner && bannerUrl && _jsx("img", { src: bannerUrl, alt: "", className: "midnames-banner" }), _jsxs("div", { className: "midnames-header", children: [showAvatar && (_jsx("div", { className: "midnames-avatar", children: avatarUrl ? (_jsx("img", { src: avatarUrl, alt: "", onError: (e) => (e.currentTarget.style.display = 'none') })) : (_jsx("span", { children: (_c = (_b = (_a = (displayName || (data === null || data === void 0 ? void 0 : data.fullDomain) || '?')[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : '?' })) })), _jsxs("div", { className: "midnames-ident", children: [_jsx("div", { className: "midnames-name", children: displayName || (data === null || data === void 0 ? void 0 : data.fullDomain) || fullDomain }), variant !== 'minimal' && _jsx("div", { className: "midnames-domain", children: (data === null || data === void 0 ? void 0 : data.fullDomain) || fullDomain })] }), showStatus && (_jsx("div", { className: `midnames-status midnames-status-${status}`, children: loading ? 'Checking…' : status === 'registered' ? 'Registered' : status === 'available' ? 'Available' : status === 'error' ? 'Error' : 'Unknown' }))] }), showBio && bio && _jsx("p", { className: "midnames-bio", children: bio }), showDomainInfo && fieldsToShow.length > 0 && (_jsx("div", { className: "midnames-grid", children: fieldsToShow.map((field) => (_jsxs("div", { className: "midnames-box", children: [_jsx("div", { className: "midnames-box-label", children: field.label }), _jsx(CopyableValue, { value: field.value, className: "midnames-box-value", showCopy: showCopyButtons, onCopySuccess: onCopySuccess, onFieldClick: onFieldClick, fieldName: field.fieldName })] }, field.key))) })), showSocialLinks && (website || twitter || github || location) && (_jsxs("div", { className: "midnames-links", children: [website && (_jsx("a", { className: "midnames-chip", href: website.startsWith('http') ? website : `https://${website}`, target: "_blank", rel: "noreferrer", children: website.replace(/^https?:\/\//, '') })), twitter && (_jsxs("a", { className: "midnames-chip", href: `https://x.com/${twitter}`, target: "_blank", rel: "noreferrer", children: ["@", twitter] })), github && (_jsx("a", { className: "midnames-chip", href: `https://github.com/${github}`, target: "_blank", rel: "noreferrer", children: github })), location && _jsx("span", { className: "midnames-chip", children: location })] })), renderActions && (_jsx("div", { className: "midnames-actions", children: renderActions(data) }))] }));
100
165
  }