@medialane/sdk 0.158.0 → 0.160.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.
- package/dist/{chunk-OUPVVMLK.cjs → chunk-H7I6TEOA.cjs} +5 -4
- package/dist/chunk-H7I6TEOA.cjs.map +1 -0
- package/dist/{chunk-3IJQNNFE.cjs → chunk-LXPVVK7R.cjs} +36 -22
- package/dist/chunk-LXPVVK7R.cjs.map +1 -0
- package/dist/{chunk-3PZUSEAW.js → chunk-PBJLHXDB.js} +5 -4
- package/dist/chunk-PBJLHXDB.js.map +1 -0
- package/dist/{chunk-SEBUPNF4.js → chunk-R6EJAMY3.js} +26 -19
- package/dist/chunk-R6EJAMY3.js.map +1 -0
- package/dist/{errors-D037rFnb.d.ts → errors-6Aarmz0V.d.cts} +3 -15
- package/dist/{errors-D_k2He89.d.cts → errors-BJl2TojD.d.ts} +3 -15
- package/dist/evm/index.cjs +3 -3
- package/dist/evm/index.d.cts +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/index.js +1 -1
- package/dist/index.cjs +98 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -9
- package/dist/index.d.ts +6 -9
- package/dist/index.js +3 -23
- package/dist/index.js.map +1 -1
- package/dist/solana/index.cjs +2 -2
- package/dist/solana/index.d.cts +1 -1
- package/dist/solana/index.d.ts +1 -1
- package/dist/solana/index.js +1 -1
- package/dist/starknet/index.cjs +993 -221
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +605 -152
- package/dist/starknet/index.d.ts +605 -152
- package/dist/starknet/index.js +916 -154
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.cjs +2 -2
- package/dist/stellar/index.d.cts +1 -1
- package/dist/stellar/index.d.ts +1 -1
- package/dist/stellar/index.js +1 -1
- package/dist/{types-CO6YYHVA.d.cts → types-PPshMWr7.d.cts} +1 -0
- package/dist/{types-CO6YYHVA.d.ts → types-PPshMWr7.d.ts} +1 -0
- package/package.json +1 -1
- package/dist/chunk-3IJQNNFE.cjs.map +0 -1
- package/dist/chunk-3PZUSEAW.js.map +0 -1
- package/dist/chunk-OUPVVMLK.cjs.map +0 -1
- package/dist/chunk-SEBUPNF4.js.map +0 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkLXPVVK7R_cjs = require('../chunk-LXPVVK7R.cjs');
|
|
4
|
+
var chunkH7I6TEOA_cjs = require('../chunk-H7I6TEOA.cjs');
|
|
5
5
|
var starknet = require('starknet');
|
|
6
6
|
var hkdf_js = require('@noble/hashes/hkdf.js');
|
|
7
7
|
var sha2_js = require('@noble/hashes/sha2.js');
|
|
@@ -33,7 +33,7 @@ function getChainId(config) {
|
|
|
33
33
|
return starknet.constants.StarknetChainId.SN_MAIN;
|
|
34
34
|
}
|
|
35
35
|
function resolveToken(currency) {
|
|
36
|
-
const token =
|
|
36
|
+
const token = chunkLXPVVK7R_cjs.SUPPORTED_TOKENS.find(
|
|
37
37
|
(t) => t.symbol === currency.toUpperCase() || t.address.toLowerCase() === currency.toLowerCase()
|
|
38
38
|
);
|
|
39
39
|
if (!token) throw new MedialaneError(`Unsupported currency: ${currency}`, "INVALID_PARAMS");
|
|
@@ -44,7 +44,7 @@ function getProvider(config) {
|
|
|
44
44
|
let p = _providerCache.get(config);
|
|
45
45
|
if (!p) {
|
|
46
46
|
const urls = [config.rpcUrl];
|
|
47
|
-
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch:
|
|
47
|
+
p = new starknet.RpcProvider({ nodeUrl: urls[0], baseFetch: chunkLXPVVK7R_cjs.createFailoverFetch(urls) });
|
|
48
48
|
_providerCache.set(config, p);
|
|
49
49
|
}
|
|
50
50
|
return p;
|
|
@@ -525,146 +525,833 @@ var IPMarketplaceABI = [
|
|
|
525
525
|
// src/starknet/abis/popCollection.ts
|
|
526
526
|
var POPCollectionABI = [
|
|
527
527
|
{
|
|
528
|
-
type: "
|
|
529
|
-
name: "
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
528
|
+
"type": "impl",
|
|
529
|
+
"name": "ERC721Impl",
|
|
530
|
+
"interface_name": "openzeppelin_interfaces::token::erc721::IERC721"
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"type": "struct",
|
|
534
|
+
"name": "core::integer::u256",
|
|
535
|
+
"members": [
|
|
536
|
+
{
|
|
537
|
+
"name": "low",
|
|
538
|
+
"type": "core::integer::u128"
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
"name": "high",
|
|
542
|
+
"type": "core::integer::u128"
|
|
543
|
+
}
|
|
544
|
+
]
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"type": "struct",
|
|
548
|
+
"name": "core::array::Span::<core::felt252>",
|
|
549
|
+
"members": [
|
|
550
|
+
{
|
|
551
|
+
"name": "snapshot",
|
|
552
|
+
"type": "@core::array::Array::<core::felt252>"
|
|
553
|
+
}
|
|
554
|
+
]
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"type": "enum",
|
|
558
|
+
"name": "core::bool",
|
|
559
|
+
"variants": [
|
|
560
|
+
{
|
|
561
|
+
"name": "False",
|
|
562
|
+
"type": "()"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"name": "True",
|
|
566
|
+
"type": "()"
|
|
567
|
+
}
|
|
568
|
+
]
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"type": "interface",
|
|
572
|
+
"name": "openzeppelin_interfaces::token::erc721::IERC721",
|
|
573
|
+
"items": [
|
|
574
|
+
{
|
|
575
|
+
"type": "function",
|
|
576
|
+
"name": "balance_of",
|
|
577
|
+
"inputs": [
|
|
578
|
+
{
|
|
579
|
+
"name": "account",
|
|
580
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
581
|
+
}
|
|
582
|
+
],
|
|
583
|
+
"outputs": [
|
|
584
|
+
{
|
|
585
|
+
"type": "core::integer::u256"
|
|
586
|
+
}
|
|
587
|
+
],
|
|
588
|
+
"state_mutability": "view"
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
"type": "function",
|
|
592
|
+
"name": "owner_of",
|
|
593
|
+
"inputs": [
|
|
594
|
+
{
|
|
595
|
+
"name": "token_id",
|
|
596
|
+
"type": "core::integer::u256"
|
|
597
|
+
}
|
|
598
|
+
],
|
|
599
|
+
"outputs": [
|
|
600
|
+
{
|
|
601
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
602
|
+
}
|
|
603
|
+
],
|
|
604
|
+
"state_mutability": "view"
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
"type": "function",
|
|
608
|
+
"name": "safe_transfer_from",
|
|
609
|
+
"inputs": [
|
|
610
|
+
{
|
|
611
|
+
"name": "from",
|
|
612
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"name": "to",
|
|
616
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"name": "token_id",
|
|
620
|
+
"type": "core::integer::u256"
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"name": "data",
|
|
624
|
+
"type": "core::array::Span::<core::felt252>"
|
|
625
|
+
}
|
|
626
|
+
],
|
|
627
|
+
"outputs": [],
|
|
628
|
+
"state_mutability": "external"
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"type": "function",
|
|
632
|
+
"name": "transfer_from",
|
|
633
|
+
"inputs": [
|
|
634
|
+
{
|
|
635
|
+
"name": "from",
|
|
636
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"name": "to",
|
|
640
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
"name": "token_id",
|
|
644
|
+
"type": "core::integer::u256"
|
|
645
|
+
}
|
|
646
|
+
],
|
|
647
|
+
"outputs": [],
|
|
648
|
+
"state_mutability": "external"
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
"type": "function",
|
|
652
|
+
"name": "approve",
|
|
653
|
+
"inputs": [
|
|
654
|
+
{
|
|
655
|
+
"name": "to",
|
|
656
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "token_id",
|
|
660
|
+
"type": "core::integer::u256"
|
|
661
|
+
}
|
|
662
|
+
],
|
|
663
|
+
"outputs": [],
|
|
664
|
+
"state_mutability": "external"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
"type": "function",
|
|
668
|
+
"name": "set_approval_for_all",
|
|
669
|
+
"inputs": [
|
|
670
|
+
{
|
|
671
|
+
"name": "operator",
|
|
672
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"name": "approved",
|
|
676
|
+
"type": "core::bool"
|
|
677
|
+
}
|
|
678
|
+
],
|
|
679
|
+
"outputs": [],
|
|
680
|
+
"state_mutability": "external"
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
"type": "function",
|
|
684
|
+
"name": "get_approved",
|
|
685
|
+
"inputs": [
|
|
686
|
+
{
|
|
687
|
+
"name": "token_id",
|
|
688
|
+
"type": "core::integer::u256"
|
|
689
|
+
}
|
|
690
|
+
],
|
|
691
|
+
"outputs": [
|
|
692
|
+
{
|
|
693
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
694
|
+
}
|
|
695
|
+
],
|
|
696
|
+
"state_mutability": "view"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"type": "function",
|
|
700
|
+
"name": "is_approved_for_all",
|
|
701
|
+
"inputs": [
|
|
702
|
+
{
|
|
703
|
+
"name": "owner",
|
|
704
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"name": "operator",
|
|
708
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
709
|
+
}
|
|
710
|
+
],
|
|
711
|
+
"outputs": [
|
|
712
|
+
{
|
|
713
|
+
"type": "core::bool"
|
|
714
|
+
}
|
|
715
|
+
],
|
|
716
|
+
"state_mutability": "view"
|
|
717
|
+
}
|
|
718
|
+
]
|
|
719
|
+
},
|
|
720
|
+
{
|
|
721
|
+
"type": "impl",
|
|
722
|
+
"name": "ERC721MetadataImpl",
|
|
723
|
+
"interface_name": "openzeppelin_interfaces::token::erc721::IERC721Metadata"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
"type": "struct",
|
|
727
|
+
"name": "core::byte_array::ByteArray",
|
|
728
|
+
"members": [
|
|
729
|
+
{
|
|
730
|
+
"name": "data",
|
|
731
|
+
"type": "core::array::Array::<core::bytes_31::bytes31>"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"name": "pending_word",
|
|
735
|
+
"type": "core::felt252"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"name": "pending_word_len",
|
|
739
|
+
"type": "core::internal::bounded_int::BoundedInt::<0, 30>"
|
|
740
|
+
}
|
|
741
|
+
]
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
"type": "interface",
|
|
745
|
+
"name": "openzeppelin_interfaces::token::erc721::IERC721Metadata",
|
|
746
|
+
"items": [
|
|
747
|
+
{
|
|
748
|
+
"type": "function",
|
|
749
|
+
"name": "name",
|
|
750
|
+
"inputs": [],
|
|
751
|
+
"outputs": [
|
|
752
|
+
{
|
|
753
|
+
"type": "core::byte_array::ByteArray"
|
|
754
|
+
}
|
|
755
|
+
],
|
|
756
|
+
"state_mutability": "view"
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"type": "function",
|
|
760
|
+
"name": "symbol",
|
|
761
|
+
"inputs": [],
|
|
762
|
+
"outputs": [
|
|
763
|
+
{
|
|
764
|
+
"type": "core::byte_array::ByteArray"
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
"state_mutability": "view"
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"type": "function",
|
|
771
|
+
"name": "token_uri",
|
|
772
|
+
"inputs": [
|
|
773
|
+
{
|
|
774
|
+
"name": "token_id",
|
|
775
|
+
"type": "core::integer::u256"
|
|
776
|
+
}
|
|
777
|
+
],
|
|
778
|
+
"outputs": [
|
|
779
|
+
{
|
|
780
|
+
"type": "core::byte_array::ByteArray"
|
|
781
|
+
}
|
|
782
|
+
],
|
|
783
|
+
"state_mutability": "view"
|
|
784
|
+
}
|
|
785
|
+
]
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"type": "impl",
|
|
789
|
+
"name": "ERC5192Impl",
|
|
790
|
+
"interface_name": "pop_protocol::interfaces::IERC5192"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"type": "interface",
|
|
794
|
+
"name": "pop_protocol::interfaces::IERC5192",
|
|
795
|
+
"items": [
|
|
796
|
+
{
|
|
797
|
+
"type": "function",
|
|
798
|
+
"name": "locked",
|
|
799
|
+
"inputs": [
|
|
800
|
+
{
|
|
801
|
+
"name": "token_id",
|
|
802
|
+
"type": "core::integer::u256"
|
|
803
|
+
}
|
|
804
|
+
],
|
|
805
|
+
"outputs": [
|
|
806
|
+
{
|
|
807
|
+
"type": "core::bool"
|
|
808
|
+
}
|
|
809
|
+
],
|
|
810
|
+
"state_mutability": "view"
|
|
811
|
+
}
|
|
812
|
+
]
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"type": "impl",
|
|
816
|
+
"name": "POPCollectionImpl",
|
|
817
|
+
"interface_name": "pop_protocol::interfaces::IPOPCollection"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"type": "interface",
|
|
821
|
+
"name": "pop_protocol::interfaces::IPOPCollection",
|
|
822
|
+
"items": [
|
|
823
|
+
{
|
|
824
|
+
"type": "function",
|
|
825
|
+
"name": "set_allowlist_root",
|
|
826
|
+
"inputs": [
|
|
827
|
+
{
|
|
828
|
+
"name": "root",
|
|
829
|
+
"type": "core::felt252"
|
|
830
|
+
}
|
|
831
|
+
],
|
|
832
|
+
"outputs": [],
|
|
833
|
+
"state_mutability": "external"
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
"type": "function",
|
|
837
|
+
"name": "claim",
|
|
838
|
+
"inputs": [
|
|
839
|
+
{
|
|
840
|
+
"name": "proof",
|
|
841
|
+
"type": "core::array::Span::<core::felt252>"
|
|
842
|
+
}
|
|
843
|
+
],
|
|
844
|
+
"outputs": [],
|
|
845
|
+
"state_mutability": "external"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"type": "function",
|
|
849
|
+
"name": "issue",
|
|
850
|
+
"inputs": [
|
|
851
|
+
{
|
|
852
|
+
"name": "recipient",
|
|
853
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"name": "token_uri",
|
|
857
|
+
"type": "core::byte_array::ByteArray"
|
|
858
|
+
}
|
|
859
|
+
],
|
|
860
|
+
"outputs": [],
|
|
861
|
+
"state_mutability": "external"
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"type": "function",
|
|
865
|
+
"name": "burn",
|
|
866
|
+
"inputs": [
|
|
867
|
+
{
|
|
868
|
+
"name": "token_id",
|
|
869
|
+
"type": "core::integer::u256"
|
|
870
|
+
}
|
|
871
|
+
],
|
|
872
|
+
"outputs": [],
|
|
873
|
+
"state_mutability": "external"
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"type": "function",
|
|
877
|
+
"name": "organizer",
|
|
878
|
+
"inputs": [],
|
|
879
|
+
"outputs": [
|
|
880
|
+
{
|
|
881
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
882
|
+
}
|
|
883
|
+
],
|
|
884
|
+
"state_mutability": "view"
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
"type": "function",
|
|
888
|
+
"name": "allowlist_root",
|
|
889
|
+
"inputs": [],
|
|
890
|
+
"outputs": [
|
|
891
|
+
{
|
|
892
|
+
"type": "core::felt252"
|
|
893
|
+
}
|
|
894
|
+
],
|
|
895
|
+
"state_mutability": "view"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
"type": "function",
|
|
899
|
+
"name": "claim_end_time",
|
|
900
|
+
"inputs": [],
|
|
901
|
+
"outputs": [
|
|
902
|
+
{
|
|
903
|
+
"type": "core::integer::u64"
|
|
904
|
+
}
|
|
905
|
+
],
|
|
906
|
+
"state_mutability": "view"
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"type": "function",
|
|
910
|
+
"name": "has_claimed",
|
|
911
|
+
"inputs": [
|
|
912
|
+
{
|
|
913
|
+
"name": "address",
|
|
914
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
915
|
+
}
|
|
916
|
+
],
|
|
917
|
+
"outputs": [
|
|
918
|
+
{
|
|
919
|
+
"type": "core::bool"
|
|
920
|
+
}
|
|
921
|
+
],
|
|
922
|
+
"state_mutability": "view"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"type": "function",
|
|
926
|
+
"name": "total_issued",
|
|
927
|
+
"inputs": [],
|
|
928
|
+
"outputs": [
|
|
929
|
+
{
|
|
930
|
+
"type": "core::integer::u256"
|
|
931
|
+
}
|
|
932
|
+
],
|
|
933
|
+
"state_mutability": "view"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
"type": "function",
|
|
937
|
+
"name": "version",
|
|
938
|
+
"inputs": [],
|
|
939
|
+
"outputs": [
|
|
940
|
+
{
|
|
941
|
+
"type": "core::felt252"
|
|
942
|
+
}
|
|
943
|
+
],
|
|
944
|
+
"state_mutability": "view"
|
|
945
|
+
}
|
|
534
946
|
]
|
|
535
947
|
},
|
|
536
948
|
{
|
|
537
|
-
type: "
|
|
538
|
-
name: "
|
|
539
|
-
|
|
540
|
-
outputs: [],
|
|
541
|
-
state_mutability: "external"
|
|
949
|
+
"type": "impl",
|
|
950
|
+
"name": "SRC5Impl",
|
|
951
|
+
"interface_name": "openzeppelin_interfaces::introspection::ISRC5"
|
|
542
952
|
},
|
|
543
953
|
{
|
|
544
|
-
type: "
|
|
545
|
-
name: "
|
|
546
|
-
|
|
547
|
-
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
954
|
+
"type": "interface",
|
|
955
|
+
"name": "openzeppelin_interfaces::introspection::ISRC5",
|
|
956
|
+
"items": [
|
|
957
|
+
{
|
|
958
|
+
"type": "function",
|
|
959
|
+
"name": "supports_interface",
|
|
960
|
+
"inputs": [
|
|
961
|
+
{
|
|
962
|
+
"name": "interface_id",
|
|
963
|
+
"type": "core::felt252"
|
|
964
|
+
}
|
|
965
|
+
],
|
|
966
|
+
"outputs": [
|
|
967
|
+
{
|
|
968
|
+
"type": "core::bool"
|
|
969
|
+
}
|
|
970
|
+
],
|
|
971
|
+
"state_mutability": "view"
|
|
972
|
+
}
|
|
973
|
+
]
|
|
552
974
|
},
|
|
553
975
|
{
|
|
554
|
-
type: "
|
|
555
|
-
name: "
|
|
556
|
-
inputs: [
|
|
557
|
-
|
|
558
|
-
|
|
976
|
+
"type": "constructor",
|
|
977
|
+
"name": "constructor",
|
|
978
|
+
"inputs": [
|
|
979
|
+
{
|
|
980
|
+
"name": "name",
|
|
981
|
+
"type": "core::byte_array::ByteArray"
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
"name": "symbol",
|
|
985
|
+
"type": "core::byte_array::ByteArray"
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
"name": "base_uri",
|
|
989
|
+
"type": "core::byte_array::ByteArray"
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"name": "organizer",
|
|
993
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
"name": "claim_end_time",
|
|
997
|
+
"type": "core::integer::u64"
|
|
998
|
+
}
|
|
999
|
+
]
|
|
559
1000
|
},
|
|
560
1001
|
{
|
|
561
|
-
type: "
|
|
562
|
-
name: "
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
1002
|
+
"type": "event",
|
|
1003
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
|
|
1004
|
+
"kind": "struct",
|
|
1005
|
+
"members": [
|
|
1006
|
+
{
|
|
1007
|
+
"name": "from",
|
|
1008
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1009
|
+
"kind": "key"
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
"name": "to",
|
|
1013
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1014
|
+
"kind": "key"
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
"name": "token_id",
|
|
1018
|
+
"type": "core::integer::u256",
|
|
1019
|
+
"kind": "key"
|
|
1020
|
+
}
|
|
1021
|
+
]
|
|
566
1022
|
},
|
|
567
1023
|
{
|
|
568
|
-
type: "
|
|
569
|
-
name: "
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
1024
|
+
"type": "event",
|
|
1025
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
|
|
1026
|
+
"kind": "struct",
|
|
1027
|
+
"members": [
|
|
1028
|
+
{
|
|
1029
|
+
"name": "owner",
|
|
1030
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1031
|
+
"kind": "key"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
"name": "approved",
|
|
1035
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1036
|
+
"kind": "key"
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
"name": "token_id",
|
|
1040
|
+
"type": "core::integer::u256",
|
|
1041
|
+
"kind": "key"
|
|
1042
|
+
}
|
|
1043
|
+
]
|
|
573
1044
|
},
|
|
574
1045
|
{
|
|
575
|
-
type: "
|
|
576
|
-
name: "
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
1046
|
+
"type": "event",
|
|
1047
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
|
|
1048
|
+
"kind": "struct",
|
|
1049
|
+
"members": [
|
|
1050
|
+
{
|
|
1051
|
+
"name": "owner",
|
|
1052
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1053
|
+
"kind": "key"
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
"name": "operator",
|
|
1057
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1058
|
+
"kind": "key"
|
|
1059
|
+
},
|
|
1060
|
+
{
|
|
1061
|
+
"name": "approved",
|
|
1062
|
+
"type": "core::bool",
|
|
1063
|
+
"kind": "data"
|
|
1064
|
+
}
|
|
1065
|
+
]
|
|
583
1066
|
},
|
|
584
1067
|
{
|
|
585
|
-
type: "
|
|
586
|
-
name: "
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
1068
|
+
"type": "event",
|
|
1069
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
|
|
1070
|
+
"kind": "enum",
|
|
1071
|
+
"variants": [
|
|
1072
|
+
{
|
|
1073
|
+
"name": "Transfer",
|
|
1074
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
|
|
1075
|
+
"kind": "nested"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"name": "Approval",
|
|
1079
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
|
|
1080
|
+
"kind": "nested"
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
"name": "ApprovalForAll",
|
|
1084
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
|
|
1085
|
+
"kind": "nested"
|
|
1086
|
+
}
|
|
1087
|
+
]
|
|
590
1088
|
},
|
|
591
1089
|
{
|
|
592
|
-
type: "
|
|
593
|
-
name: "
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
state_mutability: "view"
|
|
1090
|
+
"type": "event",
|
|
1091
|
+
"name": "openzeppelin_introspection::src5::SRC5Component::Event",
|
|
1092
|
+
"kind": "enum",
|
|
1093
|
+
"variants": []
|
|
597
1094
|
},
|
|
598
1095
|
{
|
|
599
|
-
type: "
|
|
600
|
-
name: "
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
1096
|
+
"type": "event",
|
|
1097
|
+
"name": "pop_protocol::events::AllowlistRootSet",
|
|
1098
|
+
"kind": "struct",
|
|
1099
|
+
"members": [
|
|
1100
|
+
{
|
|
1101
|
+
"name": "root",
|
|
1102
|
+
"type": "core::felt252",
|
|
1103
|
+
"kind": "data"
|
|
1104
|
+
}
|
|
1105
|
+
]
|
|
604
1106
|
},
|
|
605
1107
|
{
|
|
606
|
-
type: "
|
|
607
|
-
name: "
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
1108
|
+
"type": "event",
|
|
1109
|
+
"name": "pop_protocol::events::TokenURISet",
|
|
1110
|
+
"kind": "struct",
|
|
1111
|
+
"members": [
|
|
1112
|
+
{
|
|
1113
|
+
"name": "token_id",
|
|
1114
|
+
"type": "core::integer::u256",
|
|
1115
|
+
"kind": "key"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
"name": "uri",
|
|
1119
|
+
"type": "core::byte_array::ByteArray",
|
|
1120
|
+
"kind": "data"
|
|
1121
|
+
}
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
"type": "event",
|
|
1126
|
+
"name": "pop_protocol::events::Locked",
|
|
1127
|
+
"kind": "struct",
|
|
1128
|
+
"members": [
|
|
1129
|
+
{
|
|
1130
|
+
"name": "token_id",
|
|
1131
|
+
"type": "core::integer::u256",
|
|
1132
|
+
"kind": "data"
|
|
1133
|
+
}
|
|
1134
|
+
]
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
"type": "event",
|
|
1138
|
+
"name": "pop_protocol::pop_collection::POPCollection::Event",
|
|
1139
|
+
"kind": "enum",
|
|
1140
|
+
"variants": [
|
|
1141
|
+
{
|
|
1142
|
+
"name": "ERC721Event",
|
|
1143
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
|
|
1144
|
+
"kind": "flat"
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"name": "SRC5Event",
|
|
1148
|
+
"type": "openzeppelin_introspection::src5::SRC5Component::Event",
|
|
1149
|
+
"kind": "flat"
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
"name": "AllowlistRootSet",
|
|
1153
|
+
"type": "pop_protocol::events::AllowlistRootSet",
|
|
1154
|
+
"kind": "nested"
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"name": "TokenURISet",
|
|
1158
|
+
"type": "pop_protocol::events::TokenURISet",
|
|
1159
|
+
"kind": "nested"
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
"name": "Locked",
|
|
1163
|
+
"type": "pop_protocol::events::Locked",
|
|
1164
|
+
"kind": "nested"
|
|
1165
|
+
}
|
|
1166
|
+
]
|
|
611
1167
|
}
|
|
612
1168
|
];
|
|
613
1169
|
|
|
614
1170
|
// src/starknet/abis/popFactory.ts
|
|
615
1171
|
var POPFactoryABI = [
|
|
616
1172
|
{
|
|
617
|
-
type: "
|
|
618
|
-
name: "
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
1173
|
+
"type": "impl",
|
|
1174
|
+
"name": "POPFactoryImpl",
|
|
1175
|
+
"interface_name": "pop_protocol::interfaces::IPOPFactory"
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
"type": "struct",
|
|
1179
|
+
"name": "core::byte_array::ByteArray",
|
|
1180
|
+
"members": [
|
|
1181
|
+
{
|
|
1182
|
+
"name": "data",
|
|
1183
|
+
"type": "core::array::Array::<core::bytes_31::bytes31>"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"name": "pending_word",
|
|
1187
|
+
"type": "core::felt252"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
"name": "pending_word_len",
|
|
1191
|
+
"type": "core::internal::bounded_int::BoundedInt::<0, 30>"
|
|
1192
|
+
}
|
|
623
1193
|
]
|
|
624
1194
|
},
|
|
625
1195
|
{
|
|
626
|
-
type: "
|
|
627
|
-
name: "
|
|
628
|
-
|
|
629
|
-
{
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
{
|
|
634
|
-
|
|
635
|
-
|
|
1196
|
+
"type": "struct",
|
|
1197
|
+
"name": "core::integer::u256",
|
|
1198
|
+
"members": [
|
|
1199
|
+
{
|
|
1200
|
+
"name": "low",
|
|
1201
|
+
"type": "core::integer::u128"
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
"name": "high",
|
|
1205
|
+
"type": "core::integer::u128"
|
|
1206
|
+
}
|
|
636
1207
|
]
|
|
637
1208
|
},
|
|
638
1209
|
{
|
|
639
|
-
type: "
|
|
640
|
-
name: "
|
|
641
|
-
|
|
642
|
-
{
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
1210
|
+
"type": "interface",
|
|
1211
|
+
"name": "pop_protocol::interfaces::IPOPFactory",
|
|
1212
|
+
"items": [
|
|
1213
|
+
{
|
|
1214
|
+
"type": "function",
|
|
1215
|
+
"name": "create_collection",
|
|
1216
|
+
"inputs": [
|
|
1217
|
+
{
|
|
1218
|
+
"name": "name",
|
|
1219
|
+
"type": "core::byte_array::ByteArray"
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
"name": "symbol",
|
|
1223
|
+
"type": "core::byte_array::ByteArray"
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
"name": "base_uri",
|
|
1227
|
+
"type": "core::byte_array::ByteArray"
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
"name": "claim_end_time",
|
|
1231
|
+
"type": "core::integer::u64"
|
|
1232
|
+
}
|
|
1233
|
+
],
|
|
1234
|
+
"outputs": [
|
|
1235
|
+
{
|
|
1236
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
1237
|
+
}
|
|
1238
|
+
],
|
|
1239
|
+
"state_mutability": "external"
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
"type": "function",
|
|
1243
|
+
"name": "get_collection_address",
|
|
1244
|
+
"inputs": [
|
|
1245
|
+
{
|
|
1246
|
+
"name": "collection_id",
|
|
1247
|
+
"type": "core::integer::u256"
|
|
1248
|
+
}
|
|
1249
|
+
],
|
|
1250
|
+
"outputs": [
|
|
1251
|
+
{
|
|
1252
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
1253
|
+
}
|
|
1254
|
+
],
|
|
1255
|
+
"state_mutability": "view"
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
"type": "function",
|
|
1259
|
+
"name": "get_last_collection_id",
|
|
1260
|
+
"inputs": [],
|
|
1261
|
+
"outputs": [
|
|
1262
|
+
{
|
|
1263
|
+
"type": "core::integer::u256"
|
|
1264
|
+
}
|
|
1265
|
+
],
|
|
1266
|
+
"state_mutability": "view"
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
"type": "function",
|
|
1270
|
+
"name": "get_collection_class_hash",
|
|
1271
|
+
"inputs": [],
|
|
1272
|
+
"outputs": [
|
|
1273
|
+
{
|
|
1274
|
+
"type": "core::starknet::class_hash::ClassHash"
|
|
1275
|
+
}
|
|
1276
|
+
],
|
|
1277
|
+
"state_mutability": "view"
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
"type": "function",
|
|
1281
|
+
"name": "version",
|
|
1282
|
+
"inputs": [],
|
|
1283
|
+
"outputs": [
|
|
1284
|
+
{
|
|
1285
|
+
"type": "core::felt252"
|
|
1286
|
+
}
|
|
1287
|
+
],
|
|
1288
|
+
"state_mutability": "view"
|
|
1289
|
+
}
|
|
1290
|
+
]
|
|
650
1291
|
},
|
|
651
1292
|
{
|
|
652
|
-
type: "
|
|
653
|
-
name: "
|
|
654
|
-
inputs: [
|
|
655
|
-
{
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
state_mutability: "external"
|
|
1293
|
+
"type": "constructor",
|
|
1294
|
+
"name": "constructor",
|
|
1295
|
+
"inputs": [
|
|
1296
|
+
{
|
|
1297
|
+
"name": "collection_class_hash",
|
|
1298
|
+
"type": "core::starknet::class_hash::ClassHash"
|
|
1299
|
+
}
|
|
1300
|
+
]
|
|
661
1301
|
},
|
|
662
1302
|
{
|
|
663
|
-
type: "
|
|
664
|
-
name: "
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
1303
|
+
"type": "event",
|
|
1304
|
+
"name": "pop_protocol::events::CollectionCreated",
|
|
1305
|
+
"kind": "struct",
|
|
1306
|
+
"members": [
|
|
1307
|
+
{
|
|
1308
|
+
"name": "collection_id",
|
|
1309
|
+
"type": "core::integer::u256",
|
|
1310
|
+
"kind": "key"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
"name": "organizer",
|
|
1314
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1315
|
+
"kind": "key"
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
"name": "collection_address",
|
|
1319
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1320
|
+
"kind": "data"
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
"name": "name",
|
|
1324
|
+
"type": "core::byte_array::ByteArray",
|
|
1325
|
+
"kind": "data"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
"name": "symbol",
|
|
1329
|
+
"type": "core::byte_array::ByteArray",
|
|
1330
|
+
"kind": "data"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
"name": "base_uri",
|
|
1334
|
+
"type": "core::byte_array::ByteArray",
|
|
1335
|
+
"kind": "data"
|
|
1336
|
+
},
|
|
1337
|
+
{
|
|
1338
|
+
"name": "claim_end_time",
|
|
1339
|
+
"type": "core::integer::u64",
|
|
1340
|
+
"kind": "data"
|
|
1341
|
+
}
|
|
1342
|
+
]
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
"type": "event",
|
|
1346
|
+
"name": "pop_protocol::pop_factory::POPFactory::Event",
|
|
1347
|
+
"kind": "enum",
|
|
1348
|
+
"variants": [
|
|
1349
|
+
{
|
|
1350
|
+
"name": "CollectionCreated",
|
|
1351
|
+
"type": "pop_protocol::events::CollectionCreated",
|
|
1352
|
+
"kind": "nested"
|
|
1353
|
+
}
|
|
1354
|
+
]
|
|
668
1355
|
}
|
|
669
1356
|
];
|
|
670
1357
|
|
|
@@ -9052,74 +9739,149 @@ var IPGenesisABI = [
|
|
|
9052
9739
|
]
|
|
9053
9740
|
}
|
|
9054
9741
|
];
|
|
9742
|
+
var FRAGMENT_KEY = "pop-proof";
|
|
9743
|
+
var toHex = (x) => "0x" + x.toString(16).padStart(64, "0");
|
|
9744
|
+
var poseidon = (xs) => BigInt(starknet.hash.computePoseidonHashOnElements(xs.map((x) => "0x" + x.toString(16))));
|
|
9745
|
+
var nodeHash = (a, b) => a < b ? poseidon([a, b]) : poseidon([b, a]);
|
|
9746
|
+
function popLeafHash(address) {
|
|
9747
|
+
return poseidon([poseidon([BigInt(address)])]);
|
|
9748
|
+
}
|
|
9749
|
+
function merkleTree(leafHashes) {
|
|
9750
|
+
const leaves = [...leafHashes].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9751
|
+
const tree = new Array(2 * leaves.length - 1);
|
|
9752
|
+
leaves.forEach((leaf, i) => tree[tree.length - 1 - i] = leaf);
|
|
9753
|
+
for (let i = tree.length - 1 - leaves.length; i >= 0; i--) {
|
|
9754
|
+
tree[i] = nodeHash(tree[2 * i + 1], tree[2 * i + 2]);
|
|
9755
|
+
}
|
|
9756
|
+
return {
|
|
9757
|
+
root: tree[0],
|
|
9758
|
+
proof(leaf) {
|
|
9759
|
+
let i = tree.lastIndexOf(leaf);
|
|
9760
|
+
if (i < tree.length - leaves.length) throw new Error("Not a leaf of this tree");
|
|
9761
|
+
const proof = [];
|
|
9762
|
+
while (i > 0) {
|
|
9763
|
+
proof.push(tree[i % 2 === 1 ? i + 1 : i - 1]);
|
|
9764
|
+
i = Math.floor((i - 1) / 2);
|
|
9765
|
+
}
|
|
9766
|
+
return proof;
|
|
9767
|
+
}
|
|
9768
|
+
};
|
|
9769
|
+
}
|
|
9770
|
+
function buildPopAllowlist(addresses) {
|
|
9771
|
+
const unique = [...new Set(addresses.map((a) => chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", a)))];
|
|
9772
|
+
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
9773
|
+
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
9774
|
+
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
9775
|
+
const proofs = {};
|
|
9776
|
+
for (const { address, leaf } of leaves) proofs[address] = tree.proof(leaf).map(toHex);
|
|
9777
|
+
return { root: toHex(tree.root), proofs };
|
|
9778
|
+
}
|
|
9779
|
+
function verifyPopProof(root, address, proof) {
|
|
9780
|
+
let computed = popLeafHash(address);
|
|
9781
|
+
for (const sibling of proof) computed = nodeHash(computed, BigInt(sibling));
|
|
9782
|
+
return computed === BigInt(root);
|
|
9783
|
+
}
|
|
9784
|
+
function encodePopClaimFragment(proof) {
|
|
9785
|
+
return `#${FRAGMENT_KEY}=${proof.join(",")}`;
|
|
9786
|
+
}
|
|
9787
|
+
function decodePopClaimFragment(fragment) {
|
|
9788
|
+
const raw = new URLSearchParams(fragment.replace(/^#/, "")).get(FRAGMENT_KEY);
|
|
9789
|
+
if (raw === null) return null;
|
|
9790
|
+
if (raw === "") return [];
|
|
9791
|
+
const parts = raw.split(",");
|
|
9792
|
+
return parts.every((p) => /^0x[0-9a-fA-F]{1,64}$/.test(p)) ? parts : null;
|
|
9793
|
+
}
|
|
9794
|
+
|
|
9795
|
+
// src/starknet/pop-claim.ts
|
|
9796
|
+
function popClaimLinks(origin, collection, list) {
|
|
9797
|
+
const base = `${origin}${chunkLXPVVK7R_cjs.collectionHref("STARKNET", collection)}`;
|
|
9798
|
+
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
9799
|
+
address,
|
|
9800
|
+
url: `${base}${encodePopClaimFragment(proof)}`
|
|
9801
|
+
}));
|
|
9802
|
+
}
|
|
9803
|
+
function popClaimLinksCsv(links) {
|
|
9804
|
+
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
9805
|
+
}
|
|
9806
|
+
async function popClaimInfo(provider, collection) {
|
|
9807
|
+
const contractAddress = chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", collection);
|
|
9808
|
+
const [root, end] = await Promise.all([
|
|
9809
|
+
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
9810
|
+
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
9811
|
+
]);
|
|
9812
|
+
return { root: root[0] ?? "0x0", claimEndTime: Number(BigInt(end[0] ?? "0x0")) };
|
|
9813
|
+
}
|
|
9814
|
+
function popClaimState(input) {
|
|
9815
|
+
const { hasClaimed, proof, wallet, info } = input;
|
|
9816
|
+
if (hasClaimed === true) return "claimed";
|
|
9817
|
+
if (hasClaimed === null || info === null) return "loading";
|
|
9818
|
+
if (BigInt(info.root) === 0n) return "closed";
|
|
9819
|
+
if (info.claimEndTime !== 0 && info.now > info.claimEndTime) return "ended";
|
|
9820
|
+
if (proof === null) return "no-link";
|
|
9821
|
+
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
9822
|
+
return "ready";
|
|
9823
|
+
}
|
|
9824
|
+
var addr = (a) => chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", a);
|
|
9825
|
+
var byteArrayFelts = (s) => starknet.CallData.compile([starknet.byteArray.byteArrayFromString(s)]);
|
|
9826
|
+
var popCalls = {
|
|
9827
|
+
claim(collection, proof) {
|
|
9828
|
+
return { contractAddress: addr(collection), entrypoint: "claim", calldata: [String(proof.length), ...proof] };
|
|
9829
|
+
},
|
|
9830
|
+
/** An empty `tokenUri` uses the collection's URI. */
|
|
9831
|
+
issue(collection, recipient, tokenUri = "") {
|
|
9832
|
+
return { contractAddress: addr(collection), entrypoint: "issue", calldata: [addr(recipient), ...byteArrayFelts(tokenUri)] };
|
|
9833
|
+
},
|
|
9834
|
+
/** Only the token's holder can burn it. */
|
|
9835
|
+
burn(collection, tokenId) {
|
|
9836
|
+
const id = starknet.cairo.uint256(BigInt(tokenId));
|
|
9837
|
+
return { contractAddress: addr(collection), entrypoint: "burn", calldata: [String(id.low), String(id.high)] };
|
|
9838
|
+
},
|
|
9839
|
+
setAllowlistRoot(collection, root) {
|
|
9840
|
+
return { contractAddress: addr(collection), entrypoint: "set_allowlist_root", calldata: [root] };
|
|
9841
|
+
}
|
|
9842
|
+
};
|
|
9055
9843
|
|
|
9056
9844
|
// src/starknet/services/pop.ts
|
|
9057
9845
|
var PopService = class {
|
|
9058
9846
|
constructor(config) {
|
|
9059
|
-
this.factoryAddress =
|
|
9060
|
-
}
|
|
9061
|
-
_collection(address, account) {
|
|
9062
|
-
return newContract(POPCollectionABI, chunk3IJQNNFE_cjs.normalizeAddress("STARKNET", address), account);
|
|
9063
|
-
}
|
|
9064
|
-
async claim(account, collectionAddress) {
|
|
9065
|
-
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
9066
|
-
const res = await account.execute([call]);
|
|
9067
|
-
return { txHash: res.transaction_hash };
|
|
9068
|
-
}
|
|
9069
|
-
async adminMint(account, params) {
|
|
9070
|
-
const call = this._collection(params.collection, account).populate("admin_mint", [
|
|
9071
|
-
params.recipient,
|
|
9072
|
-
params.customUri ?? ""
|
|
9073
|
-
]);
|
|
9074
|
-
const res = await account.execute([call]);
|
|
9075
|
-
return { txHash: res.transaction_hash };
|
|
9847
|
+
this.factoryAddress = chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).popFactory;
|
|
9076
9848
|
}
|
|
9077
|
-
async
|
|
9078
|
-
const
|
|
9849
|
+
async createCollection(account, params) {
|
|
9850
|
+
const factory = newContract(POPFactoryABI, this.factoryAddress, account);
|
|
9851
|
+
const call = factory.populate("create_collection", [params.name, params.symbol, params.baseUri, params.claimEndTime]);
|
|
9079
9852
|
const res = await account.execute([call]);
|
|
9080
9853
|
return { txHash: res.transaction_hash };
|
|
9081
9854
|
}
|
|
9082
|
-
async
|
|
9083
|
-
const
|
|
9084
|
-
const CHUNK = 200;
|
|
9085
|
-
const calls = [];
|
|
9086
|
-
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
9087
|
-
calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
|
|
9088
|
-
}
|
|
9089
|
-
const res = await account.execute(calls);
|
|
9090
|
-
return { txHash: res.transaction_hash };
|
|
9091
|
-
}
|
|
9092
|
-
async removeFromAllowlist(account, params) {
|
|
9093
|
-
const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
|
|
9855
|
+
async setAllowlistRoot(account, params) {
|
|
9856
|
+
const call = popCalls.setAllowlistRoot(params.collection, params.root);
|
|
9094
9857
|
const res = await account.execute([call]);
|
|
9095
9858
|
return { txHash: res.transaction_hash };
|
|
9096
9859
|
}
|
|
9097
|
-
async
|
|
9098
|
-
const call =
|
|
9099
|
-
BigInt(params.tokenId),
|
|
9100
|
-
params.uri
|
|
9101
|
-
]);
|
|
9860
|
+
async claim(account, params) {
|
|
9861
|
+
const call = popCalls.claim(params.collection, params.proof);
|
|
9102
9862
|
const res = await account.execute([call]);
|
|
9103
9863
|
return { txHash: res.transaction_hash };
|
|
9104
9864
|
}
|
|
9105
|
-
async
|
|
9106
|
-
const call =
|
|
9865
|
+
async issue(account, params) {
|
|
9866
|
+
const call = popCalls.issue(params.collection, params.recipient, params.tokenUri);
|
|
9107
9867
|
const res = await account.execute([call]);
|
|
9108
9868
|
return { txHash: res.transaction_hash };
|
|
9109
9869
|
}
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
const call =
|
|
9113
|
-
params.name,
|
|
9114
|
-
params.symbol,
|
|
9115
|
-
params.baseUri,
|
|
9116
|
-
params.claimEndTime,
|
|
9117
|
-
{ [params.eventType]: {} }
|
|
9118
|
-
]);
|
|
9870
|
+
/** Destroys the caller's own credential; the address cannot receive another from this collection. */
|
|
9871
|
+
async burn(account, params) {
|
|
9872
|
+
const call = popCalls.burn(params.collection, params.tokenId);
|
|
9119
9873
|
const res = await account.execute([call]);
|
|
9120
9874
|
return { txHash: res.transaction_hash };
|
|
9121
9875
|
}
|
|
9122
9876
|
};
|
|
9877
|
+
async function popHasClaimed(provider, collection, address) {
|
|
9878
|
+
const res = await provider.callContract({
|
|
9879
|
+
contractAddress: chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", collection),
|
|
9880
|
+
entrypoint: "has_claimed",
|
|
9881
|
+
calldata: [chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address)]
|
|
9882
|
+
});
|
|
9883
|
+
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
9884
|
+
}
|
|
9123
9885
|
function buildFeeCall(p, cfg) {
|
|
9124
9886
|
if (!cfg.enabled || !cfg.fundAddress) return null;
|
|
9125
9887
|
const bps = p.surface === "marketplace" ? cfg.marketplaceBps : p.surface === "launchpad" ? cfg.launchpadBps : cfg.sponsorshipBps;
|
|
@@ -9146,11 +9908,11 @@ function toContractConditions(c) {
|
|
|
9146
9908
|
}
|
|
9147
9909
|
var DropService = class {
|
|
9148
9910
|
constructor(config) {
|
|
9149
|
-
this.factoryAddress =
|
|
9911
|
+
this.factoryAddress = chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).dropFactory;
|
|
9150
9912
|
this.config = config;
|
|
9151
9913
|
}
|
|
9152
9914
|
_collection(address, account) {
|
|
9153
|
-
return newContract(DropCollectionABI,
|
|
9915
|
+
return newContract(DropCollectionABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), account);
|
|
9154
9916
|
}
|
|
9155
9917
|
async claim(account, collectionAddress, quantity = 1) {
|
|
9156
9918
|
const collection = this._collection(collectionAddress, account);
|
|
@@ -9230,19 +9992,19 @@ var DropService = class {
|
|
|
9230
9992
|
// src/starknet/services/erc1155collection.ts
|
|
9231
9993
|
var ERC1155CollectionService = class {
|
|
9232
9994
|
constructor(config) {
|
|
9233
|
-
this.factoryAddress = config.collection1155Contract ??
|
|
9995
|
+
this.factoryAddress = config.collection1155Contract ?? chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).collection1155;
|
|
9234
9996
|
}
|
|
9235
9997
|
_factory(account) {
|
|
9236
9998
|
return newContract(
|
|
9237
9999
|
IPCollection1155FactoryABI,
|
|
9238
|
-
|
|
10000
|
+
chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", this.factoryAddress),
|
|
9239
10001
|
account
|
|
9240
10002
|
);
|
|
9241
10003
|
}
|
|
9242
10004
|
_collection(address, account) {
|
|
9243
10005
|
return newContract(
|
|
9244
10006
|
IPCollection1155ABI,
|
|
9245
|
-
|
|
10007
|
+
chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address),
|
|
9246
10008
|
account
|
|
9247
10009
|
);
|
|
9248
10010
|
}
|
|
@@ -9425,7 +10187,7 @@ function factoryContract() {
|
|
|
9425
10187
|
if (!_factoryContract) {
|
|
9426
10188
|
_factoryContract = newContract(
|
|
9427
10189
|
CreatorCoinFactoryABI,
|
|
9428
|
-
|
|
10190
|
+
chunkH7I6TEOA_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory
|
|
9429
10191
|
);
|
|
9430
10192
|
}
|
|
9431
10193
|
return _factoryContract;
|
|
@@ -9462,7 +10224,7 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
9462
10224
|
calls.push({
|
|
9463
10225
|
contractAddress: params.quoteToken,
|
|
9464
10226
|
entrypoint: "transfer",
|
|
9465
|
-
calldata: [
|
|
10227
|
+
calldata: [chunkH7I6TEOA_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory, amt.low, amt.high]
|
|
9466
10228
|
});
|
|
9467
10229
|
}
|
|
9468
10230
|
calls.push(factoryContract().populate("launch_on_ekubo", [launchParameters, ekuboParameters]));
|
|
@@ -9470,26 +10232,26 @@ function buildLaunchOnEkuboCalls(params) {
|
|
|
9470
10232
|
}
|
|
9471
10233
|
var CREATOR_COIN_CREATED_SELECTOR = starknet.hash.getSelectorFromName("CreatorCoinCreated");
|
|
9472
10234
|
function parseCreatorCoinCreated(receipt) {
|
|
9473
|
-
const factory =
|
|
10235
|
+
const factory = chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", chunkH7I6TEOA_cjs.getStarknetCoordinates("STARKNET").creatorCoinFactory);
|
|
9474
10236
|
for (const ev of receipt?.events ?? []) {
|
|
9475
10237
|
let from;
|
|
9476
10238
|
try {
|
|
9477
|
-
from =
|
|
10239
|
+
from = chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", ev.from_address ?? "");
|
|
9478
10240
|
} catch {
|
|
9479
10241
|
continue;
|
|
9480
10242
|
}
|
|
9481
10243
|
if (from !== factory) continue;
|
|
9482
10244
|
const k0 = ev.keys?.[0];
|
|
9483
|
-
if (!k0 ||
|
|
10245
|
+
if (!k0 || chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", k0) !== chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", CREATOR_COIN_CREATED_SELECTOR)) continue;
|
|
9484
10246
|
const data = ev.data ?? [];
|
|
9485
10247
|
if (data.length < 1) continue;
|
|
9486
|
-
return
|
|
10248
|
+
return chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", data[data.length - 1]);
|
|
9487
10249
|
}
|
|
9488
10250
|
throw new Error("Coin deployed but the coin address could not be read from the receipt");
|
|
9489
10251
|
}
|
|
9490
10252
|
var CreatorCoinService = class {
|
|
9491
10253
|
constructor(config) {
|
|
9492
|
-
this.factoryAddress =
|
|
10254
|
+
this.factoryAddress = chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).creatorCoinFactory;
|
|
9493
10255
|
this.config = config;
|
|
9494
10256
|
}
|
|
9495
10257
|
_factory(account) {
|
|
@@ -9514,19 +10276,19 @@ var CreatorCoinService = class {
|
|
|
9514
10276
|
var TicketService = class {
|
|
9515
10277
|
constructor(config) {
|
|
9516
10278
|
this.config = config;
|
|
9517
|
-
this.factoryAddress =
|
|
10279
|
+
this.factoryAddress = chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).ipTicketsFactory;
|
|
9518
10280
|
}
|
|
9519
10281
|
_factory(account, factoryAddress) {
|
|
9520
10282
|
const address = factoryAddress ?? this.factoryAddress;
|
|
9521
10283
|
if (!address) throw new Error("IP-Tickets factory address not configured for this chain");
|
|
9522
|
-
return newContract(IPTicketCollectionFactoryABI,
|
|
10284
|
+
return newContract(IPTicketCollectionFactoryABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), account);
|
|
9523
10285
|
}
|
|
9524
10286
|
_collection(address, account) {
|
|
9525
|
-
return newContract(IPTicketCollectionABI,
|
|
10287
|
+
return newContract(IPTicketCollectionABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), account);
|
|
9526
10288
|
}
|
|
9527
10289
|
_collectionRead(address) {
|
|
9528
10290
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
9529
|
-
return newContract(IPTicketCollectionABI,
|
|
10291
|
+
return newContract(IPTicketCollectionABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), provider);
|
|
9530
10292
|
}
|
|
9531
10293
|
async deployCollection(account, params) {
|
|
9532
10294
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -9587,19 +10349,19 @@ var TicketService = class {
|
|
|
9587
10349
|
var ClubService = class {
|
|
9588
10350
|
constructor(config) {
|
|
9589
10351
|
this.config = config;
|
|
9590
|
-
this.factoryAddress =
|
|
10352
|
+
this.factoryAddress = chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).ipClubFactory;
|
|
9591
10353
|
}
|
|
9592
10354
|
_factory(account, factoryAddress) {
|
|
9593
10355
|
const address = factoryAddress ?? this.factoryAddress;
|
|
9594
10356
|
if (!address) throw new Error("IP-Club factory address not configured for this chain");
|
|
9595
|
-
return newContract(IPClubFactoryABI,
|
|
10357
|
+
return newContract(IPClubFactoryABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), account);
|
|
9596
10358
|
}
|
|
9597
10359
|
_collection(address, account) {
|
|
9598
|
-
return newContract(IPClubCollectionABI,
|
|
10360
|
+
return newContract(IPClubCollectionABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), account);
|
|
9599
10361
|
}
|
|
9600
10362
|
_collectionRead(address) {
|
|
9601
10363
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
9602
|
-
return newContract(IPClubCollectionABI,
|
|
10364
|
+
return newContract(IPClubCollectionABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address), provider);
|
|
9603
10365
|
}
|
|
9604
10366
|
async deployCollection(account, params) {
|
|
9605
10367
|
const call = this._factory(account, params.factoryAddress).populate("deploy_collection", [
|
|
@@ -9662,14 +10424,14 @@ var ClubService = class {
|
|
|
9662
10424
|
var SponsorshipService = class {
|
|
9663
10425
|
constructor(config) {
|
|
9664
10426
|
this.config = config;
|
|
9665
|
-
this.sponsorshipAddress =
|
|
10427
|
+
this.sponsorshipAddress = chunkH7I6TEOA_cjs.getStarknetCoordinates(config.chain).ipSponsorship;
|
|
9666
10428
|
}
|
|
9667
10429
|
_contract(account, address) {
|
|
9668
10430
|
const resolved = address ?? this.sponsorshipAddress;
|
|
9669
10431
|
if (!resolved) {
|
|
9670
10432
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
9671
10433
|
}
|
|
9672
|
-
return newContract(IPSponsorshipABI,
|
|
10434
|
+
return newContract(IPSponsorshipABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", resolved), account);
|
|
9673
10435
|
}
|
|
9674
10436
|
_contractRead(address) {
|
|
9675
10437
|
const resolved = address ?? this.sponsorshipAddress;
|
|
@@ -9677,7 +10439,7 @@ var SponsorshipService = class {
|
|
|
9677
10439
|
throw new Error("IP-Sponsorship address not configured for this chain");
|
|
9678
10440
|
}
|
|
9679
10441
|
const provider = new starknet.RpcProvider({ nodeUrl: this.config.rpcUrl });
|
|
9680
|
-
return newContract(IPSponsorshipABI,
|
|
10442
|
+
return newContract(IPSponsorshipABI, chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", resolved), provider);
|
|
9681
10443
|
}
|
|
9682
10444
|
async createOffer(account, params) {
|
|
9683
10445
|
const specificSponsor = params.specificSponsor ? new starknet.CairoOption(starknet.CairoOptionVariant.Some, params.specificSponsor) : new starknet.CairoOption(starknet.CairoOptionVariant.None);
|
|
@@ -9712,7 +10474,7 @@ var SponsorshipService = class {
|
|
|
9712
10474
|
const approveCall = {
|
|
9713
10475
|
contractAddress: params.paymentToken,
|
|
9714
10476
|
entrypoint: "approve",
|
|
9715
|
-
calldata: [
|
|
10477
|
+
calldata: [chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", sponsorshipAddress), amount.low.toString(), amount.high.toString()]
|
|
9716
10478
|
};
|
|
9717
10479
|
const bidCall = this._contract(account, sponsorshipAddress).populate("place_bid", [
|
|
9718
10480
|
starknet.cairo.uint256(params.offerId),
|
|
@@ -9839,7 +10601,7 @@ var SponsorshipService = class {
|
|
|
9839
10601
|
// src/starknet/client.ts
|
|
9840
10602
|
var MedialaneClient = class {
|
|
9841
10603
|
constructor(rawConfig = {}) {
|
|
9842
|
-
this.config =
|
|
10604
|
+
this.config = chunkLXPVVK7R_cjs.resolveConfig(rawConfig);
|
|
9843
10605
|
this.services = {
|
|
9844
10606
|
pop: new PopService(this.config),
|
|
9845
10607
|
drop: new DropService(this.config),
|
|
@@ -9850,9 +10612,9 @@ var MedialaneClient = class {
|
|
|
9850
10612
|
sponsorship: new SponsorshipService(this.config)
|
|
9851
10613
|
};
|
|
9852
10614
|
if (!this.config.backendUrl) {
|
|
9853
|
-
const sentinel = new
|
|
10615
|
+
const sentinel = new chunkLXPVVK7R_cjs.ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
|
|
9854
10616
|
const apiMethodNames = new Set(
|
|
9855
|
-
Object.getOwnPropertyNames(
|
|
10617
|
+
Object.getOwnPropertyNames(chunkLXPVVK7R_cjs.ApiClient.prototype).filter(
|
|
9856
10618
|
(k) => k !== "constructor" && typeof sentinel[k] === "function"
|
|
9857
10619
|
)
|
|
9858
10620
|
);
|
|
@@ -9869,7 +10631,7 @@ var MedialaneClient = class {
|
|
|
9869
10631
|
}
|
|
9870
10632
|
});
|
|
9871
10633
|
} else {
|
|
9872
|
-
this.api = new
|
|
10634
|
+
this.api = new chunkLXPVVK7R_cjs.ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
9873
10635
|
}
|
|
9874
10636
|
}
|
|
9875
10637
|
get chain() {
|
|
@@ -10041,7 +10803,7 @@ function buildListingOrder(i, cfg) {
|
|
|
10041
10803
|
salt: i.salt,
|
|
10042
10804
|
counter: i.counter
|
|
10043
10805
|
};
|
|
10044
|
-
const typedData =
|
|
10806
|
+
const typedData = chunkLXPVVK7R_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
10045
10807
|
return { orderParams, typedData };
|
|
10046
10808
|
}
|
|
10047
10809
|
function buildOfferOrder(i, cfg) {
|
|
@@ -10062,11 +10824,11 @@ function buildOfferOrder(i, cfg) {
|
|
|
10062
10824
|
salt: i.salt,
|
|
10063
10825
|
counter: i.counter
|
|
10064
10826
|
};
|
|
10065
|
-
const typedData =
|
|
10827
|
+
const typedData = chunkLXPVVK7R_cjs.stringifyBigInts(buildOrderTypedData(orderParams, getChainId(cfg)));
|
|
10066
10828
|
return { orderParams, typedData };
|
|
10067
10829
|
}
|
|
10068
10830
|
function registerPayload(orderParams, signature) {
|
|
10069
|
-
return
|
|
10831
|
+
return chunkLXPVVK7R_cjs.stringifyBigInts({
|
|
10070
10832
|
parameters: {
|
|
10071
10833
|
...orderParams,
|
|
10072
10834
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -10097,14 +10859,14 @@ function buildFulfillCalls(a, cfg) {
|
|
|
10097
10859
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
10098
10860
|
}
|
|
10099
10861
|
function buildCancelCalls(a, cfg) {
|
|
10100
|
-
const cancelRequest =
|
|
10862
|
+
const cancelRequest = chunkLXPVVK7R_cjs.stringifyBigInts({
|
|
10101
10863
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
10102
10864
|
signature: a.signature
|
|
10103
10865
|
});
|
|
10104
10866
|
return [contractFor(cfg).populate("cancel_order", [cancelRequest])];
|
|
10105
10867
|
}
|
|
10106
10868
|
function buildCancelTypedData(orderHash, offerer, cfg) {
|
|
10107
|
-
return
|
|
10869
|
+
return chunkLXPVVK7R_cjs.stringifyBigInts(buildCancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg)));
|
|
10108
10870
|
}
|
|
10109
10871
|
function contractFor2(cfg) {
|
|
10110
10872
|
return newContract(Medialane1155ABI, cfg.marketplace1155Contract, getProvider(cfg));
|
|
@@ -10127,7 +10889,7 @@ function buildListing1155Order(i, cfg) {
|
|
|
10127
10889
|
salt: i.salt,
|
|
10128
10890
|
counter: i.counter
|
|
10129
10891
|
};
|
|
10130
|
-
const typedData =
|
|
10892
|
+
const typedData = chunkLXPVVK7R_cjs.stringifyBigInts(
|
|
10131
10893
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
10132
10894
|
);
|
|
10133
10895
|
return { orderParams, typedData };
|
|
@@ -10150,13 +10912,13 @@ function buildOffer1155Order(i, cfg) {
|
|
|
10150
10912
|
salt: i.salt,
|
|
10151
10913
|
counter: i.counter
|
|
10152
10914
|
};
|
|
10153
|
-
const typedData =
|
|
10915
|
+
const typedData = chunkLXPVVK7R_cjs.stringifyBigInts(
|
|
10154
10916
|
build1155OrderTypedData(orderParams, getChainId(cfg))
|
|
10155
10917
|
);
|
|
10156
10918
|
return { orderParams, typedData };
|
|
10157
10919
|
}
|
|
10158
10920
|
function registerPayload2(orderParams, signature) {
|
|
10159
|
-
return
|
|
10921
|
+
return chunkLXPVVK7R_cjs.stringifyBigInts({
|
|
10160
10922
|
parameters: {
|
|
10161
10923
|
...orderParams,
|
|
10162
10924
|
offer: { ...orderParams.offer, item_type: starknet.shortString.encodeShortString(orderParams.offer.item_type) },
|
|
@@ -10187,14 +10949,14 @@ function buildFulfill1155Calls(a, cfg) {
|
|
|
10187
10949
|
return fee ? [approve, fulfill, fee] : [approve, fulfill];
|
|
10188
10950
|
}
|
|
10189
10951
|
function buildCancel1155Calls(a, cfg) {
|
|
10190
|
-
const cancelPayload =
|
|
10952
|
+
const cancelPayload = chunkLXPVVK7R_cjs.stringifyBigInts({
|
|
10191
10953
|
cancelation: { order_hash: a.orderHash, offerer: a.offerer },
|
|
10192
10954
|
signature: a.signature
|
|
10193
10955
|
});
|
|
10194
10956
|
return [contractFor2(cfg).populate("cancel_order", [cancelPayload])];
|
|
10195
10957
|
}
|
|
10196
10958
|
function buildCancel1155TypedData(orderHash, offerer, cfg) {
|
|
10197
|
-
return
|
|
10959
|
+
return chunkLXPVVK7R_cjs.stringifyBigInts(
|
|
10198
10960
|
build1155CancellationTypedData({ order_hash: orderHash, offerer }, getChainId(cfg))
|
|
10199
10961
|
);
|
|
10200
10962
|
}
|
|
@@ -10537,14 +11299,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
10537
11299
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
10538
11300
|
const status = receipt.execution_status ?? receipt.status;
|
|
10539
11301
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
10540
|
-
throw new
|
|
11302
|
+
throw new chunkLXPVVK7R_cjs.UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
10541
11303
|
}
|
|
10542
11304
|
if (status) return receipt;
|
|
10543
11305
|
} catch (err) {
|
|
10544
11306
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
10545
11307
|
}
|
|
10546
11308
|
}
|
|
10547
|
-
throw new
|
|
11309
|
+
throw new chunkLXPVVK7R_cjs.UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
10548
11310
|
}
|
|
10549
11311
|
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
10550
11312
|
let calls;
|
|
@@ -10597,14 +11359,14 @@ function u2562(low, high) {
|
|
|
10597
11359
|
return (BigInt(low ?? 0) + (BigInt(high ?? 0) << 128n)).toString();
|
|
10598
11360
|
}
|
|
10599
11361
|
function deployedCollectionFromReceipt(receipt, service) {
|
|
10600
|
-
const factory =
|
|
11362
|
+
const factory = chunkLXPVVK7R_cjs.getService(service)?.onchain?.STARKNET?.factoryAddress;
|
|
10601
11363
|
const { event, address } = DEPLOY_EVENTS[service];
|
|
10602
11364
|
const selector = BigInt(starknet.hash.getSelectorFromName(event));
|
|
10603
11365
|
for (const e of receipt.events ?? []) {
|
|
10604
11366
|
if (factory && !sameFelt(e.from_address, factory)) continue;
|
|
10605
11367
|
if (!sameFelt(e.keys?.[0], selector)) continue;
|
|
10606
11368
|
const value = address(e);
|
|
10607
|
-
if (value) return
|
|
11369
|
+
if (value) return chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", value);
|
|
10608
11370
|
}
|
|
10609
11371
|
return null;
|
|
10610
11372
|
}
|
|
@@ -10725,13 +11487,13 @@ function buildRemoveOwnerByGuidCall(accountAddress, ownerGuid) {
|
|
|
10725
11487
|
}
|
|
10726
11488
|
function buildDeployAccountParams(ownerPubkey, salt = 0) {
|
|
10727
11489
|
return {
|
|
10728
|
-
classHash:
|
|
10729
|
-
constructorCalldata:
|
|
11490
|
+
classHash: chunkLXPVVK7R_cjs.STARKNET_MEDIAWALLET_CLASS_HASH,
|
|
11491
|
+
constructorCalldata: chunkLXPVVK7R_cjs.ownerConstructorCalldata(ownerPubkey),
|
|
10730
11492
|
addressSalt: starknet.num.toHex(salt),
|
|
10731
|
-
contractAddress:
|
|
11493
|
+
contractAddress: chunkLXPVVK7R_cjs.computeAccountAddress(ownerPubkey, salt)
|
|
10732
11494
|
};
|
|
10733
11495
|
}
|
|
10734
|
-
var norm = (address) =>
|
|
11496
|
+
var norm = (address) => chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address);
|
|
10735
11497
|
var SIGNER_TYPE_NAMES = ["Starknet", "Secp256k1", "Secp256r1"];
|
|
10736
11498
|
function encodeFeltArray(items) {
|
|
10737
11499
|
return [starknet.num.toHex(items.length), ...items];
|
|
@@ -10924,7 +11686,7 @@ var InvalidRecoveryKeyError = class extends Error {
|
|
|
10924
11686
|
var canonicalAddress = (address) => `0x${BigInt(address).toString(16).padStart(64, "0")}`;
|
|
10925
11687
|
function keyPair(privateKey) {
|
|
10926
11688
|
try {
|
|
10927
|
-
return
|
|
11689
|
+
return chunkLXPVVK7R_cjs.starkKeyPairFromPrivateKey(privateKey);
|
|
10928
11690
|
} catch {
|
|
10929
11691
|
throw new InvalidRecoveryKeyError();
|
|
10930
11692
|
}
|
|
@@ -10937,7 +11699,7 @@ function parseRecoveryKey(input) {
|
|
|
10937
11699
|
const trimmed = input.trim();
|
|
10938
11700
|
if (!trimmed.startsWith(PREFIX)) {
|
|
10939
11701
|
const { privateKeyHex, publicKeyHex } = keyPair(trimmed);
|
|
10940
|
-
return { walletAddress:
|
|
11702
|
+
return { walletAddress: chunkLXPVVK7R_cjs.computeAccountAddress(publicKeyHex, 0), privateKey: privateKeyHex };
|
|
10941
11703
|
}
|
|
10942
11704
|
const parts = trimmed.slice(PREFIX.length).split(":");
|
|
10943
11705
|
const [walletAddress, privateKey] = parts;
|
|
@@ -10959,7 +11721,7 @@ function describeRecoveryAction(escape) {
|
|
|
10959
11721
|
return "none";
|
|
10960
11722
|
}
|
|
10961
11723
|
function normalizeWalletAddress(address) {
|
|
10962
|
-
return
|
|
11724
|
+
return chunkLXPVVK7R_cjs.normalizeAddress("STARKNET", address);
|
|
10963
11725
|
}
|
|
10964
11726
|
function isValidStarknetAddress(address) {
|
|
10965
11727
|
try {
|
|
@@ -11004,7 +11766,7 @@ async function estimateSelfFundedFee(provider, address, calls) {
|
|
|
11004
11766
|
return { feeRaw: estimate.overall_fee, unit: estimate.unit, balanceRaw };
|
|
11005
11767
|
}
|
|
11006
11768
|
async function feeTokenBalance(provider, address, unit) {
|
|
11007
|
-
const token =
|
|
11769
|
+
const token = chunkLXPVVK7R_cjs.getTokenBySymbol(unit === "FRI" ? "STRK" : "ETH");
|
|
11008
11770
|
if (!token) throw new Error(`No fee token for unit ${unit}`);
|
|
11009
11771
|
const [low = "0x0", high = "0x0"] = await provider.callContract({
|
|
11010
11772
|
contractAddress: token.address,
|
|
@@ -11031,7 +11793,7 @@ function sponsoredExecutor(deps) {
|
|
|
11031
11793
|
{ proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
|
|
11032
11794
|
{
|
|
11033
11795
|
address: userAddress,
|
|
11034
|
-
signTypedData: async (data) =>
|
|
11796
|
+
signTypedData: async (data) => chunkLXPVVK7R_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))
|
|
11035
11797
|
},
|
|
11036
11798
|
calls
|
|
11037
11799
|
);
|
|
@@ -11081,7 +11843,7 @@ async function deploySponsored(input) {
|
|
|
11081
11843
|
return { transactionHash };
|
|
11082
11844
|
}
|
|
11083
11845
|
async function deploySelfFunded(input) {
|
|
11084
|
-
const classHash =
|
|
11846
|
+
const classHash = chunkH7I6TEOA_cjs.getCoordinates("STARKNET").mediaWalletClassHash;
|
|
11085
11847
|
if (!classHash) throw new Error("Media Wallet class hash is not configured");
|
|
11086
11848
|
const account = new starknet.Account({
|
|
11087
11849
|
provider: input.provider,
|
|
@@ -11091,7 +11853,7 @@ async function deploySelfFunded(input) {
|
|
|
11091
11853
|
});
|
|
11092
11854
|
const { transaction_hash } = await account.deployAccount({
|
|
11093
11855
|
classHash,
|
|
11094
|
-
constructorCalldata:
|
|
11856
|
+
constructorCalldata: chunkLXPVVK7R_cjs.ownerConstructorCalldata(input.ownerPubKey),
|
|
11095
11857
|
addressSalt: 0,
|
|
11096
11858
|
contractAddress: input.ownerAddress
|
|
11097
11859
|
});
|
|
@@ -11154,7 +11916,7 @@ async function completeDeployment(deps, onStep, options = {}) {
|
|
|
11154
11916
|
backendUrl: deps.backendUrl,
|
|
11155
11917
|
walletAddress: address,
|
|
11156
11918
|
signer: {
|
|
11157
|
-
signMessage: async (td) =>
|
|
11919
|
+
signMessage: async (td) => chunkLXPVVK7R_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(td, address))
|
|
11158
11920
|
}
|
|
11159
11921
|
});
|
|
11160
11922
|
deps.store.notifyChange();
|
|
@@ -11259,7 +12021,7 @@ function createMediaWallet(config) {
|
|
|
11259
12021
|
address: sealed.address,
|
|
11260
12022
|
signTypedData: async (data) => {
|
|
11261
12023
|
const privateKeyHex = await unlockOnce(sealed);
|
|
11262
|
-
return
|
|
12024
|
+
return chunkLXPVVK7R_cjs.signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, sealed.address));
|
|
11263
12025
|
},
|
|
11264
12026
|
execute: async (calls) => {
|
|
11265
12027
|
const { transactionHash } = await run(sealed, calls);
|
|
@@ -11331,51 +12093,51 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
11331
12093
|
|
|
11332
12094
|
Object.defineProperty(exports, "InvalidStarkPrivateKeyError", {
|
|
11333
12095
|
enumerable: true,
|
|
11334
|
-
get: function () { return
|
|
12096
|
+
get: function () { return chunkLXPVVK7R_cjs.InvalidStarkPrivateKeyError; }
|
|
11335
12097
|
});
|
|
11336
12098
|
Object.defineProperty(exports, "PasskeyCancelledError", {
|
|
11337
12099
|
enumerable: true,
|
|
11338
|
-
get: function () { return
|
|
12100
|
+
get: function () { return chunkLXPVVK7R_cjs.PasskeyCancelledError; }
|
|
11339
12101
|
});
|
|
11340
12102
|
Object.defineProperty(exports, "UserFacingError", {
|
|
11341
12103
|
enumerable: true,
|
|
11342
|
-
get: function () { return
|
|
12104
|
+
get: function () { return chunkLXPVVK7R_cjs.UserFacingError; }
|
|
11343
12105
|
});
|
|
11344
12106
|
Object.defineProperty(exports, "computeAccountAddress", {
|
|
11345
12107
|
enumerable: true,
|
|
11346
|
-
get: function () { return
|
|
12108
|
+
get: function () { return chunkLXPVVK7R_cjs.computeAccountAddress; }
|
|
11347
12109
|
});
|
|
11348
12110
|
Object.defineProperty(exports, "createPasskeyOwner", {
|
|
11349
12111
|
enumerable: true,
|
|
11350
|
-
get: function () { return
|
|
12112
|
+
get: function () { return chunkLXPVVK7R_cjs.createPasskeyOwner; }
|
|
11351
12113
|
});
|
|
11352
12114
|
Object.defineProperty(exports, "deriveAesKey", {
|
|
11353
12115
|
enumerable: true,
|
|
11354
|
-
get: function () { return
|
|
12116
|
+
get: function () { return chunkLXPVVK7R_cjs.deriveAesKey; }
|
|
11355
12117
|
});
|
|
11356
12118
|
Object.defineProperty(exports, "generateStarkKeyPair", {
|
|
11357
12119
|
enumerable: true,
|
|
11358
|
-
get: function () { return
|
|
12120
|
+
get: function () { return chunkLXPVVK7R_cjs.generateStarkKeyPair; }
|
|
11359
12121
|
});
|
|
11360
12122
|
Object.defineProperty(exports, "ownerConstructorCalldata", {
|
|
11361
12123
|
enumerable: true,
|
|
11362
|
-
get: function () { return
|
|
12124
|
+
get: function () { return chunkLXPVVK7R_cjs.ownerConstructorCalldata; }
|
|
11363
12125
|
});
|
|
11364
12126
|
Object.defineProperty(exports, "sealPrivateKey", {
|
|
11365
12127
|
enumerable: true,
|
|
11366
|
-
get: function () { return
|
|
12128
|
+
get: function () { return chunkLXPVVK7R_cjs.sealPrivateKey; }
|
|
11367
12129
|
});
|
|
11368
12130
|
Object.defineProperty(exports, "signWithPrivateKey", {
|
|
11369
12131
|
enumerable: true,
|
|
11370
|
-
get: function () { return
|
|
12132
|
+
get: function () { return chunkLXPVVK7R_cjs.signWithPrivateKey; }
|
|
11371
12133
|
});
|
|
11372
12134
|
Object.defineProperty(exports, "starkKeyPairFromPrivateKey", {
|
|
11373
12135
|
enumerable: true,
|
|
11374
|
-
get: function () { return
|
|
12136
|
+
get: function () { return chunkLXPVVK7R_cjs.starkKeyPairFromPrivateKey; }
|
|
11375
12137
|
});
|
|
11376
12138
|
Object.defineProperty(exports, "unsealPrivateKey", {
|
|
11377
12139
|
enumerable: true,
|
|
11378
|
-
get: function () { return
|
|
12140
|
+
get: function () { return chunkLXPVVK7R_cjs.unsealPrivateKey; }
|
|
11379
12141
|
});
|
|
11380
12142
|
exports.COIN_MAX_SUPPLY = MAX_SUPPLY;
|
|
11381
12143
|
exports.COIN_MIN_SUPPLY = MIN_SUPPLY;
|
|
@@ -11430,6 +12192,7 @@ exports.buildFeeCall = buildFeeCall;
|
|
|
11430
12192
|
exports.buildFundingTransferCall = buildFundingTransferCall;
|
|
11431
12193
|
exports.buildLaunchOnEkuboCalls = buildLaunchOnEkuboCalls;
|
|
11432
12194
|
exports.buildOrderTypedData = buildOrderTypedData;
|
|
12195
|
+
exports.buildPopAllowlist = buildPopAllowlist;
|
|
11433
12196
|
exports.buildRemoveOwnerByGuidCall = buildRemoveOwnerByGuidCall;
|
|
11434
12197
|
exports.buildRemoveOwnerCall = buildRemoveOwnerCall;
|
|
11435
12198
|
exports.buildSetFirstGuardianCall = buildSetFirstGuardianCall;
|
|
@@ -11447,6 +12210,7 @@ exports.createOwnerStore = createOwnerStore;
|
|
|
11447
12210
|
exports.createSelfFundConsent = createSelfFundConsent;
|
|
11448
12211
|
exports.decodeEscapeAndStatus = decodeEscapeAndStatus;
|
|
11449
12212
|
exports.decodeGuardiansInfo = decodeGuardiansInfo;
|
|
12213
|
+
exports.decodePopClaimFragment = decodePopClaimFragment;
|
|
11450
12214
|
exports.deploySelfFunded = deploySelfFunded;
|
|
11451
12215
|
exports.deploySponsored = deploySponsored;
|
|
11452
12216
|
exports.deployedCollectionFromReceipt = deployedCollectionFromReceipt;
|
|
@@ -11456,6 +12220,7 @@ exports.describeGuardianStatus = describeGuardianStatus;
|
|
|
11456
12220
|
exports.describeRecoveryAction = describeRecoveryAction;
|
|
11457
12221
|
exports.encodeByteArray = encodeByteArray;
|
|
11458
12222
|
exports.encodePairingPayload = encodePairingPayload;
|
|
12223
|
+
exports.encodePopClaimFragment = encodePopClaimFragment;
|
|
11459
12224
|
exports.encodeRecoveryKey = encodeRecoveryKey;
|
|
11460
12225
|
exports.estimateSelfFundedFee = estimateSelfFundedFee;
|
|
11461
12226
|
exports.executeIntent = executeIntent;
|
|
@@ -11485,6 +12250,12 @@ exports.parseAccountAddress = parseAccountAddress;
|
|
|
11485
12250
|
exports.parseCreatorCoinCreated = parseCreatorCoinCreated;
|
|
11486
12251
|
exports.parsePairingPayload = parsePairingPayload;
|
|
11487
12252
|
exports.parseRecoveryKey = parseRecoveryKey;
|
|
12253
|
+
exports.popCalls = popCalls;
|
|
12254
|
+
exports.popClaimInfo = popClaimInfo;
|
|
12255
|
+
exports.popClaimLinks = popClaimLinks;
|
|
12256
|
+
exports.popClaimLinksCsv = popClaimLinksCsv;
|
|
12257
|
+
exports.popClaimState = popClaimState;
|
|
12258
|
+
exports.popHasClaimed = popHasClaimed;
|
|
11488
12259
|
exports.priceToEkuboParams = priceToEkuboParams;
|
|
11489
12260
|
exports.requestSiwsToken = requestSiwsToken;
|
|
11490
12261
|
exports.selfFundedExecutor = selfFundedExecutor;
|
|
@@ -11497,6 +12268,7 @@ exports.validateCoinName = validateName;
|
|
|
11497
12268
|
exports.validateCoinSupply = validateSupply;
|
|
11498
12269
|
exports.validateCoinSymbol = validateSymbol;
|
|
11499
12270
|
exports.validatePrice = validatePrice;
|
|
12271
|
+
exports.verifyPopProof = verifyPopProof;
|
|
11500
12272
|
exports.waitUntilDeployed = waitUntilDeployed;
|
|
11501
12273
|
//# sourceMappingURL=index.cjs.map
|
|
11502
12274
|
//# sourceMappingURL=index.cjs.map
|