Code Monkey home page Code Monkey logo

nano's People

Contributors

berkhanberkdemir avatar gabrielpatrola avatar hendersonyang avatar ianlynch avatar jeremybreccion avatar lygerwon avatar nano2dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nano's Issues

Webhook_url not working

Webhook_url does not seem to be firing. I suspect it might also be due to extra parameters in the url but not sure. This happens even when using POST to get checkout url.

Here are some debug details:

POST url = https://nano.to/{my_nano_address}
body = {
"title": "Test Title",
"plans": [
{
"name": "content name",
"price": "0.01"
}
],
"business": {
"name": "Test business"
},
"success_url": "https://localhost:8000/123",
"cancel_url": "https://localhost:8000",
"webhook_url": "https://ptsv2.com/t/z3ohr-1633032238/post?content_id=modern_art&order_id=test3&code=supersecret",
"raw": "true"
}

Response:
{
"id": "38250487ae2",
"url": "https://api.nano.to/checkout/38250487ae2",
"exp": "2021-10-01T20:07:20.624Z"
}

After completing the payment successfully I check the post test server: https://ptsv2.com/t/z3ohr-1633032238 and nothing shows up there.

Domain Admin controls

We should establish a way for xno.to to handshake the wallet that purchased the domain so they can control the look and feel of their page without using GET params.

If we only handle design and content on pages through GET, then anyone could URL bomb that domain with whatever bad actor content they wanted.

Example:

https://xno.to/Moon?title=Support Bitcoin, Ӿ is bad&description=<p>This was setup to show how you could damage someone’s rep on their page just by sending a complex url, which the owner of this domain can’t stop. Even though the Ӿ would go to the affected party, they would never be able to remove this link.</p>
&image=https://media4.giphy.com/media/LukAHGCMfxMbK/giphy.gif&success_url=https://xno.to/wtrsld

Output

Screen Shot 2021-12-01 at 8 27 02 AM

Refine the UX of the Checkout page

Discussed in #45

Originally posted by wtrsld November 22, 2021
Hi, I took some time to refine the checkout page for Nano.to

I realize you didn't ask for this but it is my hope that you have this in your back pocket if you need to refine stuff.

Let me know if you want me to get your specs for stuff or how you'd like me to hand off.

Really appreciate you making this, it's freaking cool.

Current Checkout Page
Screen Shot 2021-11-22 at 8 34 01 AM

Refinements:

For web
Checkout page no image
Ӿ checkout page
Checkout page with image
Ӿ checkout page with image

For mobile
Mobile start
Ӿ checkout page Mobile Start

Mobile Select
Ӿ checkout page Mobile

Mobile Pay what you want XNO/USD
XNO
Ӿ checkout page Mobile Suggest Nano

USD
Ӿ checkout page Mobile Suggest USD

Confirm and send
Ӿ checkout page Mobile Confirm

Utility convert does not throw errors instead returns

Hi there,

I was inspecting the source code and I see that Errors are returned rather than throw. Can I learn the reason why? I see that you are using try and catch, but there is a little good reason for doing that. Throwing right in the error will mitigate problems later on.

For example, if you are planning to make use of the test suite (I just started to write some of them), watching throws is easier than looking at return values.

I would like to hear your thoughts on that.

[Request] History API

History endpoint fixed with #38 but can we add confirmed and pending properties so we can programmatically check if a transaction is cemented on the network, and/or pending?

Would pretty much make it very easy to check if a payment is complete by referencing the amount specifically.

~
❯ https --body "https://nano.to/xanza/history/0.85"
{
    "account": "nano_3u6b56w7cqd64g9wxkidg5iwnksku8b1rtgcnho1sesgkwpe9rwb7ufktp61",
    "amount": "0.85",
    "balance": "222006732799999999998231010344960",
    "hash": "6A81D58621234FEDDC97867F818686788C317A5E04A65FA9AAA36FC802ECCB29",
    "height": "82",
    "link": "EC891938555D64138FCECA0B70E1CA4B32D9920C69CAA3EA0CB32E972CC3E389",
    "local_timestamp": "1637201394",
    "previous": "5C66C4ED30788F80E2339A8BDEFFB89D84230AD3BC4868B147452FC5C759486E",
    "representative": "nano_3zapp5z141qpjipsb1jnjdmk49jwqy58i6u6wnyrh6x7woajeyme85shxewt",
    "signature": "1BB42776493F600A43AC10B733B4011E62C5593375F2C10013E7EA399CA18663E5BD4A5ACC358BABAD02A189EFC5058B8EDCE",
    "subtype": "send",
    "type": "state",
    "work": "31d2d5b3ba7affbb"
}

Above is what the endpoint looks like, and below, what would be amazing;

~
❯ https --body "https://nano.to/xanza/history/0.85"
{
    "account": "nano_3u6b56w7cqd64g9wxkidg5iwnksku8b1rtgcnho1sesgkwpe9rwb7ufktp61",
    "amount": "0.85",
    "balance": "222006732799999999998231010344960",
    "hash": "6A81D58621234FEDDC97867F818686788C317A5E04A65FA9AAA36FC802ECCB29",
    "height": "82",
    "link": "EC891938555D64138FCECA0B70E1CA4B32D9920C69CAA3EA0CB32E972CC3E389",
    "local_timestamp": "1637201394",
    "previous": "5C66C4ED30788F80E2339A8BDEFFB89D84230AD3BC4868B147452FC5C759486E",
    "representative": "nano_3zapp5z141qpjipsb1jnjdmk49jwqy58i6u6wnyrh6x7woajeyme85shxewt",
    "signature": "1BB42776493F600A43AC10B733B4011E62C5593375F2C10013E7EA399CA18663E5BD4A5ACC358BABAD02A189EFC5058B8EDCE",
    "subtype": "send",
    "type": "state",
    "complete": true, // complete = {true,false}
    "pending": false, // pending = {true,false}
    "work": "31d2d5b3ba7affbb"
}

Allow URL params in success_url & cancel_url param.

This is more a URL limitation than a bug.

For example:

https://nano.to/moon?success_url=https://mywebsite.com/success?id={{id}}

This would not work as intended because of the second '?' in the URL

Of course this is not an issue with POST requests.

Here's some example code for bypassing this issue meanwhile.

// npm install axios

axios.post('https://nano.to/[NANO_ADDRESS_OR_LEASED_NAME]', {
    "title": "Donate",
    "price": 10,
    "business": {
        "name": "McDonalds",
        "logo": "https://www.tailorbrands.com/wp-content/uploads/2020/07/mcdonalds-logo.jpg"
    },
    "success_url": "https://mywebsite.com/success?id={{id}}&anotherParam=hello",
    "cancel_url": "https://google.com"
})

Example response:

{
    "id": "666ee7bf26a",
    "url": "https://api.nano.to/checkout/666ee7bf26a",
    "exp": "2021-09-23T01:51:23.853Z"
}

It's important to note that Checkouts urls have a 4 hour lifespan. After, they expire.

All the URL params that can be passed via GET, also work via POST.

SMS Notifications

Twilio part is easy.

You'd have to pre-purchase SMS credits??

Not sure.

check payment logic fails

Screen Shot 2021-10-22 at 10 28 59 AM

NanoCrawler pending response:

{
"total": 1,
"blocks": [
{
"type": "pending",
"amount": "3950000000000001024000000000",
"hash": "{confirmed hash}",
"source": "{test account}",
"timestamp": null
}
],
"pendingBalance": "3950000000000001024000000000"
}

QR code uses amount "3950000000000001024000000000". I think "3950000000000000000000000000" is being sent to the backend check at https://api.nano.to/checkout/{cart_id}/check/nano

Keep webhook_url secret

I have a webhook_url 'Add Credits' I am experimenting with. The only way to truly keep webhoook_url secret is to create a checkout session server side.

It would be very convenient if Nano.to had a concept of an 'App' where webhook_url is already saved. A basic api flow:

  1. A new endpoint that creates an app for a specific address.
    Post endpoint: https://nano.to/{nano_address}/newApp
    Body:
    {
    "title": "New Order",
    "plans": [
    {
    "name": "product 1",
    "price": "0.1"
    }
    ],
    "metaData": { "token": "12345" },
    "success_url": "success_url",
    "cancel_url": "cancel_url",
    "webhook_url": "https://Add_Credits"
    }
    Response:
    {
    "app_code": "12345"
    }
    This call only needs to be done once.

  2. Client can then make call: GET https://nano.to/{nano_address}/{app_code}/getCheckOut
    Response
    {
    "id": "6ff2a2435def2",
    "url": "https://nano.to/checkout/6ff2a2435def2",
    "exp": "April 16, 2022 9:35 AM EST/UTC−05:00"
    }

new param to allow payment success only when webhook returns 200

If webhook status != 200 then direct user to cancel_url. I am working on a proof of concept and this would simplify a lot of things. Maybe something like ?force_webhook=true

In my webhook logic I am adding security checks to make sure the nano.to params were not messed with.

Search not lined up on Firefox

The username search is not lined up in Firefox. Clicking the center of the search box has no effect. I'm using the latest version of Firefox 93.0

image

Noto, for generating QR codes in the terminal.

I was playing around with the API and decided to create a little CLI to generate a QR code in the terminal that can be scanned on your device.
It has two modes, one for generating a QR code exclusively for nano.to and another that uses nano.to to get a usernames address and generate a QR code that can be scanned using regular wallet apps or scanner apps.

https://github.com/mmatongo/noto

Multi-Coin Support Thread

This is the current check for Nano pending transactions

await server.http.get(`https://api.nanocrawler.cc/v2/accounts/${order.address}/pending`)

I need something like this for BTC & others.

  • Nano (NanoCrawler API)
  • ETH (Infura API)
  • BTC (?)

Anyone know a good API?

Payment Check Failing. Working on it.

https://github.com/formsend/nano/blob/b5169a13f1126c516eb01f8ddb53697f39a44739/code/index.js#L139:L160

  async payment(address, amount) {
        if (!address) return new Error("First parameter, NANO address is missing.")
        if (!amount) return new Error("Second parameter, NANO amount is missing.")
        var history = await this.history(address)
            history = history.find(a => a.amount == amount || a.amount == `${amount}0`) || false
        if (history && history.hash) {
            return history
        }
        var pending = await this.pending(address)
            pending = pending.find(a => a.amount == amount || a.amount == `${amount}0`) || false
        if (pending && pending.hash) {
            return pending
        }
        return false
  },

https://nano.to/xanza/history/0.85 -> "page not found"

[Bug] Customize Checkout Page Currency

If you send a request like this:
https://nano.to/Moon?currency=HUF

The documentation doesn't mention anything about being able to pass currency value, but if you do then you will get some weird results;

As you can see HUF appears multiple times, but the conversion rate is still USD, which is very misleading as 1$=310Ft.

I would be really grateful if you could add a feature to select a currency when creating a checkout page. If you do, then maybe I will drop a few NANOs in your wallet as a reward ;)

Auto check payment

Add logic to auto check payment. A polling method with backoff factor and max retry would work. If max retries are exceeded then revert to manual check payment button.

Create dedicated, public QR generating API endpoint

I think the Checkout API and the world would benefit from Nano.to having a separate, public QR generating API endpoint.

Something like this:

GET: https://api.nano.to/qr?address=nano_37...&color=red&icon=nano

Etc.

Discussions welcomed.

Correct qr code content

Current qr codes are showing an amount in decimal(ex: 1.844997), but natrium and nault only accept this amount in raw(ex: 1844997000000000000000000000000). Also, to put the nano account it needs to put "nano:" before the address.

❌nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o?amount=1.844997
✔️nano:nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o?amount=1844997000000000000000000000000

Documentation to clarify some fields are not provided for receivable tx

example response from https://github.com/formsend/nano#get-nano-transaction-by-amount :

{
	"type": "state",
	"representative": "nano_3kqdiqmqiojr1aqqj51aq8bzz5jtwnkmhb38qwf3ppngo8uhhzkdkn7up7rp",
	"link": "F082A253FD6BD1376F28256A0F342CBD5FF1A3A8848359487119EA10EC06CF09",
	"balance": "0.215288",
	"previous": "F082A253FD6BD1376F28256A0F342CBD5FF1A3A8848359487119EA10EC06CF09",
	"subtype": "receive",
	"account": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
	"amount": "0.02143",
	"height": "244",
	"hash": "94E74C2EDAE153C181858BD28CFB67BA990EC8D1C43427658A118C947121A995",
	"work": "610bb7829e958415",
	"signature": "E09B7AF936EE4CE248630F4D03407B5BB40E258FC06B841472A30FE4FF423962F5E2201BAB321B39C10C250169D8033EB1600D9D58E39B271B2B58CC7CDB9508",
	"balance_raw": "215288000000000000000000000000",
	"amount_raw": "21430000000000000000000000000"
}

the following fields are excluded for transactions that are ready to be received:

  • representative
  • link
  • balance
  • previous
  • subtype
  • account
  • height
  • work
  • signature
  • balance_raw

docs could either include a similar list or an example response for a receivable transaction (not in account history)

-

the following fields are missing from the example:

  • complete (boolean)
  • pending (boolean)

Spaces in titles and descriptions

Hey I have a suggestion!

Can we make it so that underscores "_" will be treated as spaces in the title and description since we can't put spaces in URLs

Cheers :)

Renewal Notification & Grace Period

Lot of people asking for this. I agree.

When a vanity name is up for renewal, notify the owner and provide a grace period relative to term leased. During the grace period, only the original nano address will be able to purchase again.

Notification

The easiest way to implement is by passing a ?notify=[email protected] URL parameter when requesting reservation link from the API

Should we offer SMS notification as well?

Important to note that notification information will NOT be public information after registration.

FYI: You can check the status of any name by using '?whois=true' param on any nano.to name.

Ex: https://nano.to/moon?whois=true

Grace Periods

  • 1 Month (Grace Period 1 Week)
  • 3 Months (Grace Period 1 Week)
  • 6 Months (Grace Period 1 Week)
  • 12 Months + (Grace Period 2 Weeks)

Thoughts, comments, concerns?

Bounty - Spell Check README.md (Min 5 Corrections)

Spelling

  • [Line 5] Accesible Accessible
  • [Line 122] recieve receive
  • [Line 192] accesed accessed

Grammar / sentence

  • [Line 9] We did not built build
  • [Line 113] within it's its lifespan
  • [Line 156] in-memory and expire expires after 12 hours
  • [Line 210] know in advanced advance.
  • [Line 218] is refreshed refreshes every 60 seconds
  • [Line 386] if you want to built build

Please let me know if there are things I got wrong. English is not my first language 😄

nano_1y9apw56b3d9j6di4d3yx33u53bs3rheemofd1uknfikajy8b1zj7owuik3d

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.