@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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { normalizeAddress, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-
|
|
2
|
-
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-
|
|
3
|
-
import { getStarknetCoordinates, getCoordinates } from '../chunk-
|
|
4
|
-
import { hash, cairo, uint256, RpcProvider, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
1
|
+
import { normalizeAddress, collectionHref, resolveConfig, ApiClient, UserFacingError, getService, STARKNET_MEDIAWALLET_CLASS_HASH, computeAccountAddress, ownerConstructorCalldata, getTokenBySymbol, signWithPrivateKey, stringifyBigInts, SUPPORTED_TOKENS, starkKeyPairFromPrivateKey, createFailoverFetch } from '../chunk-R6EJAMY3.js';
|
|
2
|
+
export { InvalidStarkPrivateKeyError, PasskeyCancelledError, UserFacingError, computeAccountAddress, createPasskeyOwner, deriveAesKey, generateStarkKeyPair, ownerConstructorCalldata, sealPrivateKey, signWithPrivateKey, starkKeyPairFromPrivateKey, unsealPrivateKey } from '../chunk-R6EJAMY3.js';
|
|
3
|
+
import { getStarknetCoordinates, getCoordinates } from '../chunk-PBJLHXDB.js';
|
|
4
|
+
import { hash, cairo, uint256, RpcProvider, CairoOption, CairoOptionVariant, num, ec, validateAndParseAddress, Account, typedData, stark, CallData, byteArray, Contract, TypedDataRevision, constants, shortString } from 'starknet';
|
|
5
5
|
import { extract, expand } from '@noble/hashes/hkdf.js';
|
|
6
6
|
import { sha256 } from '@noble/hashes/sha2.js';
|
|
7
7
|
|
|
@@ -524,146 +524,833 @@ var IPMarketplaceABI = [
|
|
|
524
524
|
// src/starknet/abis/popCollection.ts
|
|
525
525
|
var POPCollectionABI = [
|
|
526
526
|
{
|
|
527
|
-
type: "
|
|
528
|
-
name: "
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
527
|
+
"type": "impl",
|
|
528
|
+
"name": "ERC721Impl",
|
|
529
|
+
"interface_name": "openzeppelin_interfaces::token::erc721::IERC721"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"type": "struct",
|
|
533
|
+
"name": "core::integer::u256",
|
|
534
|
+
"members": [
|
|
535
|
+
{
|
|
536
|
+
"name": "low",
|
|
537
|
+
"type": "core::integer::u128"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"name": "high",
|
|
541
|
+
"type": "core::integer::u128"
|
|
542
|
+
}
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"type": "struct",
|
|
547
|
+
"name": "core::array::Span::<core::felt252>",
|
|
548
|
+
"members": [
|
|
549
|
+
{
|
|
550
|
+
"name": "snapshot",
|
|
551
|
+
"type": "@core::array::Array::<core::felt252>"
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"type": "enum",
|
|
557
|
+
"name": "core::bool",
|
|
558
|
+
"variants": [
|
|
559
|
+
{
|
|
560
|
+
"name": "False",
|
|
561
|
+
"type": "()"
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"name": "True",
|
|
565
|
+
"type": "()"
|
|
566
|
+
}
|
|
567
|
+
]
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"type": "interface",
|
|
571
|
+
"name": "openzeppelin_interfaces::token::erc721::IERC721",
|
|
572
|
+
"items": [
|
|
573
|
+
{
|
|
574
|
+
"type": "function",
|
|
575
|
+
"name": "balance_of",
|
|
576
|
+
"inputs": [
|
|
577
|
+
{
|
|
578
|
+
"name": "account",
|
|
579
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
580
|
+
}
|
|
581
|
+
],
|
|
582
|
+
"outputs": [
|
|
583
|
+
{
|
|
584
|
+
"type": "core::integer::u256"
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
"state_mutability": "view"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"type": "function",
|
|
591
|
+
"name": "owner_of",
|
|
592
|
+
"inputs": [
|
|
593
|
+
{
|
|
594
|
+
"name": "token_id",
|
|
595
|
+
"type": "core::integer::u256"
|
|
596
|
+
}
|
|
597
|
+
],
|
|
598
|
+
"outputs": [
|
|
599
|
+
{
|
|
600
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
"state_mutability": "view"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"type": "function",
|
|
607
|
+
"name": "safe_transfer_from",
|
|
608
|
+
"inputs": [
|
|
609
|
+
{
|
|
610
|
+
"name": "from",
|
|
611
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"name": "to",
|
|
615
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"name": "token_id",
|
|
619
|
+
"type": "core::integer::u256"
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "data",
|
|
623
|
+
"type": "core::array::Span::<core::felt252>"
|
|
624
|
+
}
|
|
625
|
+
],
|
|
626
|
+
"outputs": [],
|
|
627
|
+
"state_mutability": "external"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"type": "function",
|
|
631
|
+
"name": "transfer_from",
|
|
632
|
+
"inputs": [
|
|
633
|
+
{
|
|
634
|
+
"name": "from",
|
|
635
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"name": "to",
|
|
639
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
"name": "token_id",
|
|
643
|
+
"type": "core::integer::u256"
|
|
644
|
+
}
|
|
645
|
+
],
|
|
646
|
+
"outputs": [],
|
|
647
|
+
"state_mutability": "external"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"type": "function",
|
|
651
|
+
"name": "approve",
|
|
652
|
+
"inputs": [
|
|
653
|
+
{
|
|
654
|
+
"name": "to",
|
|
655
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"name": "token_id",
|
|
659
|
+
"type": "core::integer::u256"
|
|
660
|
+
}
|
|
661
|
+
],
|
|
662
|
+
"outputs": [],
|
|
663
|
+
"state_mutability": "external"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"type": "function",
|
|
667
|
+
"name": "set_approval_for_all",
|
|
668
|
+
"inputs": [
|
|
669
|
+
{
|
|
670
|
+
"name": "operator",
|
|
671
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
"name": "approved",
|
|
675
|
+
"type": "core::bool"
|
|
676
|
+
}
|
|
677
|
+
],
|
|
678
|
+
"outputs": [],
|
|
679
|
+
"state_mutability": "external"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
"type": "function",
|
|
683
|
+
"name": "get_approved",
|
|
684
|
+
"inputs": [
|
|
685
|
+
{
|
|
686
|
+
"name": "token_id",
|
|
687
|
+
"type": "core::integer::u256"
|
|
688
|
+
}
|
|
689
|
+
],
|
|
690
|
+
"outputs": [
|
|
691
|
+
{
|
|
692
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
693
|
+
}
|
|
694
|
+
],
|
|
695
|
+
"state_mutability": "view"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"type": "function",
|
|
699
|
+
"name": "is_approved_for_all",
|
|
700
|
+
"inputs": [
|
|
701
|
+
{
|
|
702
|
+
"name": "owner",
|
|
703
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"name": "operator",
|
|
707
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
708
|
+
}
|
|
709
|
+
],
|
|
710
|
+
"outputs": [
|
|
711
|
+
{
|
|
712
|
+
"type": "core::bool"
|
|
713
|
+
}
|
|
714
|
+
],
|
|
715
|
+
"state_mutability": "view"
|
|
716
|
+
}
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"type": "impl",
|
|
721
|
+
"name": "ERC721MetadataImpl",
|
|
722
|
+
"interface_name": "openzeppelin_interfaces::token::erc721::IERC721Metadata"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"type": "struct",
|
|
726
|
+
"name": "core::byte_array::ByteArray",
|
|
727
|
+
"members": [
|
|
728
|
+
{
|
|
729
|
+
"name": "data",
|
|
730
|
+
"type": "core::array::Array::<core::bytes_31::bytes31>"
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
"name": "pending_word",
|
|
734
|
+
"type": "core::felt252"
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"name": "pending_word_len",
|
|
738
|
+
"type": "core::internal::bounded_int::BoundedInt::<0, 30>"
|
|
739
|
+
}
|
|
740
|
+
]
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
"type": "interface",
|
|
744
|
+
"name": "openzeppelin_interfaces::token::erc721::IERC721Metadata",
|
|
745
|
+
"items": [
|
|
746
|
+
{
|
|
747
|
+
"type": "function",
|
|
748
|
+
"name": "name",
|
|
749
|
+
"inputs": [],
|
|
750
|
+
"outputs": [
|
|
751
|
+
{
|
|
752
|
+
"type": "core::byte_array::ByteArray"
|
|
753
|
+
}
|
|
754
|
+
],
|
|
755
|
+
"state_mutability": "view"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"type": "function",
|
|
759
|
+
"name": "symbol",
|
|
760
|
+
"inputs": [],
|
|
761
|
+
"outputs": [
|
|
762
|
+
{
|
|
763
|
+
"type": "core::byte_array::ByteArray"
|
|
764
|
+
}
|
|
765
|
+
],
|
|
766
|
+
"state_mutability": "view"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"type": "function",
|
|
770
|
+
"name": "token_uri",
|
|
771
|
+
"inputs": [
|
|
772
|
+
{
|
|
773
|
+
"name": "token_id",
|
|
774
|
+
"type": "core::integer::u256"
|
|
775
|
+
}
|
|
776
|
+
],
|
|
777
|
+
"outputs": [
|
|
778
|
+
{
|
|
779
|
+
"type": "core::byte_array::ByteArray"
|
|
780
|
+
}
|
|
781
|
+
],
|
|
782
|
+
"state_mutability": "view"
|
|
783
|
+
}
|
|
784
|
+
]
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
"type": "impl",
|
|
788
|
+
"name": "ERC5192Impl",
|
|
789
|
+
"interface_name": "pop_protocol::interfaces::IERC5192"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
"type": "interface",
|
|
793
|
+
"name": "pop_protocol::interfaces::IERC5192",
|
|
794
|
+
"items": [
|
|
795
|
+
{
|
|
796
|
+
"type": "function",
|
|
797
|
+
"name": "locked",
|
|
798
|
+
"inputs": [
|
|
799
|
+
{
|
|
800
|
+
"name": "token_id",
|
|
801
|
+
"type": "core::integer::u256"
|
|
802
|
+
}
|
|
803
|
+
],
|
|
804
|
+
"outputs": [
|
|
805
|
+
{
|
|
806
|
+
"type": "core::bool"
|
|
807
|
+
}
|
|
808
|
+
],
|
|
809
|
+
"state_mutability": "view"
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
"type": "impl",
|
|
815
|
+
"name": "POPCollectionImpl",
|
|
816
|
+
"interface_name": "pop_protocol::interfaces::IPOPCollection"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
"type": "interface",
|
|
820
|
+
"name": "pop_protocol::interfaces::IPOPCollection",
|
|
821
|
+
"items": [
|
|
822
|
+
{
|
|
823
|
+
"type": "function",
|
|
824
|
+
"name": "set_allowlist_root",
|
|
825
|
+
"inputs": [
|
|
826
|
+
{
|
|
827
|
+
"name": "root",
|
|
828
|
+
"type": "core::felt252"
|
|
829
|
+
}
|
|
830
|
+
],
|
|
831
|
+
"outputs": [],
|
|
832
|
+
"state_mutability": "external"
|
|
833
|
+
},
|
|
834
|
+
{
|
|
835
|
+
"type": "function",
|
|
836
|
+
"name": "claim",
|
|
837
|
+
"inputs": [
|
|
838
|
+
{
|
|
839
|
+
"name": "proof",
|
|
840
|
+
"type": "core::array::Span::<core::felt252>"
|
|
841
|
+
}
|
|
842
|
+
],
|
|
843
|
+
"outputs": [],
|
|
844
|
+
"state_mutability": "external"
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"type": "function",
|
|
848
|
+
"name": "issue",
|
|
849
|
+
"inputs": [
|
|
850
|
+
{
|
|
851
|
+
"name": "recipient",
|
|
852
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"name": "token_uri",
|
|
856
|
+
"type": "core::byte_array::ByteArray"
|
|
857
|
+
}
|
|
858
|
+
],
|
|
859
|
+
"outputs": [],
|
|
860
|
+
"state_mutability": "external"
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
"type": "function",
|
|
864
|
+
"name": "burn",
|
|
865
|
+
"inputs": [
|
|
866
|
+
{
|
|
867
|
+
"name": "token_id",
|
|
868
|
+
"type": "core::integer::u256"
|
|
869
|
+
}
|
|
870
|
+
],
|
|
871
|
+
"outputs": [],
|
|
872
|
+
"state_mutability": "external"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
"type": "function",
|
|
876
|
+
"name": "organizer",
|
|
877
|
+
"inputs": [],
|
|
878
|
+
"outputs": [
|
|
879
|
+
{
|
|
880
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
881
|
+
}
|
|
882
|
+
],
|
|
883
|
+
"state_mutability": "view"
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"type": "function",
|
|
887
|
+
"name": "allowlist_root",
|
|
888
|
+
"inputs": [],
|
|
889
|
+
"outputs": [
|
|
890
|
+
{
|
|
891
|
+
"type": "core::felt252"
|
|
892
|
+
}
|
|
893
|
+
],
|
|
894
|
+
"state_mutability": "view"
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
"type": "function",
|
|
898
|
+
"name": "claim_end_time",
|
|
899
|
+
"inputs": [],
|
|
900
|
+
"outputs": [
|
|
901
|
+
{
|
|
902
|
+
"type": "core::integer::u64"
|
|
903
|
+
}
|
|
904
|
+
],
|
|
905
|
+
"state_mutability": "view"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"type": "function",
|
|
909
|
+
"name": "has_claimed",
|
|
910
|
+
"inputs": [
|
|
911
|
+
{
|
|
912
|
+
"name": "address",
|
|
913
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
914
|
+
}
|
|
915
|
+
],
|
|
916
|
+
"outputs": [
|
|
917
|
+
{
|
|
918
|
+
"type": "core::bool"
|
|
919
|
+
}
|
|
920
|
+
],
|
|
921
|
+
"state_mutability": "view"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"type": "function",
|
|
925
|
+
"name": "total_issued",
|
|
926
|
+
"inputs": [],
|
|
927
|
+
"outputs": [
|
|
928
|
+
{
|
|
929
|
+
"type": "core::integer::u256"
|
|
930
|
+
}
|
|
931
|
+
],
|
|
932
|
+
"state_mutability": "view"
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
"type": "function",
|
|
936
|
+
"name": "version",
|
|
937
|
+
"inputs": [],
|
|
938
|
+
"outputs": [
|
|
939
|
+
{
|
|
940
|
+
"type": "core::felt252"
|
|
941
|
+
}
|
|
942
|
+
],
|
|
943
|
+
"state_mutability": "view"
|
|
944
|
+
}
|
|
533
945
|
]
|
|
534
946
|
},
|
|
535
947
|
{
|
|
536
|
-
type: "
|
|
537
|
-
name: "
|
|
538
|
-
|
|
539
|
-
outputs: [],
|
|
540
|
-
state_mutability: "external"
|
|
948
|
+
"type": "impl",
|
|
949
|
+
"name": "SRC5Impl",
|
|
950
|
+
"interface_name": "openzeppelin_interfaces::introspection::ISRC5"
|
|
541
951
|
},
|
|
542
952
|
{
|
|
543
|
-
type: "
|
|
544
|
-
name: "
|
|
545
|
-
|
|
546
|
-
{
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
953
|
+
"type": "interface",
|
|
954
|
+
"name": "openzeppelin_interfaces::introspection::ISRC5",
|
|
955
|
+
"items": [
|
|
956
|
+
{
|
|
957
|
+
"type": "function",
|
|
958
|
+
"name": "supports_interface",
|
|
959
|
+
"inputs": [
|
|
960
|
+
{
|
|
961
|
+
"name": "interface_id",
|
|
962
|
+
"type": "core::felt252"
|
|
963
|
+
}
|
|
964
|
+
],
|
|
965
|
+
"outputs": [
|
|
966
|
+
{
|
|
967
|
+
"type": "core::bool"
|
|
968
|
+
}
|
|
969
|
+
],
|
|
970
|
+
"state_mutability": "view"
|
|
971
|
+
}
|
|
972
|
+
]
|
|
551
973
|
},
|
|
552
974
|
{
|
|
553
|
-
type: "
|
|
554
|
-
name: "
|
|
555
|
-
inputs: [
|
|
556
|
-
|
|
557
|
-
|
|
975
|
+
"type": "constructor",
|
|
976
|
+
"name": "constructor",
|
|
977
|
+
"inputs": [
|
|
978
|
+
{
|
|
979
|
+
"name": "name",
|
|
980
|
+
"type": "core::byte_array::ByteArray"
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
"name": "symbol",
|
|
984
|
+
"type": "core::byte_array::ByteArray"
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"name": "base_uri",
|
|
988
|
+
"type": "core::byte_array::ByteArray"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
"name": "organizer",
|
|
992
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
"name": "claim_end_time",
|
|
996
|
+
"type": "core::integer::u64"
|
|
997
|
+
}
|
|
998
|
+
]
|
|
558
999
|
},
|
|
559
1000
|
{
|
|
560
|
-
type: "
|
|
561
|
-
name: "
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
1001
|
+
"type": "event",
|
|
1002
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
|
|
1003
|
+
"kind": "struct",
|
|
1004
|
+
"members": [
|
|
1005
|
+
{
|
|
1006
|
+
"name": "from",
|
|
1007
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1008
|
+
"kind": "key"
|
|
1009
|
+
},
|
|
1010
|
+
{
|
|
1011
|
+
"name": "to",
|
|
1012
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1013
|
+
"kind": "key"
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
"name": "token_id",
|
|
1017
|
+
"type": "core::integer::u256",
|
|
1018
|
+
"kind": "key"
|
|
1019
|
+
}
|
|
1020
|
+
]
|
|
565
1021
|
},
|
|
566
1022
|
{
|
|
567
|
-
type: "
|
|
568
|
-
name: "
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
1023
|
+
"type": "event",
|
|
1024
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
|
|
1025
|
+
"kind": "struct",
|
|
1026
|
+
"members": [
|
|
1027
|
+
{
|
|
1028
|
+
"name": "owner",
|
|
1029
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1030
|
+
"kind": "key"
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
"name": "approved",
|
|
1034
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1035
|
+
"kind": "key"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
"name": "token_id",
|
|
1039
|
+
"type": "core::integer::u256",
|
|
1040
|
+
"kind": "key"
|
|
1041
|
+
}
|
|
1042
|
+
]
|
|
572
1043
|
},
|
|
573
1044
|
{
|
|
574
|
-
type: "
|
|
575
|
-
name: "
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
{
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1045
|
+
"type": "event",
|
|
1046
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
|
|
1047
|
+
"kind": "struct",
|
|
1048
|
+
"members": [
|
|
1049
|
+
{
|
|
1050
|
+
"name": "owner",
|
|
1051
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1052
|
+
"kind": "key"
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
"name": "operator",
|
|
1056
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1057
|
+
"kind": "key"
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
"name": "approved",
|
|
1061
|
+
"type": "core::bool",
|
|
1062
|
+
"kind": "data"
|
|
1063
|
+
}
|
|
1064
|
+
]
|
|
582
1065
|
},
|
|
583
1066
|
{
|
|
584
|
-
type: "
|
|
585
|
-
name: "
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
1067
|
+
"type": "event",
|
|
1068
|
+
"name": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
|
|
1069
|
+
"kind": "enum",
|
|
1070
|
+
"variants": [
|
|
1071
|
+
{
|
|
1072
|
+
"name": "Transfer",
|
|
1073
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::Transfer",
|
|
1074
|
+
"kind": "nested"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"name": "Approval",
|
|
1078
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::Approval",
|
|
1079
|
+
"kind": "nested"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
"name": "ApprovalForAll",
|
|
1083
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::ApprovalForAll",
|
|
1084
|
+
"kind": "nested"
|
|
1085
|
+
}
|
|
1086
|
+
]
|
|
589
1087
|
},
|
|
590
1088
|
{
|
|
591
|
-
type: "
|
|
592
|
-
name: "
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
state_mutability: "view"
|
|
1089
|
+
"type": "event",
|
|
1090
|
+
"name": "openzeppelin_introspection::src5::SRC5Component::Event",
|
|
1091
|
+
"kind": "enum",
|
|
1092
|
+
"variants": []
|
|
596
1093
|
},
|
|
597
1094
|
{
|
|
598
|
-
type: "
|
|
599
|
-
name: "
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
1095
|
+
"type": "event",
|
|
1096
|
+
"name": "pop_protocol::events::AllowlistRootSet",
|
|
1097
|
+
"kind": "struct",
|
|
1098
|
+
"members": [
|
|
1099
|
+
{
|
|
1100
|
+
"name": "root",
|
|
1101
|
+
"type": "core::felt252",
|
|
1102
|
+
"kind": "data"
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
603
1105
|
},
|
|
604
1106
|
{
|
|
605
|
-
type: "
|
|
606
|
-
name: "
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
1107
|
+
"type": "event",
|
|
1108
|
+
"name": "pop_protocol::events::TokenURISet",
|
|
1109
|
+
"kind": "struct",
|
|
1110
|
+
"members": [
|
|
1111
|
+
{
|
|
1112
|
+
"name": "token_id",
|
|
1113
|
+
"type": "core::integer::u256",
|
|
1114
|
+
"kind": "key"
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
"name": "uri",
|
|
1118
|
+
"type": "core::byte_array::ByteArray",
|
|
1119
|
+
"kind": "data"
|
|
1120
|
+
}
|
|
1121
|
+
]
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
"type": "event",
|
|
1125
|
+
"name": "pop_protocol::events::Locked",
|
|
1126
|
+
"kind": "struct",
|
|
1127
|
+
"members": [
|
|
1128
|
+
{
|
|
1129
|
+
"name": "token_id",
|
|
1130
|
+
"type": "core::integer::u256",
|
|
1131
|
+
"kind": "data"
|
|
1132
|
+
}
|
|
1133
|
+
]
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
"type": "event",
|
|
1137
|
+
"name": "pop_protocol::pop_collection::POPCollection::Event",
|
|
1138
|
+
"kind": "enum",
|
|
1139
|
+
"variants": [
|
|
1140
|
+
{
|
|
1141
|
+
"name": "ERC721Event",
|
|
1142
|
+
"type": "openzeppelin_token::erc721::erc721::ERC721Component::Event",
|
|
1143
|
+
"kind": "flat"
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
"name": "SRC5Event",
|
|
1147
|
+
"type": "openzeppelin_introspection::src5::SRC5Component::Event",
|
|
1148
|
+
"kind": "flat"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
"name": "AllowlistRootSet",
|
|
1152
|
+
"type": "pop_protocol::events::AllowlistRootSet",
|
|
1153
|
+
"kind": "nested"
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"name": "TokenURISet",
|
|
1157
|
+
"type": "pop_protocol::events::TokenURISet",
|
|
1158
|
+
"kind": "nested"
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
"name": "Locked",
|
|
1162
|
+
"type": "pop_protocol::events::Locked",
|
|
1163
|
+
"kind": "nested"
|
|
1164
|
+
}
|
|
1165
|
+
]
|
|
610
1166
|
}
|
|
611
1167
|
];
|
|
612
1168
|
|
|
613
1169
|
// src/starknet/abis/popFactory.ts
|
|
614
1170
|
var POPFactoryABI = [
|
|
615
1171
|
{
|
|
616
|
-
type: "
|
|
617
|
-
name: "
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
1172
|
+
"type": "impl",
|
|
1173
|
+
"name": "POPFactoryImpl",
|
|
1174
|
+
"interface_name": "pop_protocol::interfaces::IPOPFactory"
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
"type": "struct",
|
|
1178
|
+
"name": "core::byte_array::ByteArray",
|
|
1179
|
+
"members": [
|
|
1180
|
+
{
|
|
1181
|
+
"name": "data",
|
|
1182
|
+
"type": "core::array::Array::<core::bytes_31::bytes31>"
|
|
1183
|
+
},
|
|
1184
|
+
{
|
|
1185
|
+
"name": "pending_word",
|
|
1186
|
+
"type": "core::felt252"
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
"name": "pending_word_len",
|
|
1190
|
+
"type": "core::internal::bounded_int::BoundedInt::<0, 30>"
|
|
1191
|
+
}
|
|
622
1192
|
]
|
|
623
1193
|
},
|
|
624
1194
|
{
|
|
625
|
-
type: "
|
|
626
|
-
name: "
|
|
627
|
-
|
|
628
|
-
{
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
{
|
|
633
|
-
|
|
634
|
-
|
|
1195
|
+
"type": "struct",
|
|
1196
|
+
"name": "core::integer::u256",
|
|
1197
|
+
"members": [
|
|
1198
|
+
{
|
|
1199
|
+
"name": "low",
|
|
1200
|
+
"type": "core::integer::u128"
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
"name": "high",
|
|
1204
|
+
"type": "core::integer::u128"
|
|
1205
|
+
}
|
|
635
1206
|
]
|
|
636
1207
|
},
|
|
637
1208
|
{
|
|
638
|
-
type: "
|
|
639
|
-
name: "
|
|
640
|
-
|
|
641
|
-
{
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
1209
|
+
"type": "interface",
|
|
1210
|
+
"name": "pop_protocol::interfaces::IPOPFactory",
|
|
1211
|
+
"items": [
|
|
1212
|
+
{
|
|
1213
|
+
"type": "function",
|
|
1214
|
+
"name": "create_collection",
|
|
1215
|
+
"inputs": [
|
|
1216
|
+
{
|
|
1217
|
+
"name": "name",
|
|
1218
|
+
"type": "core::byte_array::ByteArray"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
"name": "symbol",
|
|
1222
|
+
"type": "core::byte_array::ByteArray"
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
"name": "base_uri",
|
|
1226
|
+
"type": "core::byte_array::ByteArray"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
"name": "claim_end_time",
|
|
1230
|
+
"type": "core::integer::u64"
|
|
1231
|
+
}
|
|
1232
|
+
],
|
|
1233
|
+
"outputs": [
|
|
1234
|
+
{
|
|
1235
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
1236
|
+
}
|
|
1237
|
+
],
|
|
1238
|
+
"state_mutability": "external"
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
"type": "function",
|
|
1242
|
+
"name": "get_collection_address",
|
|
1243
|
+
"inputs": [
|
|
1244
|
+
{
|
|
1245
|
+
"name": "collection_id",
|
|
1246
|
+
"type": "core::integer::u256"
|
|
1247
|
+
}
|
|
1248
|
+
],
|
|
1249
|
+
"outputs": [
|
|
1250
|
+
{
|
|
1251
|
+
"type": "core::starknet::contract_address::ContractAddress"
|
|
1252
|
+
}
|
|
1253
|
+
],
|
|
1254
|
+
"state_mutability": "view"
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
"type": "function",
|
|
1258
|
+
"name": "get_last_collection_id",
|
|
1259
|
+
"inputs": [],
|
|
1260
|
+
"outputs": [
|
|
1261
|
+
{
|
|
1262
|
+
"type": "core::integer::u256"
|
|
1263
|
+
}
|
|
1264
|
+
],
|
|
1265
|
+
"state_mutability": "view"
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
"type": "function",
|
|
1269
|
+
"name": "get_collection_class_hash",
|
|
1270
|
+
"inputs": [],
|
|
1271
|
+
"outputs": [
|
|
1272
|
+
{
|
|
1273
|
+
"type": "core::starknet::class_hash::ClassHash"
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1276
|
+
"state_mutability": "view"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
"type": "function",
|
|
1280
|
+
"name": "version",
|
|
1281
|
+
"inputs": [],
|
|
1282
|
+
"outputs": [
|
|
1283
|
+
{
|
|
1284
|
+
"type": "core::felt252"
|
|
1285
|
+
}
|
|
1286
|
+
],
|
|
1287
|
+
"state_mutability": "view"
|
|
1288
|
+
}
|
|
1289
|
+
]
|
|
649
1290
|
},
|
|
650
1291
|
{
|
|
651
|
-
type: "
|
|
652
|
-
name: "
|
|
653
|
-
inputs: [
|
|
654
|
-
{
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
state_mutability: "external"
|
|
1292
|
+
"type": "constructor",
|
|
1293
|
+
"name": "constructor",
|
|
1294
|
+
"inputs": [
|
|
1295
|
+
{
|
|
1296
|
+
"name": "collection_class_hash",
|
|
1297
|
+
"type": "core::starknet::class_hash::ClassHash"
|
|
1298
|
+
}
|
|
1299
|
+
]
|
|
660
1300
|
},
|
|
661
1301
|
{
|
|
662
|
-
type: "
|
|
663
|
-
name: "
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
1302
|
+
"type": "event",
|
|
1303
|
+
"name": "pop_protocol::events::CollectionCreated",
|
|
1304
|
+
"kind": "struct",
|
|
1305
|
+
"members": [
|
|
1306
|
+
{
|
|
1307
|
+
"name": "collection_id",
|
|
1308
|
+
"type": "core::integer::u256",
|
|
1309
|
+
"kind": "key"
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
"name": "organizer",
|
|
1313
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1314
|
+
"kind": "key"
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
"name": "collection_address",
|
|
1318
|
+
"type": "core::starknet::contract_address::ContractAddress",
|
|
1319
|
+
"kind": "data"
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
"name": "name",
|
|
1323
|
+
"type": "core::byte_array::ByteArray",
|
|
1324
|
+
"kind": "data"
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
"name": "symbol",
|
|
1328
|
+
"type": "core::byte_array::ByteArray",
|
|
1329
|
+
"kind": "data"
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
"name": "base_uri",
|
|
1333
|
+
"type": "core::byte_array::ByteArray",
|
|
1334
|
+
"kind": "data"
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
"name": "claim_end_time",
|
|
1338
|
+
"type": "core::integer::u64",
|
|
1339
|
+
"kind": "data"
|
|
1340
|
+
}
|
|
1341
|
+
]
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
"type": "event",
|
|
1345
|
+
"name": "pop_protocol::pop_factory::POPFactory::Event",
|
|
1346
|
+
"kind": "enum",
|
|
1347
|
+
"variants": [
|
|
1348
|
+
{
|
|
1349
|
+
"name": "CollectionCreated",
|
|
1350
|
+
"type": "pop_protocol::events::CollectionCreated",
|
|
1351
|
+
"kind": "nested"
|
|
1352
|
+
}
|
|
1353
|
+
]
|
|
667
1354
|
}
|
|
668
1355
|
];
|
|
669
1356
|
|
|
@@ -9051,74 +9738,149 @@ var IPGenesisABI = [
|
|
|
9051
9738
|
]
|
|
9052
9739
|
}
|
|
9053
9740
|
];
|
|
9741
|
+
var FRAGMENT_KEY = "pop-proof";
|
|
9742
|
+
var toHex = (x) => "0x" + x.toString(16).padStart(64, "0");
|
|
9743
|
+
var poseidon = (xs) => BigInt(hash.computePoseidonHashOnElements(xs.map((x) => "0x" + x.toString(16))));
|
|
9744
|
+
var nodeHash = (a, b) => a < b ? poseidon([a, b]) : poseidon([b, a]);
|
|
9745
|
+
function popLeafHash(address) {
|
|
9746
|
+
return poseidon([poseidon([BigInt(address)])]);
|
|
9747
|
+
}
|
|
9748
|
+
function merkleTree(leafHashes) {
|
|
9749
|
+
const leaves = [...leafHashes].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
9750
|
+
const tree = new Array(2 * leaves.length - 1);
|
|
9751
|
+
leaves.forEach((leaf, i) => tree[tree.length - 1 - i] = leaf);
|
|
9752
|
+
for (let i = tree.length - 1 - leaves.length; i >= 0; i--) {
|
|
9753
|
+
tree[i] = nodeHash(tree[2 * i + 1], tree[2 * i + 2]);
|
|
9754
|
+
}
|
|
9755
|
+
return {
|
|
9756
|
+
root: tree[0],
|
|
9757
|
+
proof(leaf) {
|
|
9758
|
+
let i = tree.lastIndexOf(leaf);
|
|
9759
|
+
if (i < tree.length - leaves.length) throw new Error("Not a leaf of this tree");
|
|
9760
|
+
const proof = [];
|
|
9761
|
+
while (i > 0) {
|
|
9762
|
+
proof.push(tree[i % 2 === 1 ? i + 1 : i - 1]);
|
|
9763
|
+
i = Math.floor((i - 1) / 2);
|
|
9764
|
+
}
|
|
9765
|
+
return proof;
|
|
9766
|
+
}
|
|
9767
|
+
};
|
|
9768
|
+
}
|
|
9769
|
+
function buildPopAllowlist(addresses) {
|
|
9770
|
+
const unique = [...new Set(addresses.map((a) => normalizeAddress("STARKNET", a)))];
|
|
9771
|
+
if (unique.length === 0) throw new Error("An allowlist needs at least one address");
|
|
9772
|
+
const leaves = unique.map((address) => ({ address, leaf: popLeafHash(address) }));
|
|
9773
|
+
const tree = merkleTree(leaves.map((l) => l.leaf));
|
|
9774
|
+
const proofs = {};
|
|
9775
|
+
for (const { address, leaf } of leaves) proofs[address] = tree.proof(leaf).map(toHex);
|
|
9776
|
+
return { root: toHex(tree.root), proofs };
|
|
9777
|
+
}
|
|
9778
|
+
function verifyPopProof(root, address, proof) {
|
|
9779
|
+
let computed = popLeafHash(address);
|
|
9780
|
+
for (const sibling of proof) computed = nodeHash(computed, BigInt(sibling));
|
|
9781
|
+
return computed === BigInt(root);
|
|
9782
|
+
}
|
|
9783
|
+
function encodePopClaimFragment(proof) {
|
|
9784
|
+
return `#${FRAGMENT_KEY}=${proof.join(",")}`;
|
|
9785
|
+
}
|
|
9786
|
+
function decodePopClaimFragment(fragment) {
|
|
9787
|
+
const raw = new URLSearchParams(fragment.replace(/^#/, "")).get(FRAGMENT_KEY);
|
|
9788
|
+
if (raw === null) return null;
|
|
9789
|
+
if (raw === "") return [];
|
|
9790
|
+
const parts = raw.split(",");
|
|
9791
|
+
return parts.every((p) => /^0x[0-9a-fA-F]{1,64}$/.test(p)) ? parts : null;
|
|
9792
|
+
}
|
|
9793
|
+
|
|
9794
|
+
// src/starknet/pop-claim.ts
|
|
9795
|
+
function popClaimLinks(origin, collection, list) {
|
|
9796
|
+
const base = `${origin}${collectionHref("STARKNET", collection)}`;
|
|
9797
|
+
return Object.entries(list.proofs).map(([address, proof]) => ({
|
|
9798
|
+
address,
|
|
9799
|
+
url: `${base}${encodePopClaimFragment(proof)}`
|
|
9800
|
+
}));
|
|
9801
|
+
}
|
|
9802
|
+
function popClaimLinksCsv(links) {
|
|
9803
|
+
return ["address,claim_link", ...links.map((l) => `${l.address},${l.url}`)].join("\n");
|
|
9804
|
+
}
|
|
9805
|
+
async function popClaimInfo(provider, collection) {
|
|
9806
|
+
const contractAddress = normalizeAddress("STARKNET", collection);
|
|
9807
|
+
const [root, end] = await Promise.all([
|
|
9808
|
+
provider.callContract({ contractAddress, entrypoint: "allowlist_root", calldata: [] }),
|
|
9809
|
+
provider.callContract({ contractAddress, entrypoint: "claim_end_time", calldata: [] })
|
|
9810
|
+
]);
|
|
9811
|
+
return { root: root[0] ?? "0x0", claimEndTime: Number(BigInt(end[0] ?? "0x0")) };
|
|
9812
|
+
}
|
|
9813
|
+
function popClaimState(input) {
|
|
9814
|
+
const { hasClaimed, proof, wallet, info } = input;
|
|
9815
|
+
if (hasClaimed === true) return "claimed";
|
|
9816
|
+
if (hasClaimed === null || info === null) return "loading";
|
|
9817
|
+
if (BigInt(info.root) === 0n) return "closed";
|
|
9818
|
+
if (info.claimEndTime !== 0 && info.now > info.claimEndTime) return "ended";
|
|
9819
|
+
if (proof === null) return "no-link";
|
|
9820
|
+
if (!wallet || !verifyPopProof(info.root, wallet, proof)) return "wrong-wallet";
|
|
9821
|
+
return "ready";
|
|
9822
|
+
}
|
|
9823
|
+
var addr = (a) => normalizeAddress("STARKNET", a);
|
|
9824
|
+
var byteArrayFelts = (s) => CallData.compile([byteArray.byteArrayFromString(s)]);
|
|
9825
|
+
var popCalls = {
|
|
9826
|
+
claim(collection, proof) {
|
|
9827
|
+
return { contractAddress: addr(collection), entrypoint: "claim", calldata: [String(proof.length), ...proof] };
|
|
9828
|
+
},
|
|
9829
|
+
/** An empty `tokenUri` uses the collection's URI. */
|
|
9830
|
+
issue(collection, recipient, tokenUri = "") {
|
|
9831
|
+
return { contractAddress: addr(collection), entrypoint: "issue", calldata: [addr(recipient), ...byteArrayFelts(tokenUri)] };
|
|
9832
|
+
},
|
|
9833
|
+
/** Only the token's holder can burn it. */
|
|
9834
|
+
burn(collection, tokenId) {
|
|
9835
|
+
const id = cairo.uint256(BigInt(tokenId));
|
|
9836
|
+
return { contractAddress: addr(collection), entrypoint: "burn", calldata: [String(id.low), String(id.high)] };
|
|
9837
|
+
},
|
|
9838
|
+
setAllowlistRoot(collection, root) {
|
|
9839
|
+
return { contractAddress: addr(collection), entrypoint: "set_allowlist_root", calldata: [root] };
|
|
9840
|
+
}
|
|
9841
|
+
};
|
|
9054
9842
|
|
|
9055
9843
|
// src/starknet/services/pop.ts
|
|
9056
9844
|
var PopService = class {
|
|
9057
9845
|
constructor(config) {
|
|
9058
9846
|
this.factoryAddress = getStarknetCoordinates(config.chain).popFactory;
|
|
9059
9847
|
}
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
async claim(account, collectionAddress) {
|
|
9064
|
-
const call = this._collection(collectionAddress, account).populate("claim", []);
|
|
9065
|
-
const res = await account.execute([call]);
|
|
9066
|
-
return { txHash: res.transaction_hash };
|
|
9067
|
-
}
|
|
9068
|
-
async adminMint(account, params) {
|
|
9069
|
-
const call = this._collection(params.collection, account).populate("admin_mint", [
|
|
9070
|
-
params.recipient,
|
|
9071
|
-
params.customUri ?? ""
|
|
9072
|
-
]);
|
|
9073
|
-
const res = await account.execute([call]);
|
|
9074
|
-
return { txHash: res.transaction_hash };
|
|
9075
|
-
}
|
|
9076
|
-
async addToAllowlist(account, params) {
|
|
9077
|
-
const call = this._collection(params.collection, account).populate("add_to_allowlist", [params.address]);
|
|
9848
|
+
async createCollection(account, params) {
|
|
9849
|
+
const factory = newContract(POPFactoryABI, this.factoryAddress, account);
|
|
9850
|
+
const call = factory.populate("create_collection", [params.name, params.symbol, params.baseUri, params.claimEndTime]);
|
|
9078
9851
|
const res = await account.execute([call]);
|
|
9079
9852
|
return { txHash: res.transaction_hash };
|
|
9080
9853
|
}
|
|
9081
|
-
async
|
|
9082
|
-
const
|
|
9083
|
-
const CHUNK = 200;
|
|
9084
|
-
const calls = [];
|
|
9085
|
-
for (let i = 0; i < params.addresses.length; i += CHUNK) {
|
|
9086
|
-
calls.push(collection.populate("batch_add_to_allowlist", [params.addresses.slice(i, i + CHUNK)]));
|
|
9087
|
-
}
|
|
9088
|
-
const res = await account.execute(calls);
|
|
9089
|
-
return { txHash: res.transaction_hash };
|
|
9090
|
-
}
|
|
9091
|
-
async removeFromAllowlist(account, params) {
|
|
9092
|
-
const call = this._collection(params.collection, account).populate("remove_from_allowlist", [params.address]);
|
|
9854
|
+
async setAllowlistRoot(account, params) {
|
|
9855
|
+
const call = popCalls.setAllowlistRoot(params.collection, params.root);
|
|
9093
9856
|
const res = await account.execute([call]);
|
|
9094
9857
|
return { txHash: res.transaction_hash };
|
|
9095
9858
|
}
|
|
9096
|
-
async
|
|
9097
|
-
const call =
|
|
9098
|
-
BigInt(params.tokenId),
|
|
9099
|
-
params.uri
|
|
9100
|
-
]);
|
|
9859
|
+
async claim(account, params) {
|
|
9860
|
+
const call = popCalls.claim(params.collection, params.proof);
|
|
9101
9861
|
const res = await account.execute([call]);
|
|
9102
9862
|
return { txHash: res.transaction_hash };
|
|
9103
9863
|
}
|
|
9104
|
-
async
|
|
9105
|
-
const call =
|
|
9864
|
+
async issue(account, params) {
|
|
9865
|
+
const call = popCalls.issue(params.collection, params.recipient, params.tokenUri);
|
|
9106
9866
|
const res = await account.execute([call]);
|
|
9107
9867
|
return { txHash: res.transaction_hash };
|
|
9108
9868
|
}
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
const call =
|
|
9112
|
-
params.name,
|
|
9113
|
-
params.symbol,
|
|
9114
|
-
params.baseUri,
|
|
9115
|
-
params.claimEndTime,
|
|
9116
|
-
{ [params.eventType]: {} }
|
|
9117
|
-
]);
|
|
9869
|
+
/** Destroys the caller's own credential; the address cannot receive another from this collection. */
|
|
9870
|
+
async burn(account, params) {
|
|
9871
|
+
const call = popCalls.burn(params.collection, params.tokenId);
|
|
9118
9872
|
const res = await account.execute([call]);
|
|
9119
9873
|
return { txHash: res.transaction_hash };
|
|
9120
9874
|
}
|
|
9121
9875
|
};
|
|
9876
|
+
async function popHasClaimed(provider, collection, address) {
|
|
9877
|
+
const res = await provider.callContract({
|
|
9878
|
+
contractAddress: normalizeAddress("STARKNET", collection),
|
|
9879
|
+
entrypoint: "has_claimed",
|
|
9880
|
+
calldata: [normalizeAddress("STARKNET", address)]
|
|
9881
|
+
});
|
|
9882
|
+
return BigInt(res[0] ?? "0x0") !== 0n;
|
|
9883
|
+
}
|
|
9122
9884
|
function buildFeeCall(p, cfg) {
|
|
9123
9885
|
if (!cfg.enabled || !cfg.fundAddress) return null;
|
|
9124
9886
|
const bps = p.surface === "marketplace" ? cfg.marketplaceBps : p.surface === "launchpad" ? cfg.launchpadBps : cfg.sponsorshipBps;
|
|
@@ -11328,6 +12090,6 @@ async function claimSessionWallet(api, walletAddress, deps) {
|
|
|
11328
12090
|
if (removeOwnerGuid) await deps.removeOwner(sealed, removeOwnerGuid);
|
|
11329
12091
|
}
|
|
11330
12092
|
|
|
11331
|
-
export { MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FundingTransferNotSentError, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidPairingPayloadError, InvalidRecoveryKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, accountFor, adoptSessionWallet, allowsFallbackFunding, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildCancelEscapeCall, buildCancellationTypedData, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildFundingTransferCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, canRemoveDevice, claimSessionWallet, toRaw as coinToRaw, completeDeployment, computeOwnerGuid, confirmIntentBestEffort, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, deploySelfFunded, deploySponsored, deployedCollectionFromReceipt, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, encodeByteArray, encodePairingPayload, encodeRecoveryKey, estimateSelfFundedFee, executeIntent, executeIntents, executeSponsored, fdvHuman, fundWithChainTransfer, fundingApiFor, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isDeployed, isSiwsTokenValid, isValidStarknetAddress, mintedTokenIdFromReceipt, normalizeSiwsSignature, normalizeWalletAddress, parseAccountAddress, parseCreatorCoinCreated, parsePairingPayload, parseRecoveryKey, priceToEkuboParams, requestSiwsToken, selfFundedExecutor, sponsoredExecutor, storeSiwsToken, syncTransactionBestEffort, teamCoinsRaw, toContractConditions as toDropContractConditions, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, waitUntilDeployed };
|
|
12093
|
+
export { MAX_SUPPLY as COIN_MAX_SUPPLY, MIN_SUPPLY as COIN_MIN_SUPPLY, ClubService, CreatorCoinFactoryABI, CreatorCoinService, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FundingTransferNotSentError, IPClubCollectionABI, IPClubFactoryABI, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPGenesisABI, IPMarketplaceABI, IPNftABI, IPSponsorshipABI, IPTicketCollectionABI, IPTicketCollectionFactoryABI, InvalidPairingPayloadError, InvalidRecoveryKeyError, MAX_HOLDERS_AT_LAUNCH, MAX_TEAM_ALLOCATION_PERCENT, Medialane1155ABI, MedialaneClient, MedialaneError, POPCollectionABI, POPFactoryABI, PopService, SUGGESTED_DEFAULT_PRICE, SponsoredCallRejectedError, SponsorshipService, StarknetVenue, TicketService, VALIDATED_EKUBO_PARAMS, accountFor, adoptSessionWallet, allowsFallbackFunding, assertTransactionSucceeded, build1155CancellationTypedData, build1155OrderTypedData, buildAddOwnerCall, buildCancelEscapeCall, buildCancellationTypedData, buildCompleteEscapeOwnerCall, buildCreateCreatorCoinCall, buildDeployAccountParams, buildFeeCall, buildFundingTransferCall, buildLaunchOnEkuboCalls, buildOrderTypedData, buildPopAllowlist, buildRemoveOwnerByGuidCall, buildRemoveOwnerCall, buildSetFirstGuardianCall, buildTriggerEscapeOwnerCall, buybackQuoteRaw, canRemoveDevice, claimSessionWallet, toRaw as coinToRaw, completeDeployment, computeOwnerGuid, confirmIntentBestEffort, createDeploymentCoordinator, createMediaWallet, createOwnerStore, createSelfFundConsent, decodeEscapeAndStatus, decodeGuardiansInfo, decodePopClaimFragment, deploySelfFunded, deploySponsored, deployedCollectionFromReceipt, deriveOwnerKeyPair, describeDevices, describeGuardianStatus, describeRecoveryAction, encodeByteArray, encodePairingPayload, encodePopClaimFragment, encodeRecoveryKey, estimateSelfFundedFee, executeIntent, executeIntents, executeSponsored, fdvHuman, fundWithChainTransfer, fundingApiFor, getCounter, getCounter1155, getCreatorCoinGuarantees, getEscape, getEscapeSecurityPeriod, getGuardians, getOrderDetails, getOrderDetails1155, getOwners, getSiwsStorageKey, getStoredSiwsToken, isDeployed, isSiwsTokenValid, isValidStarknetAddress, mintedTokenIdFromReceipt, normalizeSiwsSignature, normalizeWalletAddress, parseAccountAddress, parseCreatorCoinCreated, parsePairingPayload, parseRecoveryKey, popCalls, popClaimInfo, popClaimLinks, popClaimLinksCsv, popClaimState, popHasClaimed, priceToEkuboParams, requestSiwsToken, selfFundedExecutor, sponsoredExecutor, storeSiwsToken, syncTransactionBestEffort, teamCoinsRaw, toContractConditions as toDropContractConditions, validateName as validateCoinName, validateSupply as validateCoinSupply, validateSymbol as validateCoinSymbol, validatePrice, verifyPopProof, waitUntilDeployed };
|
|
11332
12094
|
//# sourceMappingURL=index.js.map
|
|
11333
12095
|
//# sourceMappingURL=index.js.map
|