Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: refactor predicate support to work through Wallet and Provider directly #461

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

camsjams
Copy link
Contributor

@camsjams camsjams commented Aug 18, 2022

Fixes #392

This moves Predicates much closer to a streamlined approach. If using a Wallet, a developer can then leverage the wallet's address and coin information when interacting with Predicates, both in creation and spending.

If using a Predicate that has fees already pre-paid, developers can work through the Provider directly with the receiver address of their choice.

@github-actions
Copy link
Contributor

Total Coverage: 89.80%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
packages/abi-coder/src
   abi-coder.ts87.10%100%95.89%115, 116, 34, 34, 43, 53, 54
   index.ts100%53.85%100%
   interface.ts73.08%90.91%90.32%113, 114, 132, 144, 144, 144, 146, 146, 147, 150, 42, 47, 92
   json-abi.ts100%100%100%
   utilities.ts100%100%100%
packages/abi-coder/src/coders
   abstract-coder.ts100%100%87.50%46
   array.ts50%100%93.75%23, 24
   b256.ts66.67%100%94.12%31, 32
   boolean.ts60%100%82.35%17, 19, 20, 31, 32
   byte.ts50%100%94.12%29, 30
   enum.ts66.67%100%97.14%59, 60
   number.ts100%100%100%
   string.ts100%100%100%
   struct.ts100%100%100%
   tuple.ts100%100%100%
packages/abi-coder/src/fragments
   fragment.ts100%100%100%
   function-fragment.ts100%100%100%
   param-type.ts83.33%100%97.37%105, 106, 71, 75
packages/address/src
   address.ts71.43%100%95.65%107, 25, 26
   index.ts100%100%100%
   utils.ts87.50%100%96.55%83, 84
packages/constants/src
   index.ts100%100%100%
packages/contract/src
   index.ts100%100%100%
   scripts.ts81.25%100%93.88%36, 37, 89, 90, 92, 93
   util.ts0%100%96%41, 42
packages/contract/src/__test__
   test-utils.ts0%100%100%13, 20
packages/contract/src/contracts
   contract-factory.ts57.14%80%78.38%33, 37, 38, 43, 46, 46, 46, 47, 48, 50, 51, 56, 60, 61
   contract.ts80%100%100%23
packages/contract/src/contracts/functions
   base-invocation-scope.ts93.75%100%100%143, 166
   invocation-results.ts66.67%100%100%14, 28
   invocation-scope.ts60%100%100%23, 40
   multicall-scope.ts100%100%100%
packages/contract/src/contracts/multicall/out/debug
   multicall-bin.ts100%100%100%
packages/example-contract/src/example-contract-types
   index.ts100%100%100%
packages/example-contract/src/example-contract-types/factories
   ExampleContractAbi__factory.ts100%50%83.33%37
packages/fuels/src
   index.ts100%100%100%
packages/hasher/src
   hasher.ts87.50%100%97.44%39, 57
   index.ts100%100%100%
packages/hdwallet/src
   hdwallet-spec.ts100%100%100%
   hdwallet.ts80.39%100%95.96%127, 128, 190, 191, 22, 22, 229, 24, 26, 39, 42, 43, 96, 97
   index.ts100%100%100%
packages/interfaces/src
   index.ts100%100%100%
packages/keystore/src
   aes-ctr-node.ts100%100%100%
   aes-ctr-web.ts100%0%24%15, 16, 17, 18, 19, 24, 25, 27, 39, 40, 41, 42, 44, 49, 51, 52, 54, 55, 57
   aes-ctr.ts80%75%72.22%19, 19, 20, 23, 26, 38
   index.ts100%100%100%
   keystore.ts50%75%100%17, 27
   randomBytes.ts50%100%100%4
   universal-crypto.ts83.33%100%72.73%15, 18, 19, 29
packages/math/src
   convert.ts66.67%100%85.71%28, 29, 37, 38, 43, 49, 49, 50, 54, 55
   index.ts100%100%100%
   math.ts100%100%100%
