smartpy_io | Unsorted

Telegram-канал smartpy_io - SmartPy

429

https://smartpy.io/ https://twitter.com/smartpy_io

Subscribe to a channel

SmartPy

Hello, I am using the online SmartPy IDE, but I am encountering some errors. Specifically, I am getting the error "AttributeError: module 'smartpy' has no attribute 'Contract'," and I am unable to use it. I have also encountered changes in the way contracts should be defined. I would like to know if there has been a recent update that might be incompatible with older code, or if there is an alternative way to define contracts.

I would appreciate it if you could look into my issue and provide a solution.

Thank you.

Читать полностью…

SmartPy

fair enough, thanks for the update

Читать полностью…

SmartPy

also I would make sure to use an up to date octez-client as the smartpy RPCs recently upgraded to v21

Читать полностью…

SmartPy

> Access to fetch at 'https://ghostnet.smartpy.io/keys/tz2NBt7dzqEzJjVg9KfGV8A7KDcQiqtEsbMR' from origin 'http://192.168.1.104:3001' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

Читать полностью…

SmartPy

before fixing Michelson

Читать полностью…

SmartPy

if it still doesnt work when published on heroku I'd have a look at whether there are extra steps you need to do for CORS support on that platform

Читать полностью…

SmartPy

Trying to minimize noise here but it's def a cors issue even after deploying to heroku, no idea how the fuck this is happening

Читать полностью…

SmartPy

> tz2NBt7dzqEzJjVg9KfGV8A7KDcQiqtEsbMR https://ghostnet.smartpy.io/
localhost/:1 Access to fetch at 'https://ghostnet.smartpy.io/keys/tz2NBt7dzqEzJjVg9KfGV8A7KDcQiqtEsbMR' from origin 'http://localhost:3002' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

Читать полностью…

SmartPy

Using print(contract.data.value) gives weird data and not the actual value.
sp.show prints in log.txt I want in Compiler.

Читать полностью…

SmartPy

Ohkkk

Got it.

Читать полностью…

SmartPy

What can be the issue here?

Code

@sp.private(with_storage="read-write")
def _claim(self, address):
# Return 0 if user has no stakes
if not self.data.stakes.contains(address):
return sp.nat(0)


Error
TypeError_: (SmartPy)
File "staking.py", line 154, in <module>
return sp.nat(0)
'return' in non-terminal position.

Читать полностью…

SmartPy

Also, is there any way to see HTML view of tests as we had in legacy or on online ide?

Its difficult to debug using the log.txt file.

Читать полностью…

SmartPy

Thank you, I see the problem, the set syntax is still old in the test scenario. You'll have to use sp.set([x1, x2, ...]). That will be fixed in the next version.

Читать полностью…

SmartPy

Sure what is your username?

Читать полностью…

SmartPy

whitelisted_collections is part of a record

Читать полностью…

SmartPy

thextz.life (funny domain but u no)

Читать полностью…

SmartPy

Thanks, in the end I just had bad smartpy contract and prefer the smartpy/ide as it's one less wheel I have to reinvent

Читать полностью…

SmartPy

do you still get the 403 with setting the rpc to another e.g. https://rpc.tzkt.io/ghostnet ?

Читать полностью…

SmartPy

> Error3: {
"value": {
"mutezPerMove": 100,
"player": "tz2NBt7dzqEzJjVg9KfGV8A7KDcQiqtEsbMR"
},
"token": {
"val": {
"prim": "nat",
"annots": [
"%mutezPerMove"
]
},
"idx": 0
},
"name": "NatValidationError",
"message": "[mutezPerMove] Value is not a number: {\"mutezPerMove\":100,\"player\":\"tz2NBt7dzqEzJjVg9KfGV8A7KDcQiqtEsbMR\"}"
}

Читать полностью…

SmartPy

hmm yeah, it's def CORS, I can get to the contract(Methods).entryPointName(params).send() and when I don't get a Michelson TypeError with either methods or contractMethods I go straight to the CORS error when running both locally and after publishing to Heroku

Читать полностью…

SmartPy

Yep, maybe worth checking you can configure the service to allow CORS and then check can run it locally first, then move to heroku and check it still works?

Читать полностью…

SmartPy

I think that you need to allow cross-origin requests at your end? I don't believe it's a smartpy RPC issue.

Читать полностью…

SmartPy

I don't have a smartpy.io question but does anyone know whot to get around teh smartypy.io CORS policy when trying to interact with contract via a dApp?

Читать полностью…

SmartPy

We can't use sp.trace in tests??

How can we display output in console from tests?

Читать полностью…

SmartPy

In Michelson and therefore in SmartPy you cannot return in a if branch without returning in the else.
See https://smartpy.io/manual/introduction/differences#functions.

Читать полностью…

SmartPy

Not at the moment, we're working on a solution

Читать полностью…

SmartPy

Using that gives deprecation warning

Читать полностью…

SmartPy

Sorry, that's Jordan

Читать полностью…

SmartPy

Ok, can you share your code, in private if you want ?

Читать полностью…

SmartPy

Why is there a comma at the end?

Читать полностью…
Subscribe to a channel