2

I'm learning Kadena pact-lang and following the tutorial at https://docs.kadena.io/learn-pact/beginner/hello-world

I copy pasted the code


(define-keyset 'hello-admin (read-keyset 'hello-keyset))

(module hello 'hello-admin
  "Pact hello-world with database example"

  (defschema hello-schema
    "VALUE stores greeting recipient"
    value:string)

  (deftable hellos:{hello-schema})

  (defun hello (value)
    "Store VALUE to say hello with."
    (write hellos "hello" { 'value: value }))

  (defun greet ()
    "Say hello to stored value."
    (with-read hellos "hello" { "value" := value }
      (format "Hello, {}!" [value])))
)

(create-table hellos)

(hello "world") ;; store "hello"
(greet)         ;; say hello!

When I load it into REPL it errors with <interactive>:2:0: Cannot define a keyset outside of a namespace

att
  • 617
  • 8
  • 17

1 Answers1

3

I got it working w/ adding to top

(define-namespace 'mynamespace (read-keyset 'user-ks) (read-keyset 'admin-ks))
(namespace "mynamespace")
att
  • 617
  • 8
  • 17