packages/merkle-shared/src
   common.ts100%100%100%
   cryptography.ts100%100%100%
   index.ts100%100%100%
packages/merkle/src
   binaryMerkleTree.ts71.43%100%97.01%110, 113, 72, 73
   index.ts100%100%100%
packages/merkle/src/types
   node.ts100%100%100%
packages/merklesum/src
   sumMerkleTree.ts83.33%100%97.01%128, 132, 133
packages/merklesum/src/types
   node.ts100%100%100%
   proof.ts100%100%100%
packages/mnemonic/src
   index.ts100%100%100%
   mnemonic-specs.ts100%100%100%
   mnemonic.ts80.95%100%96.08%141, 142, 157, 40, 41, 83
   utils.ts56.25%100%79.17%17, 20, 20, 20, 21, 22, 24, 24, 24, 24, 25, 29, 30, 31, 32, 33, 35, 36, 37, 58, 62, 63
packages/predicate/src
   predicate.ts100%100%100%
packages/predicate/src/test-predicate-address
   index.ts100%100%100%
packages/predicate/src/test-predicate-false
   index.ts100%100%100%
packages/predicate/src/test-predicate-struct
   index.ts100%100%100%
packages/predicate/src/test-predicate-true
   index.ts100%100%100%
packages/predicate/src/test-predicate-u32
   index.ts100%100%100%
packages/providers/src
   coin-quantity.ts66.67%100%100%16, 19
   coin.ts100%0%100%
   index.ts100%100%100%
   provider.ts47.37%73.53%71.64%106, 114, 204, 214, 215, 253, 254, 257, 258, 349, 406, 406, 406, 407, 408, 408, 408, 409, 411, 414, 416, 416, 417, 420, 425, 437, 437, 437, 438, 439, 439, 439, 440, 442, 445, 447, 447, 448, 451, 456, 458, 467, 468, 468, 469, 471, 480, 481, 481, 482, 484, 531, 572, 573, 574, 604, 605, 610
   util.ts27.27%42.86%37.50%15, 16, 16, 16, 16, 18, 19, 22, 25, 29, 30, 30, 31, 41, 44, 45, 45, 45, 45, 45, 47, 54, 60, 68, 73, 77, 79, 81
packages/providers/src/__generated__
   operations.ts100%64%81.44%1457, 1459, 1486, 1488, 1500, 1502, 1515, 1517, 1529, 1531, 1544, 1546, 1558, 1560, 1600, 1602, 1698, 1700
packages/providers/src/transaction-request
   index.ts100%100%100%
   input.ts77.78%100%90%35, 49, 69
   output.ts71.43%100%83.33%106, 57, 57, 75
   storage-slot.ts50%100%83.33%25, 26, 27
   transaction-request.ts65.22%70.37%76.98%122, 132, 144, 145, 146, 195, 196, 202, 203, 208, 209, 236, 238, 238, 239, 242, 269, 270, 293, 320, 358, 359, 371, 378, 379, 404, 405, 414, 460, 460, 461, 463, 477, 485, 486, 488, 494, 495, 503, 504, 510, 512, 539, 539, 544, 547, 78, 79, 83, 84, 85, 86, 91, 92, 93, 94
   witness.ts100%100%100%
packages/providers/src/transaction-response
   index.ts100%100%100%
   transaction-response.ts33.33%100%75.76%100, 101, 110, 110, 110, 113, 116, 117, 118, 138, 147, 148, 63, 71
packages/script/src
   errors.ts0%0%27.78%11, 11, 11, 14, 14, 14, 18, 19, 21, 21, 21, 24, 28, 29, 29, 29, 31, 31, 31, 34, 37, 37, 43, 44, 48, 49, 49, 50, 50
   index.ts100%100%100%
   script.ts28.57%66.67%77.14%114, 41, 42, 44, 45, 48, 49, 51, 52, 56, 86, 94, 95
   scripts.ts100%0%50%18, 19
packages/signer/src
   index.ts100%100%100%
   signer.ts75%100%97.37%33, 33, 35
