Skip to content

Instantly share code, notes, and snippets.

@shaojunda
Created March 28, 2022 10:39
Show Gist options
  • Save shaojunda/ed0bd1aba726e7103b46e1614c289cae to your computer and use it in GitHub Desktop.
Save shaojunda/ed0bd1aba726e7103b46e1614c289cae to your computer and use it in GitHub Desktop.
issuer_lock = issuer.enterprise_user.ec_key_pair.default_lock_script
api = CkbSdkApiService.instance
cota_type_script = CKB::Types::Script.new(code_hash: api.cota_script_code_hash, args: issuer_lock.compute_hash[0..41], hash_type: api.cota_script_hash_type)
cota_type_filter = CKB::Indexer::Types::SearchKeyFilter.new(script: cota_type_script)
cota_search_key = CKB::Indexer::Types::SearchKey.new(issuer_lock, "lock", filter: cota_type_filter)
cota_collector = Collectors::CkbCollector.new(search_key: cota_search_key)
cell = cota_collector.collect.to_a.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment