@flowtyio/flow-contracts 0.1.0-beta.12 → 0.1.0-beta.13

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.
@@ -12,8 +12,9 @@ access(all) contract CapabilityDelegator {
12
12
  /* --- Canonical Paths --- */
13
13
  //
14
14
  access(all) let StoragePath: StoragePath
15
- access(all) let PrivatePath: PrivatePath
16
15
  access(all) let PublicPath: PublicPath
16
+
17
+ access(all) entitlement Get
17
18
 
18
19
  /* --- Events --- */
19
20
  //
@@ -23,13 +24,13 @@ access(all) contract CapabilityDelegator {
23
24
  /// Private interface for Capability retrieval
24
25
  ///
25
26
  access(all) resource interface GetterPrivate {
26
- access(Capabilities) view fun getPrivateCapability(_ type: Type): Capability? {
27
+ access(Get) view fun getPrivateCapability(_ type: Type): Capability? {
27
28
  post {
28
29
  result == nil || type.isSubtype(of: result.getType()): "incorrect returned capability type"
29
30
  }
30
31
  }
31
32
  access(all) view fun findFirstPrivateType(_ type: Type): Type?
32
- access(Capabilities) fun getAllPrivate(): [Capability]
33
+ access(Get) fun getAllPrivate(): [Capability]
33
34
  }
34
35
 
35
36
  /// Exposes public Capability retrieval
@@ -66,7 +67,7 @@ access(all) contract CapabilityDelegator {
66
67
  /// @param type: Type of the Capability to retrieve
67
68
  /// @return Capability of the given Type if it exists, nil otherwise
68
69
  ///
69
- access(Capabilities) view fun getPrivateCapability(_ type: Type): Capability? {
70
+ access(Get) view fun getPrivateCapability(_ type: Type): Capability? {
70
71
  return self.privateCapabilities[type]
71
72
  }
72
73
 
@@ -82,7 +83,7 @@ access(all) contract CapabilityDelegator {
82
83
  ///
83
84
  /// @return List of all private Capabilities
84
85
  ///
85
- access(Capabilities) fun getAllPrivate(): [Capability] {
86
+ access(Get) fun getAllPrivate(): [Capability] {
86
87
  return self.privateCapabilities.values
87
88
  }
88
89
 
@@ -122,7 +123,7 @@ access(all) contract CapabilityDelegator {
122
123
  /// @param cap: Capability to add
123
124
  /// @param isPublic: Whether the Capability should be public or private
124
125
  ///
125
- access(Mutate) fun addCapability(cap: Capability, isPublic: Bool) {
126
+ access(Mutate | Insert) fun addCapability(cap: Capability, isPublic: Bool) {
126
127
  pre {
127
128
  cap.check<&AnyResource>(): "Invalid Capability provided"
128
129
  }
@@ -138,7 +139,7 @@ access(all) contract CapabilityDelegator {
138
139
  ///
139
140
  /// @param cap: Capability to remove
140
141
  ///
141
- access(Mutate) fun removeCapability(cap: Capability) {
142
+ access(Mutate | Remove) fun removeCapability(cap: Capability) {
142
143
  if let removedPublic = self.publicCapabilities.remove(key: cap.getType()) {
143
144
  emit DelegatorUpdated(id: self.uuid, capabilityType: cap.getType(), isPublic: true, active: false)
144
145
  }
@@ -167,7 +168,6 @@ access(all) contract CapabilityDelegator {
167
168
  init() {
168
169
  let identifier = "CapabilityDelegator_".concat(self.account.address.toString())
169
170
  self.StoragePath = StoragePath(identifier: identifier)!
170
- self.PrivatePath = PrivatePath(identifier: identifier)!
171
171
  self.PublicPath = PublicPath(identifier: identifier)!
172
172
  }
173
173
  }
@@ -16,14 +16,13 @@
16
16
  access(all) contract CapabilityFactory {
17
17
 
18
18
  access(all) let StoragePath: StoragePath
19
- access(all) let PrivatePath: PrivatePath
20
19
  access(all) let PublicPath: PublicPath
21
20
 
22
21
  /// Factory structures a common interface for Capability retrieval from a given account at a specified path
23
22
  ///
24
23
  access(all) struct interface Factory {
25
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability?
26
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability?
24
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability?
25
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability?
27
26
  }
28
27
 
29
28
  /// Getter defines an interface for retrieval of a Factory if contained within the implementing resource
@@ -61,7 +60,7 @@ access(all) contract CapabilityFactory {
61
60
  /// @param t: Type of Capability the Factory retrieves
62
61
  /// @param f: Factory to add
63
62
  ///
64
- access(Mutate) fun addFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
63
+ access(Mutate | Insert) fun addFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
65
64
  pre {
66
65
  !self.factories.containsKey(t): "Factory of given type already exists"
67
66
  }
@@ -73,7 +72,7 @@ access(all) contract CapabilityFactory {
73
72
  /// @param t: Type of Capability the Factory retrieves
74
73
  /// @param f: Factory to replace existing Factory
75
74
  ///
76
- access(Mutate) fun updateFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
75
+ access(Mutate | Insert) fun updateFactory(_ t: Type, _ f: {CapabilityFactory.Factory}) {
77
76
  self.factories[t] = f
78
77
  }
79
78
 
@@ -81,7 +80,7 @@ access(all) contract CapabilityFactory {
81
80
  ///
82
81
  /// @param t: Type the Factory is indexed on
83
82
  ///
84
- access(Mutate) fun removeFactory(_ t: Type): {CapabilityFactory.Factory}? {
83
+ access(Mutate | Remove) fun removeFactory(_ t: Type): {CapabilityFactory.Factory}? {
85
84
  return self.factories.remove(key: t)
86
85
  }
87
86
 
@@ -100,7 +99,6 @@ access(all) contract CapabilityFactory {
100
99
  init() {
101
100
  let identifier = "CapabilityFactory_".concat(self.account.address.toString())
102
101
  self.StoragePath = StoragePath(identifier: identifier)!
103
- self.PrivatePath = PrivatePath(identifier: identifier)!
104
102
  self.PublicPath = PublicPath(identifier: identifier)!
105
103
  }
106
104
  }
@@ -12,7 +12,6 @@ access(all) contract CapabilityFilter {
12
12
  //
13
13
  access(all) let StoragePath: StoragePath
14
14
  access(all) let PublicPath: PublicPath
15
- access(all) let PrivatePath: PrivatePath
16
15
 
17
16
  /* --- Events --- */
18
17
  //
@@ -39,7 +38,7 @@ access(all) contract CapabilityFilter {
39
38
  ///
40
39
  /// @param type: The type to add to the denied types mapping
41
40
  ///
42
- access(Mutate) fun addType(_ type: Type) {
41
+ access(Mutate | Insert) fun addType(_ type: Type) {
43
42
  self.deniedTypes.insert(key: type, true)
44
43
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: true)
45
44
  }
@@ -48,7 +47,7 @@ access(all) contract CapabilityFilter {
48
47
  ///
49
48
  /// @param type: The type to remove from the denied types mapping
50
49
  ///
51
- access(Mutate) fun removeType(_ type: Type) {
50
+ access(Mutate | Remove) fun removeType(_ type: Type) {
52
51
  if let removed = self.deniedTypes.remove(key: type) {
53
52
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: false)
54
53
  }
@@ -56,7 +55,7 @@ access(all) contract CapabilityFilter {
56
55
 
57
56
  /// Removes all types from the mapping of denied types
58
57
  ///
59
- access(Mutate) fun removeAllTypes() {
58
+ access(Mutate | Remove) fun removeAllTypes() {
60
59
  for type in self.deniedTypes.keys {
61
60
  self.removeType(type)
62
61
  }
@@ -106,7 +105,7 @@ access(all) contract CapabilityFilter {
106
105
  ///
107
106
  /// @param type: The type to add to the allowed types mapping
108
107
  ///
109
- access(Mutate) fun addType(_ type: Type) {
108
+ access(Mutate | Insert) fun addType(_ type: Type) {
110
109
  self.allowedTypes.insert(key: type, true)
111
110
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: true)
112
111
  }
@@ -115,7 +114,7 @@ access(all) contract CapabilityFilter {
115
114
  ///
116
115
  /// @param type: The type to remove from the denied types mapping
117
116
  ///
118
- access(Mutate) fun removeType(_ type: Type) {
117
+ access(Mutate | Remove) fun removeType(_ type: Type) {
119
118
  if let removed = self.allowedTypes.remove(key: type) {
120
119
  emit FilterUpdated(id: self.uuid, filterType: self.getType(), type: type, active: false)
121
120
  }
@@ -123,7 +122,7 @@ access(all) contract CapabilityFilter {
123
122
 
124
123
  /// Removes all types from the mapping of denied types
125
124
  ///
126
- access(Mutate) fun removeAllTypes() {
125
+ access(Mutate | Remove) fun removeAllTypes() {
127
126
  for type in self.allowedTypes.keys {
128
127
  self.removeType(type)
129
128
  }
@@ -210,6 +209,5 @@ access(all) contract CapabilityFilter {
210
209
 
211
210
  self.StoragePath = StoragePath(identifier: identifier)!
212
211
  self.PublicPath = PublicPath(identifier: identifier)!
213
- self.PrivatePath = PrivatePath(identifier: identifier)!
214
212
  }
215
- }
213
+ }
@@ -32,7 +32,6 @@ import "CapabilityFilter"
32
32
  access(all) contract HybridCustody {
33
33
  access(all) entitlement Owner
34
34
  access(all) entitlement Child
35
- access(all) entitlement Publish
36
35
  access(all) entitlement Manage
37
36
 
38
37
  /* --- Canonical Paths --- */
@@ -41,14 +40,9 @@ access(all) contract HybridCustody {
41
40
  //
42
41
  access(all) let OwnedAccountStoragePath: StoragePath
43
42
  access(all) let OwnedAccountPublicPath: PublicPath
44
- access(all) let OwnedAccountPrivatePath: PrivatePath
45
43
 
46
44
  access(all) let ManagerStoragePath: StoragePath
47
45
  access(all) let ManagerPublicPath: PublicPath
48
- access(all) let ManagerPrivatePath: PrivatePath
49
-
50
- access(all) let LinkedAccountPrivatePath: PrivatePath
51
- access(all) let BorrowableAccountPrivatePath: PrivatePath
52
46
 
53
47
  /* --- Events --- */
54
48
  //
@@ -113,13 +107,13 @@ access(all) contract HybridCustody {
113
107
  access(all) resource interface OwnedAccountPrivate {
114
108
  /// Deletes the ChildAccount resource being used to share access to this OwnedAccount with the supplied parent
115
109
  /// address, and unlinks the paths it was using to reach the underlying account.
116
- access(Owner | Remove) fun removeParent(parent: Address): Bool
110
+ access(Owner) fun removeParent(parent: Address): Bool
117
111
 
118
112
  /// Sets up a new ChildAccount resource for the given parentAddress to redeem. This child account uses the
119
113
  /// supplied factory and filter to manage what can be obtained from the child account, and a new
120
114
  /// CapabilityDelegator resource is created for the sharing of one-off capabilities. Each of these pieces of
121
115
  /// access control are managed through the child account.
122
- access(Publish | Owner) fun publishToParent(
116
+ access(Owner) fun publishToParent(
123
117
  parentAddress: Address,
124
118
  factory: Capability<&{CapabilityFactory.Getter}>,
125
119
  filter: Capability<&{CapabilityFilter.Filter}>
@@ -153,7 +147,7 @@ access(all) contract HybridCustody {
153
147
  }
154
148
 
155
149
  /// Override the existing CapabilityFilter Capability for a given parent. This will allow the owner of the
156
- /// account to start managing their own filter for retrieving Capabilities on Private Paths
150
+ /// account to start managing their own filter for retrieving Capabilities
157
151
  access(Owner) fun setCapabilityFilterForParent(parent: Address, cap: Capability<&{CapabilityFilter.Filter}>) {
158
152
  pre {
159
153
  cap.check(): "Invalid CapabilityFilter Capability provided"
@@ -240,13 +234,13 @@ access(all) contract HybridCustody {
240
234
  /// Entry point for a parent to obtain, maintain and access Capabilities or perform other actions on child accounts
241
235
  ///
242
236
  access(all) resource interface ManagerPrivate {
243
- access(Manage) fun addAccount(cap: Capability<auth(Child) &{AccountPrivate, AccountPublic, ViewResolver.Resolver}>)
237
+ access(Manage | Insert) fun addAccount(cap: Capability<auth(Child) &{AccountPrivate, AccountPublic, ViewResolver.Resolver}>)
244
238
  access(Manage) fun borrowAccount(addr: Address): auth(Child) &{AccountPrivate, AccountPublic, ViewResolver.Resolver}?
245
- access(Manage) fun removeChild(addr: Address)
246
- access(Manage) fun addOwnedAccount(cap: Capability<auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}>)
239
+ access(Manage | Remove) fun removeChild(addr: Address)
240
+ access(Manage | Insert) fun addOwnedAccount(cap: Capability<auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}>)
247
241
  access(Manage) fun borrowOwnedAccount(addr: Address): auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}?
248
- access(Manage) fun removeOwned(addr: Address)
249
- access(Manage) fun setManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?, childAddress: Address) {
242
+ access(Manage | Remove) fun removeOwned(addr: Address)
243
+ access(Manage | Mutate) fun setManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?, childAddress: Address) {
250
244
  pre {
251
245
  cap == nil || cap!.check(): "Invalid Manager Capability Filter"
252
246
  }
@@ -256,10 +250,10 @@ access(all) contract HybridCustody {
256
250
  /// Functions anyone can call on a manager to get information about an account such as What child accounts it has
257
251
  /// Functions anyone can call on a manager to get information about an account such as what child accounts it has
258
252
  access(all) resource interface ManagerPublic {
259
- access(all) fun borrowAccountPublic(addr: Address): &{AccountPublic, ViewResolver.Resolver}?
260
- access(all) fun getChildAddresses(): [Address]
261
- access(all) fun getOwnedAddresses(): [Address]
262
- access(all) fun getChildAccountDisplay(address: Address): MetadataViews.Display?
253
+ access(all) view fun borrowAccountPublic(addr: Address): &{AccountPublic, ViewResolver.Resolver}?
254
+ access(all) view fun getChildAddresses(): [Address]
255
+ access(all) view fun getOwnedAddresses(): [Address]
256
+ access(all) view fun getChildAccountDisplay(address: Address): MetadataViews.Display?
263
257
  access(contract) fun removeParentCallback(child: Address)
264
258
  }
265
259
 
@@ -288,7 +282,7 @@ access(all) contract HybridCustody {
288
282
 
289
283
  /// Sets the Display on the ChildAccount. If nil, the display is removed.
290
284
  ///
291
- access(Manage) fun setChildAccountDisplay(address: Address, _ d: MetadataViews.Display?) {
285
+ access(Manage | Mutate) fun setChildAccountDisplay(address: Address, _ d: MetadataViews.Display?) {
292
286
  pre {
293
287
  self.childAccounts[address] != nil: "There is no child account with this address"
294
288
  }
@@ -304,7 +298,7 @@ access(all) contract HybridCustody {
304
298
  /// Adds a ChildAccount Capability to this Manager. If a default Filter is set in the manager, it will also be
305
299
  /// added to the ChildAccount
306
300
  ///
307
- access(Manage) fun addAccount(cap: Capability<auth(Child) &{AccountPrivate, AccountPublic, ViewResolver.Resolver}>) {
301
+ access(Manage | Insert) fun addAccount(cap: Capability<auth(Child) &{AccountPrivate, AccountPublic, ViewResolver.Resolver}>) {
308
302
  pre {
309
303
  self.childAccounts[cap.address] == nil: "There is already a child account with this address"
310
304
  }
@@ -322,7 +316,7 @@ access(all) contract HybridCustody {
322
316
 
323
317
  /// Sets the default Filter Capability for this Manager. Does not propagate to child accounts.
324
318
  ///
325
- access(Manage) fun setDefaultManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?) {
319
+ access(Manage | Mutate) fun setDefaultManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?) {
326
320
  pre {
327
321
  cap == nil || cap!.check(): "supplied capability must be nil or check must pass"
328
322
  }
@@ -332,7 +326,7 @@ access(all) contract HybridCustody {
332
326
 
333
327
  /// Sets the Filter Capability for this Manager, propagating to the specified child account
334
328
  ///
335
- access(Manage) fun setManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?, childAddress: Address) {
329
+ access(Manage | Mutate) fun setManagerCapabilityFilter(cap: Capability<&{CapabilityFilter.Filter}>?, childAddress: Address) {
336
330
  let acct = self.borrowAccount(addr: childAddress)
337
331
  ?? panic("child account not found")
338
332
 
@@ -342,7 +336,7 @@ access(all) contract HybridCustody {
342
336
  /// Removes specified child account from the Manager's child accounts. Callbacks to the child account remove
343
337
  /// any associated resources and Capabilities
344
338
  ///
345
- access(Manage) fun removeChild(addr: Address) {
339
+ access(Manage | Remove) fun removeChild(addr: Address) {
346
340
  let cap = self.childAccounts.remove(key: addr)
347
341
  ?? panic("child account not found")
348
342
 
@@ -376,7 +370,7 @@ access(all) contract HybridCustody {
376
370
  /// Adds an owned account to the Manager's list of owned accounts, setting the Manager account as the owner of
377
371
  /// the given account
378
372
  ///
379
- access(Manage) fun addOwnedAccount(cap: Capability<auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}>) {
373
+ access(Manage | Insert) fun addOwnedAccount(cap: Capability<auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}>) {
380
374
  pre {
381
375
  self.ownedAccounts[cap.address] == nil: "There is already an owned account with this address"
382
376
  }
@@ -408,7 +402,7 @@ access(all) contract HybridCustody {
408
402
 
409
403
  /// Returns a reference to a child account's public AccountPublic interface
410
404
  ///
411
- access(all) fun borrowAccountPublic(addr: Address): &{AccountPublic, ViewResolver.Resolver}? {
405
+ access(all) view fun borrowAccountPublic(addr: Address): &{AccountPublic, ViewResolver.Resolver}? {
412
406
  let cap = self.childAccounts[addr]
413
407
  if cap == nil {
414
408
  return nil
@@ -419,7 +413,7 @@ access(all) contract HybridCustody {
419
413
 
420
414
  /// Returns a reference to an owned account
421
415
  ///
422
- access(Manage) fun borrowOwnedAccount(addr: Address): auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}? {
416
+ access(Manage) view fun borrowOwnedAccount(addr: Address): auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}? {
423
417
  if let cap = self.ownedAccounts[addr] {
424
418
  return cap.borrow()
425
419
  }
@@ -430,7 +424,7 @@ access(all) contract HybridCustody {
430
424
  /// Removes specified child account from the Manager's child accounts. Callbacks to the child account remove
431
425
  /// any associated resources and Capabilities
432
426
  ///
433
- access(Manage) fun removeOwned(addr: Address) {
427
+ access(Manage | Remove) fun removeOwned(addr: Address) {
434
428
  if let acct = self.ownedAccounts.remove(key: addr) {
435
429
  if acct.check() {
436
430
  acct.borrow()!.seal()
@@ -547,7 +541,7 @@ access(all) contract HybridCustody {
547
541
  /// certain type. When using the CapabilityDelegator, you do not have the ability to specify which path a
548
542
  /// capability came from. For instance, Dapper Wallet might choose to expose a Capability to their Full TopShot
549
543
  /// collection, but only to the path that the collection exists in.
550
- access(self) let delegator: Capability<auth(Capabilities) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>
544
+ access(self) let delegator: Capability<auth(CapabilityDelegator.Get) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>
551
545
 
552
546
  /// managerCapabilityFilter is a component optionally given to a child account when a manager redeems it. If
553
547
  /// this filter is not nil, any Capability returned through the `getCapability` function checks that the
@@ -596,8 +590,8 @@ access(all) contract HybridCustody {
596
590
  self.filter = cap
597
591
  }
598
592
 
599
- /// The main function to a child account's capabilities from a parent account. When a PrivatePath type is used,
600
- /// the CapabilityFilter will be borrowed and the Capability being returned will be checked against it to
593
+ /// The main function to a child account's capabilities from a parent account. When getting a capability, the CapabilityFilter will be borrowed and
594
+ /// the Capability being returned will be checked against it to
601
595
  /// ensure that borrowing is permitted. If not allowed, nil is returned.
602
596
  /// Also know that this method retrieves Capabilities via the CapabilityFactory path. To retrieve arbitrary
603
597
  /// Capabilities, see `getPrivateCapFromDelegator()` and `getPublicCapFromDelegator()` which use the
@@ -678,9 +672,9 @@ access(all) contract HybridCustody {
678
672
 
679
673
  /// Returns a reference to the stored delegator, generally used for arbitrary Capability retrieval
680
674
  ///
681
- access(Owner) fun borrowCapabilityDelegator(): auth(Capabilities) &CapabilityDelegator.Delegator? {
675
+ access(Owner) fun borrowCapabilityDelegator(): auth(CapabilityDelegator.Get) &CapabilityDelegator.Delegator? {
682
676
  let path = HybridCustody.getCapabilityDelegatorIdentifier(self.parent)
683
- return self.childCap.borrow()!._borrowAccount().storage.borrow<auth(Capabilities) &CapabilityDelegator.Delegator>(
677
+ return self.childCap.borrow()!._borrowAccount().storage.borrow<auth(CapabilityDelegator.Get) &CapabilityDelegator.Delegator>(
684
678
  from: StoragePath(identifier: path)!
685
679
  )
686
680
  }
@@ -738,7 +732,7 @@ access(all) contract HybridCustody {
738
732
  _ childCap: Capability<&{BorrowableAccount, OwnedAccountPublic, ViewResolver.Resolver}>,
739
733
  _ factory: Capability<&{CapabilityFactory.Getter}>,
740
734
  _ filter: Capability<&{CapabilityFilter.Filter}>,
741
- _ delegator: Capability<auth(Capabilities) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>,
735
+ _ delegator: Capability<auth(CapabilityDelegator.Get) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>,
742
736
  _ parent: Address
743
737
  ) {
744
738
  pre {
@@ -857,7 +851,7 @@ access(all) contract HybridCustody {
857
851
  /// 4. Publish the newly made private link to the designated parent's inbox for them to claim on their @Manager
858
852
  /// resource.
859
853
  ///
860
- access(Publish | Owner) fun publishToParent(
854
+ access(Owner) fun publishToParent(
861
855
  parentAddress: Address,
862
856
  factory: Capability<&{CapabilityFactory.Getter}>,
863
857
  filter: Capability<&{CapabilityFilter.Filter}>
@@ -882,12 +876,11 @@ access(all) contract HybridCustody {
882
876
  }
883
877
 
884
878
  let capDelegatorPublic = PublicPath(identifier: capDelegatorIdentifier)!
885
- // let capDelegatorPrivate = PrivatePath(identifier: capDelegatorIdentifier)!
886
879
 
887
880
  let pubCap = acct.capabilities.storage.issue<&{CapabilityDelegator.GetterPublic}>(capDelegatorStorage)
888
881
  acct.capabilities.publish(pubCap, at: capDelegatorPublic)
889
882
 
890
- let delegator = acct.capabilities.storage.issue<auth(Capabilities) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>(capDelegatorStorage)
883
+ let delegator = acct.capabilities.storage.issue<auth(CapabilityDelegator.Get) &{CapabilityDelegator.GetterPublic, CapabilityDelegator.GetterPrivate}>(capDelegatorStorage)
891
884
  assert(delegator.check(), message: "failed to setup capability delegator for parent address")
892
885
 
893
886
  let borrowableCap = self.borrowAccount().capabilities.storage.issue<&{BorrowableAccount, OwnedAccountPublic, ViewResolver.Resolver}>(
@@ -895,7 +888,6 @@ access(all) contract HybridCustody {
895
888
  )
896
889
 
897
890
  let childAcct <- create ChildAccount(borrowableCap, factory, filter, delegator, parentAddress)
898
- let childAccountPrivatePath = PrivatePath(identifier: identifier)!
899
891
 
900
892
  acct.storage.save(<-childAcct, to: childAccountStorage)
901
893
  let delegatorCap = acct.capabilities.storage.issue<auth(Child) &{AccountPrivate, AccountPublic, ViewResolver.Resolver}>(childAccountStorage)
@@ -966,6 +958,7 @@ access(all) contract HybridCustody {
966
958
  if self.parents[parent] == nil {
967
959
  return false
968
960
  }
961
+
969
962
  let identifier = HybridCustody.getChildAccountIdentifier(parent)
970
963
  let capDelegatorIdentifier = HybridCustody.getCapabilityDelegatorIdentifier(parent)
971
964
 
@@ -1039,7 +1032,7 @@ access(all) contract HybridCustody {
1039
1032
  let cap = acct.capabilities.storage.issue<auth(Owner) &{OwnedAccountPrivate, OwnedAccountPublic, ViewResolver.Resolver}>(HybridCustody.OwnedAccountStoragePath)
1040
1033
 
1041
1034
  // make sure we can borrow the newly issued owned account
1042
- cap.borrow()!.borrowAccount()
1035
+ cap.borrow()?.borrowAccount() ?? panic("can not borrow the Hybrid Custody Owned Account")
1043
1036
 
1044
1037
  acct.inbox.publish(cap, name: identifier, recipient: to)
1045
1038
 
@@ -1261,15 +1254,10 @@ access(all) contract HybridCustody {
1261
1254
  init() {
1262
1255
  let identifier = "HybridCustodyChild_".concat(self.account.address.toString())
1263
1256
  self.OwnedAccountStoragePath = StoragePath(identifier: identifier)!
1264
- self.OwnedAccountPrivatePath = PrivatePath(identifier: identifier)!
1265
1257
  self.OwnedAccountPublicPath = PublicPath(identifier: identifier)!
1266
1258
 
1267
- self.LinkedAccountPrivatePath = PrivatePath(identifier: "LinkedAccountPrivatePath_".concat(identifier))!
1268
- self.BorrowableAccountPrivatePath = PrivatePath(identifier: "BorrowableAccountPrivatePath_".concat(identifier))!
1269
-
1270
1259
  let managerIdentifier = "HybridCustodyManager_".concat(self.account.address.toString())
1271
1260
  self.ManagerStoragePath = StoragePath(identifier: managerIdentifier)!
1272
1261
  self.ManagerPublicPath = PublicPath(identifier: managerIdentifier)!
1273
- self.ManagerPrivatePath = PrivatePath(identifier: managerIdentifier)!
1274
1262
  }
1275
- }
1263
+ }
@@ -3,7 +3,7 @@ import "FungibleToken"
3
3
 
4
4
  access(all) contract FTAllFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<auth(FungibleToken.Withdraw) &{FungibleToken.Provider, FungibleToken.Balance, FungibleToken.Receiver}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract FTAllFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return nil
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "FungibleToken"
3
3
 
4
4
  access(all) contract FTBalanceFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<&{FungibleToken.Balance}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract FTBalanceFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return acct.capabilities.get<&{FungibleToken.Balance}>(path)
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "FungibleToken"
3
3
 
4
4
  access(all) contract FTProviderFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<auth(FungibleToken.Withdraw) &{FungibleToken.Provider}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract FTProviderFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return nil
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "FungibleToken"
3
3
 
4
4
  access(all) contract FTReceiverBalanceFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<&{FungibleToken.Receiver, FungibleToken.Balance}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract FTReceiverBalanceFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return acct.capabilities.get<&{FungibleToken.Receiver, FungibleToken.Balance}>(path)
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "FungibleToken"
3
3
 
4
4
  access(all) contract FTReceiverFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<&{FungibleToken.Receiver}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract FTReceiverFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return acct.capabilities.get<&{FungibleToken.Receiver}>(path)
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "NonFungibleToken"
3
3
 
4
4
  access(all) contract NFTCollectionPublicFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<&{NonFungibleToken.CollectionPublic}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract NFTCollectionPublicFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return acct.capabilities.get<&{NonFungibleToken.CollectionPublic}>(path)
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "NonFungibleToken"
3
3
 
4
4
  access(all) contract NFTProviderAndCollectionFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider, NonFungibleToken.CollectionPublic}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract NFTProviderAndCollectionFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return nil
20
20
  }
21
21
  }
@@ -3,7 +3,7 @@ import "NonFungibleToken"
3
3
 
4
4
  access(all) contract NFTProviderFactory {
5
5
  access(all) struct Factory: CapabilityFactory.Factory {
6
- access(Capabilities) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
6
+ access(all) view fun getCapability(acct: auth(Capabilities) &Account, controllerID: UInt64): Capability? {
7
7
  if let con = acct.capabilities.storage.getController(byCapabilityID: controllerID) {
8
8
  if !con.capability.check<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Provider}>() {
9
9
  return nil
@@ -15,7 +15,7 @@ access(all) contract NFTProviderFactory {
15
15
  return nil
16
16
  }
17
17
 
18
- access(all) view fun getPublicCapability(acct: auth(Capabilities) &Account, path: PublicPath): Capability? {
18
+ access(all) view fun getPublicCapability(acct: &Account, path: PublicPath): Capability? {
19
19
  return nil
20
20
  }
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowtyio/flow-contracts",
3
- "version": "0.1.0-beta.12",
3
+ "version": "0.1.0-beta.13",
4
4
  "main": "index.json",
5
5
  "description": "An NPM package for common flow contracts",
6
6
  "author": "flowtyio",