packages/sparsemerkle/src
   deepSparseMerkleSubTree.ts66.67%60%75%13, 14, 20, 21, 37, 38
   index.ts100%100%100%
   proofs.ts63.64%100%85.11%25, 27, 27, 27, 28, 31, 32, 32, 34, 36, 37
   sparseMerkleTree.ts77.50%100%91.60%105, 106, 116, 118, 126, 128, 129, 131, 139, 139, 143, 144, 147, 161, 162, 277, 280, 98, 99
   treeHasher.ts100%100%100%
   utils.ts100%100%100%
packages/sparsemerkle/src/types
   sparseCompactMerkleProof.ts100%100%100%
   sparseMerkleProof.ts100%100%100%
packages/transactions/src
   consts.ts100%100%100%
   index.ts100%100%100%
packages/transactions/src/coders
   byte-array.ts100%100%100%
   input.ts75%100%97.53%174, 184, 197, 207
   output.ts87.50%100%98.48%316, 342, 355, 381
   receipt.ts87.50%97.06%97.27%627, 629, 630, 632, 676, 676, 714, 715, 718, 731, 773
   storage-slot.ts100%100%100%
   transaction.ts75%100%98.55%304, 314, 327, 337
   utxo-id.ts100%100%100%
   witness.ts100%100%100%
packages/typechain-target-fuels/src/codegen
   types.ts66.04%66.67%61.19%102, 104, 116, 117, 120, 120, 120, 120, 148, 149, 152, 152, 152, 152, 153, 155, 156, 159, 161, 163, 24, 25, 25, 25, 27, 27, 28, 31, 39, 41, 41, 44, 44, 45, 47, 50, 52, 52, 53, 56, 64, 64, 95, 96
packages/typechain-target-fuels/src/parser
   abiParser.ts44.44%86.96%65%148, 200, 201, 209, 210, 218, 219, 227, 228, 252, 253, 253, 263, 264, 266, 269, 269, 270, 273, 273, 274, 277, 277, 278, 280, 280, 280, 280, 281, 284, 291, 292, 294, 297, 297, 297, 297, 297, 299, 299, 299, 302, 302, 303, 304, 304, 305, 305, 305, 306, 307, 307, 310
   parseSvmTypes.ts50%100%88%127, 128, 165, 176, 187, 192, 196, 196, 196, 196, 196, 200, 206, 208, 212, 216
packages/wallet-manager/src
   wallet-manager-spec.ts100%100%100%
   wallet-manager.ts100%100%100%
packages/wallet-manager/src/storages
   memory-storage.ts100%100%100%
packages/wallet-manager/src/vaults
   mnemonic-vault.ts85.71%100%93.33%21, 71, 74
   privatekey-vault.ts60%100%95%24, 57, 58
packages/wallet/src
   index.ts100%100%100%
   test-utils.ts66.67%100%100%8
   wallet-spec.ts100%100%100%
   wallet.ts75%95.83%94.74%138, 147, 148, 149, 175, 199, 245, 334, 62, 63
packages/wordlists/src
   index.ts100%100%100%
packages/wordlists/src/words
   english.ts100%100%100%

@camsjams camsjams merged commit dafeeff into feature/bech32 Aug 19, 2022
@camsjams camsjams deleted the cm/issue-392 branch August 19, 2022 22:54
camsjams pushed a commit that referenced this pull request Aug 22, 2022
* Rebase

* Refactor

* Adjust usage of address

* Update deps

* Adjust wallet test

* Fix comparison

* Update predicate usage

* Add to contract

* adjust contract

* Add util

* Add helper

* Update wallet manager

* Cleanup

* Update contract tweaks

* add CS

* Use AbstractAddress

* Fix address usage

* Fix generated types and usage

* Update test

* revert

* tired of this lint

* Refactor

* use static helpers and new method names

* refactor to make encoding transparent

* relocate into helper

* Lint

* Enforce type stronger

* Adjust test

* fix lint

* feat!: refactor predicate support to work through Wallet and Provider directly (#461)

relocate predicate related helpers
petertonysmith94 pushed a commit that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants