Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: new-sdk-draft1 #329

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

aybarsayan
Copy link

@aybarsayan aybarsayan commented Oct 22, 2024

fixes #3566

Changed the code for sdk v1, its a draft, and will continue according to feedbacks

How to test:

Please provide a brief step-by-step instruction.
If necessary provide information about dependencies (specific configuration, branches, database dumps, etc.)

  • Step 1
  • Step 2
  • etc.

Checklist:

  • I have verified that the code works
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • I have left the code in a better state
  • I have documented the changes (where applicable)
    • Either PR or Ticket to update the Docs
    • Link the PR/Ticket here

Copy link
Contributor

@ChrisChinchilla ChrisChinchilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few small suggestions to things I know aren't quite correct, but I think @rflechtner might have more to say.

code_examples/sdk_examples/package.json Outdated Show resolved Hide resolved
@@ -1,16 +1,16 @@
/* eslint-disable prefer-const */
import * as Kilt from '@kiltprotocol/sdk-js'
import * as Did from '@kiltprotocol/did'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fairly certain this doesn't exist… DID-related methods are part of the Kilt.DidHelpers. and ``Kilt.DidResolver.`.

Or is this some other way to access the methods @rflechtner ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I couldn’t find another way to access the Did.linkedInfoFromChain function. I found apiConfig.call.did.linkedInfoFromChain(encodedKiltnerd123Details), but it doesn’t seem to work the same way and gives errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are indeed missing a function to resolve a DID document based on a w3n. This could be something worth adding to the DidResolver that Chris mentioned

docs/develop/01_sdk/01_quickstart.md Outdated Show resolved Hide resolved
docs/develop/01_sdk/01_quickstart.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
} = Kilt.Did.linkedInfoFromChain(encodedKiltnerd123Details)
console.log(`My name is kiltnerd123 and this is my DID: "${uri}"`)
document: { id }
} = Did.linkedInfoFromChain(encodedKiltnerd123Details)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't an ideal way of doing things, but it's missing from the SDK, so @rflechtner is going to add a new method and then we can update this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as I explained above, unfortunately (as far as I saw), it’s not included in the new versions of the SDK.

@@ -1,13 +1,12 @@
import axios from 'axios'

import * as Kilt from '@kiltprotocol/sdk-js'
import { VerifiableCredential } from '@kiltprotocol/credentials/lib/cjs/V1/types'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { VerifiableCredential } from '@kiltprotocol/credentials/lib/cjs/V1/types'
import { types } from '@kiltprotocol/credentials'

and then use types.VerfiableCredential. But we may want to move that to that /types package, doesn't seem right to have to access it that way

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its fix on: 2fb4bf2
But types declaration works partially, even tho it connects the modules in types, its also says '"@kiltprotocol/credentials"' has no exported member named 'types'. Did you mean 'Types'?ts(2724)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes it may have been Types

@@ -1,13 +1,12 @@
import axios from 'axios'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aybarsayan Not introduced by you, but this may be a good time to remove the axios package and replace it with a native fetch to make the HTTP requests.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can change this in a new pr 😊

Copy link
Contributor

@rflechtner rflechtner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double-check the import {types}from "@kiltprotocol/credentials" import (may actually be Types). But looks good to me so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants