Skip to content

Commit

Permalink
Add overload to asset/create for additional parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Nov 30, 2023
1 parent 7736569 commit 8e44351
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 7 additions & 4 deletions convex-core/src/main/cvx/convex/asset.cvx
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,16 @@
;;;;;;;;;; Asset creation

(defn create
^{:doc {:description ["Creates a sub asset."
^{:doc {:description ["Creates a scoped sub-asset given an actor address."
"Return value will be a scoped asset path to the new sub-asset."]
:examples [{:code "(creater factory-address)"}]
:signature [{:params [addr]}]}}
[addr]
(let [scope (call addr (create))]
[path scope]))
([addr]
(let [scope (call addr (create))]
[addr scope]))
([addr options]
(let [scope (call addr (create options))]
[addr scope])))

;;;;;;;;;; Ownership

Expand Down
4 changes: 1 addition & 3 deletions convex-core/src/test/java/convex/lib/MultiTokenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ protected MultiTokenTest() {
@Test public void testOfferAccept() {
Context ctx = context();

ctx=exec(ctx,"(def id (call mt (create :foo)))");
assertEquals(Keywords.FOO,ctx.getResult());
ctx=exec(ctx,"(def FOO [mt :foo])");
ctx=exec(ctx,"(def FOO (asset/create mt :foo))");

// Mint with standard call
ctx=exec(ctx,"(call FOO (mint 10000))");
Expand Down

0 comments on commit 8e44351

Please sign in to comment.