> For the complete documentation index, see [llms.txt](https://docs.flowty.io/developer-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowty.io/developer-docs/hybrid-custody/resources-and-transactions.md).

# Resources and Transactions

Transaction samples to get you started

## What you probably need

We anticipate that most applications will fall under one of two categories.

1. Share all NFT Collections with a parent, and nothing else
2. Share *some* NFT Collections with a parent, and nothing else

Importantly, both of these setup options give no access to Fungible Token capabilities that are not on public paths. Below are some sample transactions depending on the kind of steps you want to follow. You can deploy your own version of the CapabilityFactory and CapabilityFilter resources should you want to customize their behavior

<details>

<summary>Share all NFT Collections</summary>

Use this setup flow if you want to give access to all NFT Collections with a parent account.

* Testnet
  * [Set up Child Account](https://tinyurl.com/2239j46t)
  * [Share with Parent](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweDI5NGU0NGUxZWM2OTkzYzYKCmltcG9ydCBDYXBhYmlsaXR5RmFjdG9yeSBmcm9tIDB4Mjk0ZTQ0ZTFlYzY5OTNjNgppbXBvcnQgQ2FwYWJpbGl0eUZpbHRlciBmcm9tIDB4Mjk0ZTQ0ZTFlYzY5OTNjNgoKdHJhbnNhY3Rpb24ocGFyZW50OiBBZGRyZXNzLCBmYWN0b3J5QWRkcmVzczogQWRkcmVzcywgZmlsdGVyQWRkcmVzczogQWRkcmVzcykgewogICAgcHJlcGFyZShhY2N0OiBBdXRoQWNjb3VudCkgewogICAgICAgIGxldCBjaGlsZCA9IGFjY3QuYm9ycm93PCZIeWJyaWRDdXN0b2R5Lk93bmVkQWNjb3VudD4oZnJvbTogSHlicmlkQ3VzdG9keS5Pd25lZEFjY291bnRTdG9yYWdlUGF0aCkKICAgICAgICAgICAgPz8gcGFuaWMoImNoaWxkIGFjY291bnQgbm90IGZvdW5kIikKCiAgICAgICAgbGV0IGZhY3RvcnkgPSBnZXRBY2NvdW50KGZhY3RvcnlBZGRyZXNzKS5nZXRDYXBhYmlsaXR5PCZDYXBhYmlsaXR5RmFjdG9yeS5NYW5hZ2Vye0NhcGFiaWxpdHlGYWN0b3J5LkdldHRlcn0%2BKENhcGFiaWxpdHlGYWN0b3J5LlB1YmxpY1BhdGgpCiAgICAgICAgYXNzZXJ0KGZhY3RvcnkuY2hlY2soKSwgbWVzc2FnZTogImZhY3RvcnkgYWRkcmVzcyBpcyBub3QgY29uZmlndXJlZCBwcm9wZXJseSIpCgogICAgICAgIGxldCBmaWx0ZXIgPSBnZXRBY2NvdW50KGZpbHRlckFkZHJlc3MpLmdldENhcGFiaWxpdHk8JntDYXBhYmlsaXR5RmlsdGVyLkZpbHRlcn0%2BKENhcGFiaWxpdHlGaWx0ZXIuUHVibGljUGF0aCkKICAgICAgICBhc3NlcnQoZmlsdGVyLmNoZWNrKCksIG1lc3NhZ2U6ICJjYXBhYmlsaXR5IGZpbHRlciBpcyBub3QgY29uZmlndXJlZCBwcm9wZXJseSIpCgogICAgICAgIGNoaWxkLnB1Ymxpc2hUb1BhcmVudChwYXJlbnRBZGRyZXNzOiBwYXJlbnQsIGZhY3Rvcnk6IGZhY3RvcnksIGZpbHRlcjogZmlsdGVyKQogICAgfQp9\&network=testnet\&args=eyJwYXJlbnQiOiIweDEiLCJmYWN0b3J5QWRkcmVzcyI6IjB4MTA1NTk3MGVlMzRlZjRkYyIsImZpbHRlckFkZHJlc3MiOiIweGUyNjY0YmUwNmJiMGZlNjIifQ%3D%3D)
  * [All in one](https://tinyurl.com/mss9bxev) (if you can sign from both accounts)
* Mainnet
  * [Set up Child Account](https://tinyurl.com/yarvtk6v)
  * [Share with Parent](https://tinyurl.com/25anwxn4)
  * [All in one](https://tinyurl.com/bddkzpr6) (if you can sign from both accounts)

</details>

<details>

<summary>Share access to some NFT Collections (allow list)</summary>

Use this setup flow if you want to give access to specific NFT Collections with a parent account

**NOTE: Unlike sharing access to all collections, there is no pre-made sample that can be used to express an allow-list. You must create one yourself and decide how to manage it.**

* Allow List Filter Management
  * Testnet
    * [Initialize Allow List filter](https://tinyurl.com/y9eb8ptc)
    * [Add type to filter](https://tinyurl.com/46fy2fhh)
  * Mainnet
    * [Initialize Allow List filter](https://tinyurl.com/mvrnnskk)
    * [Add type to filter](https://tinyurl.com/muvhwzee)

Once you have your Filter created, you can initialize and publish your child account

* Multi-step
  * Testnet
    * [Setup Child Account](https://tinyurl.com/2239j46t)
    * [Share with Parent](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweDI5NGU0NGUxZWM2OTkzYzYKCmltcG9ydCBDYXBhYmlsaXR5RmFjdG9yeSBmcm9tIDB4Mjk0ZTQ0ZTFlYzY5OTNjNgppbXBvcnQgQ2FwYWJpbGl0eUZpbHRlciBmcm9tIDB4Mjk0ZTQ0ZTFlYzY5OTNjNgoKdHJhbnNhY3Rpb24ocGFyZW50OiBBZGRyZXNzLCBmYWN0b3J5QWRkcmVzczogQWRkcmVzcywgZmlsdGVyQWRkcmVzczogQWRkcmVzcykgewogICAgcHJlcGFyZShhY2N0OiBBdXRoQWNjb3VudCkgewogICAgICAgIGxldCBjaGlsZCA9IGFjY3QuYm9ycm93PCZIeWJyaWRDdXN0b2R5Lk93bmVkQWNjb3VudD4oZnJvbTogSHlicmlkQ3VzdG9keS5Pd25lZEFjY291bnRTdG9yYWdlUGF0aCkKICAgICAgICAgICAgPz8gcGFuaWMoImNoaWxkIGFjY291bnQgbm90IGZvdW5kIikKCiAgICAgICAgbGV0IGZhY3RvcnkgPSBnZXRBY2NvdW50KGZhY3RvcnlBZGRyZXNzKS5nZXRDYXBhYmlsaXR5PCZDYXBhYmlsaXR5RmFjdG9yeS5NYW5hZ2Vye0NhcGFiaWxpdHlGYWN0b3J5LkdldHRlcn0%2BKENhcGFiaWxpdHlGYWN0b3J5LlB1YmxpY1BhdGgpCiAgICAgICAgYXNzZXJ0KGZhY3RvcnkuY2hlY2soKSwgbWVzc2FnZTogImZhY3RvcnkgYWRkcmVzcyBpcyBub3QgY29uZmlndXJlZCBwcm9wZXJseSIpCgogICAgICAgIGxldCBmaWx0ZXIgPSBnZXRBY2NvdW50KGZpbHRlckFkZHJlc3MpLmdldENhcGFiaWxpdHk8JntDYXBhYmlsaXR5RmlsdGVyLkZpbHRlcn0%2BKENhcGFiaWxpdHlGaWx0ZXIuUHVibGljUGF0aCkKICAgICAgICBhc3NlcnQoZmlsdGVyLmNoZWNrKCksIG1lc3NhZ2U6ICJjYXBhYmlsaXR5IGZpbHRlciBpcyBub3QgY29uZmlndXJlZCBwcm9wZXJseSIpCgogICAgICAgIGNoaWxkLnB1Ymxpc2hUb1BhcmVudChwYXJlbnRBZGRyZXNzOiBwYXJlbnQsIGZhY3Rvcnk6IGZhY3RvcnksIGZpbHRlcjogZmlsdGVyKQogICAgfQp9\&network=testnet\&args=eyJwYXJlbnQiOiIweDEiLCJmYWN0b3J5QWRkcmVzcyI6IjB4MTA1NTk3MGVlMzRlZjRkYyIsImZpbHRlckFkZHJlc3MiOiIweFlvdXJDYXBhYmlsaXR5RmlsdGVyQWRkcmVzcyJ9)
  * Mainnet
    * [Setup Child Account](https://tinyurl.com/4ddf4dvp)
    * [Share with Parent](https://tinyurl.com/34m63tnu)
* All in one transaction (set up child and publish parent in one transaction)
  * [Testnet](https://tinyurl.com/mr3f6dsy)
  * [Mainnet](https://tinyurl.com/4twe2yhn)

</details>

<details>

<summary>Share access to all but some NFT Collections (deny list)</summary>

Use this setup flow if you want to give access to all NFT Collections **except** the types you add to your deny list

**NOTE: Unlike sharing access to all collections, there is no pre-made sample that can be used to express a deny-list. You must create one yourself and decide how to manage it.**

* Allow List Filter Management
  * Testnet
    * [Initialize Deny List filter](https://tinyurl.com/bvyknftw)
    * [Add type to filter](https://tinyurl.com/yu79mmma)
  * Mainnet
    * [Initialize Deny List filter](https://tinyurl.com/3a9t6a2p)
    * [Add type to filter](https://tinyurl.com/2y62cuje)

Once you have your Filter created, you can initialize and publish your child account

* All in one transaction (set up child and publish parent in one transaction)
  * [Testnet](https://tinyurl.com/mr3f6dsy)
  * [Mainnet](https://tinyurl.com/4ktb4tay)
* Multi-step
  * Testnet
    * [Setup Child Account](https://tinyurl.com/2239j46t)
    * [Share with Parent](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweDI5NGU0NGUxZWM2OTkzYzYKCmltcG9ydCBDYXBhYmlsaXR5RmFjdG9yeSBmcm9tIDB4Mjk0ZTQ0ZTFlYzY5OTNjNgppbXBvcnQgQ2FwYWJpbGl0eUZpbHRlciBmcm9tIDB4Mjk0ZTQ0ZTFlYzY5OTNjNgoKdHJhbnNhY3Rpb24ocGFyZW50OiBBZGRyZXNzLCBmYWN0b3J5QWRkcmVzczogQWRkcmVzcywgZmlsdGVyQWRkcmVzczogQWRkcmVzcykgewogICAgcHJlcGFyZShhY2N0OiBBdXRoQWNjb3VudCkgewogICAgICAgIGxldCBjaGlsZCA9IGFjY3QuYm9ycm93PCZIeWJyaWRDdXN0b2R5Lk93bmVkQWNjb3VudD4oZnJvbTogSHlicmlkQ3VzdG9keS5Pd25lZEFjY291bnRTdG9yYWdlUGF0aCkKICAgICAgICAgICAgPz8gcGFuaWMoImNoaWxkIGFjY291bnQgbm90IGZvdW5kIikKCiAgICAgICAgbGV0IGZhY3RvcnkgPSBnZXRBY2NvdW50KGZhY3RvcnlBZGRyZXNzKS5nZXRDYXBhYmlsaXR5PCZDYXBhYmlsaXR5RmFjdG9yeS5NYW5hZ2Vye0NhcGFiaWxpdHlGYWN0b3J5LkdldHRlcn0%2BKENhcGFiaWxpdHlGYWN0b3J5LlB1YmxpY1BhdGgpCiAgICAgICAgYXNzZXJ0KGZhY3RvcnkuY2hlY2soKSwgbWVzc2FnZTogImZhY3RvcnkgYWRkcmVzcyBpcyBub3QgY29uZmlndXJlZCBwcm9wZXJseSIpCgogICAgICAgIGxldCBmaWx0ZXIgPSBnZXRBY2NvdW50KGZpbHRlckFkZHJlc3MpLmdldENhcGFiaWxpdHk8JntDYXBhYmlsaXR5RmlsdGVyLkZpbHRlcn0%2BKENhcGFiaWxpdHlGaWx0ZXIuUHVibGljUGF0aCkKICAgICAgICBhc3NlcnQoZmlsdGVyLmNoZWNrKCksIG1lc3NhZ2U6ICJjYXBhYmlsaXR5IGZpbHRlciBpcyBub3QgY29uZmlndXJlZCBwcm9wZXJseSIpCgogICAgICAgIGNoaWxkLnB1Ymxpc2hUb1BhcmVudChwYXJlbnRBZGRyZXNzOiBwYXJlbnQsIGZhY3Rvcnk6IGZhY3RvcnksIGZpbHRlcjogZmlsdGVyKQogICAgfQp9\&network=testnet\&args=eyJwYXJlbnQiOiIweDEiLCJmYWN0b3J5QWRkcmVzcyI6IjB4MTA1NTk3MGVlMzRlZjRkYyIsImZpbHRlckFkZHJlc3MiOiIweFlvdXJDYXBhYmlsaXR5RmlsdGVyQWRkcmVzcyJ9)
  * Mainnet
    * [Setup Child Account](https://tinyurl.com/4ddf4dvp)
    * [Share with Parent](https://tinyurl.com/5arrz8cw)

</details>

### Pre-made resources

Flow has created a few common resources for you to use. If you would like to set your own up, you can find a link to set transactions for each resource to run on your own account to get the same effect.&#x20;

#### What Capability types can be obtained?

The CapabilityFactory used in a ChildAccount resource is used to express what types `T` can be obtained from a child account from a parent. For example, a CapabilityFactory with an entry that can return `Capability<&{NonFungibleToken.Provider}>` would be giving the ability for a parent to obtain NFT Provider capabilities.&#x20;

{% hint style="info" %}
A Capability can only be obtained if a child account's CapabilityFilter permits it, there is a CapabilityFactory for the type of the Capability requested, **and** the path being requested exists.
{% endhint %}

{% hint style="danger" %}
The order of types specified by a CapabilityFactory **matter**! There is an [open ticket](https://github.com/onflow/cadence/issues/2681) to handle this. Until it is settled, please take note of the types you are linking or expecting to be accessible.
{% endhint %}

### Capability Factory pre-made resources

<details>

<summary>All NFT standard interfaces</summary>

Testnet - [0x1055970ee34ef4dc](https://f.dnz.dev/0x1055970ee34ef4dc/storage/CapabilityFactory_0x294e44e1ec6993c6)

Mainnet - [0xee9ff4f07a2d6dad](https://f.dnz.dev/0xee9ff4f07a2d6dad/storage/CapabilityFactory_0xd8a7e05a7ac670c0)

This pre-made CapabilityFactory resource can be used if you want to give a parent account access to the following Capability\<T> types:

* `&{NonFungibleToken.CollectionPublic}`
* `&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}`
* `&{NonFungibleToken.Provider}`

</details>

<details>

<summary>All FungibleToken standard interfaces</summary>

Testnet - [0x08bed9e8508ed20e](https://f.dnz.dev/0x08bed9e8508ed20e/storage/CapabilityFactory_0x294e44e1ec6993c6)

Mainnet - [0x410aa603925923d9](https://f.dnz.dev/0x410aa603925923d9/storage/CapabilityFactory_0xd8a7e05a7ac670c0)

This pre-made CapabilityFactory resource can be used if you want to give a parent account access to the following Capability\<T> types:

* `&{FungibleToken.Provider}`
* `&{FungibleToken.Provider, FungibleToken.Balance, FungibleToken.Receiver}`
* `&{FungibleToken.Balance}`
* `&{FungibleToken.Receiver}`
* `&{FungibleToken.Receiver, FungibleToken.Balance}`

</details>

<details>

<summary>All NFT and Fungible Token interfaces</summary>

Testnet - [0x1b7fa5972fcb8af5](https://f.dnz.dev/0x1b7fa5972fcb8af5/storage/CapabilityFactory_0x294e44e1ec6993c6)

Mainnet - [0x071d382668250606](https://f.dnz.dev/0x071d382668250606/storage/CapabilityFactory_0xd8a7e05a7ac670c0)

This pre-made CapabilityFactory resource can be used if you want to give a parent account access to the following Capability\<T> types:

* `&{NonFungibleToken.CollectionPublic}`
* `&{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}`
* `&{NonFungibleToken.Provider}`
* `&{FungibleToken.Provider}`
* `&{FungibleToken.Provider, FungibleToken.Balance, FungibleToken.Receiver}`
* `&{FungibleToken.Balance}`
* `&{FungibleToken.Receiver}`
* `&{FungibleToken.Receiver, FungibleToken.Balance}`

</details>

{% hint style="info" %}
Once an account is published, you can claim them from your specified parent address using the [#redeem-a-child-account](#redeem-a-child-account "mention") transaction
{% endhint %}

### Capability Filter pre-made resources

<details>

<summary>Allow all filter</summary>

The allow all filter allows any resource to be borrowed from a child account, provided that it can be obtained through the child account's Capability Filter.

Testnet - [0xe2664be06bb0fe62](https://f.dnz.dev/0xe2664be06bb0fe62/storage/CapabilityFilter_0x294e44e1ec6993c6)

Mainnet - [0x78e93a79b05d0d7d](https://f.dnz.dev/0x78e93a79b05d0d7d/storage/CapabilityFilter_0xd8a7e05a7ac670c0)

</details>

### Common Transactions

<details>

<summary>Set up a child account</summary>

Configures the necessary resources on what will become a child account. Once set up, you will be ready to publish the account to any other address for it to redeem and become a parent

[Testnet](https://tinyurl.com/2239j46t)

[Mainnet](https://tinyurl.com/4ddf4dvp)

</details>

<details>

<summary>Publish a child account</summary>

Takes the account which should be the child of another account and publishes it for the parent to redeem.&#x20;

[Testnet](https://tinyurl.com/4xn22wv4)

[Mainnet](https://tinyurl.com/yd3r29ns)

</details>

<details>

<summary>Redeem a child account</summary>

In order for a child account to be accessible to a parent, it must be redeemed, first. While redeeming, you can set some metadata about the child account to make it easily identifiable to platforms

[Testnet](https://tinyurl.com/5n7x234t)

[Mainnet](https://tinyurl.com/2p953tdf)

</details>

<details>

<summary>Remove a child account</summary>

If you are a parent account and no longer wish to have a particular child account anymore, you can unlink it. Doing so will revoke the ability to access a child's capabilities from the parent account, but could be added later if the child publishes their account to the parent again.

[Testnet](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweDI5NGU0NGUxZWM2OTkzYzYKCnRyYW5zYWN0aW9uKGNoaWxkOiBBZGRyZXNzKSB7CiAgICBwcmVwYXJlIChhY2N0OiBBdXRoQWNjb3VudCkgewogICAgICAgIGxldCBtYW5hZ2VyID0gYWNjdC5ib3Jyb3c8Jkh5YnJpZEN1c3RvZHkuTWFuYWdlcj4oZnJvbTogSHlicmlkQ3VzdG9keS5NYW5hZ2VyU3RvcmFnZVBhdGgpCiAgICAgICAgICAgID8%2FIHBhbmljKCJtYW5hZ2VyIG5vdCBmb3VuZCIpCiAgICAgICAgbWFuYWdlci5yZW1vdmVDaGlsZChhZGRyOiBjaGlsZCkKICAgIH0KfQ%3D%3D\&network=testnet\&args=eyJjaGlsZCI6IjB4Q2hpbGRBZGRyZXNzSGVyZSJ9)

[Mainnet](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweGQ4YTdlMDVhN2FjNjcwYzAKCnRyYW5zYWN0aW9uKGNoaWxkOiBBZGRyZXNzKSB7CiAgICBwcmVwYXJlIChhY2N0OiBBdXRoQWNjb3VudCkgewogICAgICAgIGxldCBtYW5hZ2VyID0gYWNjdC5ib3Jyb3c8Jkh5YnJpZEN1c3RvZHkuTWFuYWdlcj4oZnJvbTogSHlicmlkQ3VzdG9keS5NYW5hZ2VyU3RvcmFnZVBhdGgpCiAgICAgICAgICAgID8%2FIHBhbmljKCJtYW5hZ2VyIG5vdCBmb3VuZCIpCiAgICAgICAgbWFuYWdlci5yZW1vdmVDaGlsZChhZGRyOiBjaGlsZCkKICAgIH0KfQ%3D%3D\&network=mainnet\&args=eyJjaGlsZCI6IjB4Q2hpbGRBZGRyZXNzSGVyZSJ9)

</details>

<details>

<summary>Remove a parent account</summary>

A child account is able to remove parent accounts at any time. Doing so will prevent the removed parent from accessing any new capabilities. However, it will not unlink any existing capabilities the parent already has

[Testnet](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweDI5NGU0NGUxZWM2OTkzYzYKCnRyYW5zYWN0aW9uKHBhcmVudDogQWRkcmVzcykgewogICAgcHJlcGFyZSAoYWNjdDogQXV0aEFjY291bnQpIHsKICAgICAgICBsZXQgb3duZWRBY2NvdW50ID0gYWNjdC5ib3Jyb3c8Jkh5YnJpZEN1c3RvZHkuT3duZWRBY2NvdW50Pihmcm9tOiBIeWJyaWRDdXN0b2R5Lk93bmVkQWNjb3VudFN0b3JhZ2VQYXRoKQogICAgICAgICAgICA%2FPyBwYW5pYygib3duZWQgYWNjb3VudCBub3QgZm91bmQiKQogICAgICAgIG93bmVkQWNjb3VudC5yZW1vdmVQYXJlbnQoYWRkcjogcGFyZW50KQogICAgfQp9\&network=testnet\&args=eyJwYXJlbnQiOiIweFBhcmVudEFkZHJlc3NIZXJlIn0%3D)

[Mainnet](https://run.ecdao.org?code=aW1wb3J0IEh5YnJpZEN1c3RvZHkgZnJvbSAweGQ4YTdlMDVhN2FjNjcwYzAKCnRyYW5zYWN0aW9uKHBhcmVudDogQWRkcmVzcykgewogICAgcHJlcGFyZSAoYWNjdDogQXV0aEFjY291bnQpIHsKICAgICAgICBsZXQgb3duZWRBY2NvdW50ID0gYWNjdC5ib3Jyb3c8Jkh5YnJpZEN1c3RvZHkuT3duZWRBY2NvdW50Pihmcm9tOiBIeWJyaWRDdXN0b2R5Lk93bmVkQWNjb3VudFN0b3JhZ2VQYXRoKQogICAgICAgICAgICA%2FPyBwYW5pYygib3duZWQgYWNjb3VudCBub3QgZm91bmQiKQogICAgICAgIG93bmVkQWNjb3VudC5yZW1vdmVQYXJlbnQoYWRkcjogcGFyZW50KQogICAgfQp9\&network=mainnet\&args=eyJwYXJlbnQiOiIweFBhcmVudEFkZHJlc3NIZXJlIn0%3D)

</details>
