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

added soul linker functions for the credit score #7

Merged
merged 26 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.8.0](https://github.com/masa-finance/masa-sdk/compare/v0.8.0-beta.1...v0.8.0)

> 4 January 2023

- fix credit score loading logic [`03e57e8`](https://github.com/masa-finance/masa-sdk/commit/03e57e833809850ce975cc9df29cd1a268c6152c)

#### [v0.8.0-beta.1](https://github.com/masa-finance/masa-sdk/compare/v0.8.0-beta...v0.8.0-beta.1)

> 3 January 2023

- update docs [`a3581bc`](https://github.com/masa-finance/masa-sdk/commit/a3581bc620ed2314a81ea9862a379ffbbf3c2592)
- added query link method [`b34c2bb`](https://github.com/masa-finance/masa-sdk/commit/b34c2bbd1da48817018f9b1d1f10bb013145a981)
- harden verification function [`d304387`](https://github.com/masa-finance/masa-sdk/commit/d304387745ba5516d18c8177a74c5591df30ea89)

#### [v0.8.0-beta](https://github.com/masa-finance/masa-sdk/compare/v0.7.12...v0.8.0-beta)

> 2 January 2023

- - migrate erc20 interface to SDK to enable erc20 interactions [`4572ea1`](https://github.com/masa-finance/masa-sdk/commit/4572ea152d73878ecb92503c9b3a94da7becd82f)
- added support for soul linker [`9f86327`](https://github.com/masa-finance/masa-sdk/commit/9f863277bdb1e16ce46c0841c1605e01f87587c7)
- update soul linker implementation [`3095584`](https://github.com/masa-finance/masa-sdk/commit/3095584dfbe90b53c7c8573411d34a58f1fd6d19)

#### [v0.7.12](https://github.com/masa-finance/masa-sdk/compare/v0.7.11...v0.7.12)

> 21 December 2022
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Masa SDK
- v0.7.12 / [Exports](modules.md)
- v0.8.0 / [Exports](modules.md)

---

Expand Down
79 changes: 8 additions & 71 deletions docs/classes/Masa.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / Masa
- v0.8.0](../README.md) / [Exports](../modules.md) / Masa

# Class: Masa

Expand Down Expand Up @@ -40,13 +40,7 @@

### account

• **account**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `getBalances` | (`address?`: `string`) => `Promise`<`undefined` \| { `ethBalance`: `BigNumber` ; `identityBalance`: `BigNumber` ; `masaBalance`: `BigNumber` ; `soulNameBalance`: `BigNumber` ; `soulbound2FABalance`: `BigNumber` ; `soulboundCreditScoreBalance`: `BigNumber` ; `usdcBalance`: `BigNumber` ; `wethBalance`: `BigNumber` }\> |
• `Readonly` **account**: [`MasaAccount`](MasaAccount.md)

___

Expand Down Expand Up @@ -76,33 +70,13 @@ ___

### creditScore

• **creditScore**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `burn` | (`creditScoreId`: `number`) => `Promise`<`boolean`\> |
| `create` | () => `Promise`<`undefined` \| [`BaseResult`](../interfaces/BaseResult.md)\> |
| `list` | (`address?`: `string`) => `Promise`<{ `metadata?`: [`ICreditScore`](../interfaces/ICreditScore.md) ; `tokenId`: `BigNumber` ; `tokenUri`: `string` }[]\> |
| `load` | (`identityId`: `BigNumber`) => `Promise`<{ `metadata?`: [`ICreditScore`](../interfaces/ICreditScore.md) ; `tokenId`: `BigNumber` ; `tokenUri`: `string` }[]\> |
| `mint` | (`address`: `string`, `signature`: `string`) => `Promise`<`undefined` \| [`BaseResult`](../interfaces/BaseResult.md)\> |
• `Readonly` **creditScore**: [`MasaCreditScore`](MasaCreditScore.md)

___

### identity

• **identity**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `burn` | () => `Promise`<`boolean`\> |
| `create` | () => `Promise`<`boolean`\> |
| `createWithSoulName` | (`soulName`: `string`, `duration`: `number`, `paymentMethod`: [`PaymentMethod`](../modules.md#paymentmethod)) => `Promise`<`boolean`\> |
| `load` | (`address?`: `string`) => `Promise`<`undefined` \| `BigNumber`\> |
| `show` | (`address?`: `string`) => `Promise`<`undefined` \| { `metadata?`: [`IIdentity`](../interfaces/IIdentity.md) ; `tokenId`: `BigNumber` ; `tokenUri`: `string` }\> |
• `Readonly` **identity**: [`MasaIdentity`](MasaIdentity.md)

___

Expand All @@ -114,63 +88,26 @@ ___

| Name | Type |
| :------ | :------ |
| `retrieve` | (`url`: `string`) => `Promise`<`undefined` \| [`ICreditScore`](../interfaces/ICreditScore.md) \| [`IIdentity`](../interfaces/IIdentity.md) \| [`I2FA`](../interfaces/I2FA.md)\> |
| `retrieve` | (`url`: `string`, `additionalHeaders?`: `Record`<`string`, `string`\>) => `Promise`<`undefined` \| [`IIdentity`](../interfaces/IIdentity.md) \| [`ICreditScore`](../interfaces/ICreditScore.md) \| [`I2FA`](../interfaces/I2FA.md)\> |
| `store` | (`soulName`: `string`) => `Promise`<`undefined` \| { `imageResponse`: { `data`: `any` ; `status`: `number` ; `statusText`: `string` } ; `imageTransaction`: `default` ; `metadataResponse`: { `data`: `any` ; `status`: `number` ; `statusText`: `string` } ; `metadataTransaction`: `default` }\> |

___

### session

• **session**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `checkAllowlist` | () => `Promise`<`boolean`\> |
| `checkLogin` | () => `Promise`<`boolean`\> |
| `getSession` | () => `Promise`<`undefined` \| [`ISession`](../interfaces/ISession.md)\> |
| `login` | () => `Promise`<`undefined` \| { `address`: `string` ; `cookie`: `string` ; `userId`: `string` \| `BigNumber` }\> |
| `logout` | () => `Promise`<`undefined` \| { `status`: `string` }\> |
| `sessionLogout` | () => `Promise`<`undefined` \| { `status`: `string` }\> |
• `Readonly` **session**: [`MasaSession`](MasaSession.md)

___

### soulNames

• **soulNames**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `burn` | (`soulName`: `string`) => `Promise`<`void`\> |
| `create` | (`soulName`: `string`, `duration`: `number`, `paymentMethod`: [`PaymentMethod`](../modules.md#paymentmethod)) => `Promise`<[`CreateSoulNameResult`](../interfaces/CreateSoulNameResult.md)\> |
| `getRegistrationPrice` | (`soulName`: `string`, `duration`: `number`, `paymentMethod`: [`PaymentMethod`](../modules.md#paymentmethod)) => `Promise`<`BigNumber`\> |
| `list` | (`address?`: `string`) => `Promise`<{ `index`: `number` ; `metadata`: `undefined` \| [`ISoulName`](../interfaces/ISoulName.md) ; `owner`: `undefined` \| `string` ; `tokenDetails`: `undefined` \| [`string`, `boolean`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`] & { `active`: `boolean` ; `expirationDate`: `BigNumber` ; `identityId`: `BigNumber` ; `linked`: `boolean` ; `sbtName`: `string` ; `tokenId`: `BigNumber` } ; `tokenUri`: `undefined` \| `string` }[]\> |
| `loadSoulNameByName` | (`soulName`: `string`) => `Promise`<`undefined` \| { `metadata`: [`ISoulName`](../interfaces/ISoulName.md) ; `owner`: `string` ; `tokenDetails`: [`string`, `boolean`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`] & { `active`: `boolean` ; `expirationDate`: `BigNumber` ; `identityId`: `BigNumber` ; `linked`: `boolean` ; `sbtName`: `string` ; `tokenId`: `BigNumber` } ; `tokenUri`: `string` }\> |
| `loadSoulNameByTokenId` | (`tokenId`: `string` \| `BigNumber`) => `Promise`<`undefined` \| { `metadata`: [`ISoulName`](../interfaces/ISoulName.md) ; `owner`: `string` ; `tokenDetails`: [`string`, `boolean`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`] & { `active`: `boolean` ; `expirationDate`: `BigNumber` ; `identityId`: `BigNumber` ; `linked`: `boolean` ; `sbtName`: `string` ; `tokenId`: `BigNumber` } ; `tokenUri`: `string` }\> |
| `loadSoulNamesByIdentityId` | (`identityId`: `BigNumber`) => `Promise`<{ `index`: `number` ; `metadata`: `undefined` \| [`ISoulName`](../interfaces/ISoulName.md) ; `owner`: `undefined` \| `string` ; `tokenDetails`: `undefined` \| [`string`, `boolean`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`] & { `active`: `boolean` ; `expirationDate`: `BigNumber` ; `identityId`: `BigNumber` ; `linked`: `boolean` ; `sbtName`: `string` ; `tokenId`: `BigNumber` } ; `tokenUri`: `undefined` \| `string` }[]\> |
| `send` | (`soulName`: `string`, `receiver`: `string`) => `Promise`<`void`\> |
| `validate` | (`soulName`: `string`) => { `isValid`: `boolean` ; `message?`: `string` } |
| `verify` | (`soulName`: `string`) => `Promise`<{ `imageHashMatch`: `boolean` ; `imageOwnerIsMasaAccount`: `boolean` ; `imageSignatureMatch`: `boolean` ; `metadataOwnerIsMasaAccount`: `boolean` ; `metadataSignatureMatch`: `boolean` ; `nameMatch`: `boolean` }\> |
• `Readonly` **soulNames**: [`MasaSoulNames`](MasaSoulNames.md)

___

### twoFA

• **twoFA**: `Object`

#### Type declaration

| Name | Type |
| :------ | :------ |
| `burn` | (`twoFAId`: `number`) => `Promise`<`boolean`\> |
| `create` | (`phoneNumber`: `string`, `code`: `string`) => `Promise`<[`Create2FAResult`](../interfaces/Create2FAResult.md)\> |
| `generate` | (`phoneNumber`: `string`) => `Promise`<`undefined` \| [`BaseResult`](../interfaces/BaseResult.md) & { `status`: `string` }\> |
| `list` | (`address?`: `string`) => `Promise`<{ `metadata?`: [`I2FA`](../interfaces/I2FA.md) ; `tokenId`: `BigNumber` ; `tokenUri`: `string` }[]\> |
| `load` | (`identityId`: `BigNumber`) => `Promise`<{ `metadata?`: [`I2FA`](../interfaces/I2FA.md) ; `tokenId`: `BigNumber` ; `tokenUri`: `string` }[]\> |
| `mint` | (`address`: `string`, `phoneNumber`: `string`, `code`: `string`, `signature`: `string`) => `Promise`<`undefined` \| [`BaseResult`](../interfaces/BaseResult.md) & { `status`: `string` }\> |
• `Readonly` **twoFA**: [`Masa2FA`](Masa2FA.md)

___

Expand Down
7 changes: 4 additions & 3 deletions docs/classes/MasaClient.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / MasaClient
- v0.8.0](../README.md) / [Exports](../modules.md) / MasaClient

# Class: MasaClient

Expand Down Expand Up @@ -138,17 +138,18 @@ ___

### getMetadata

▸ **getMetadata**(`uri`): `Promise`<`undefined` \| [`ICreditScore`](../interfaces/ICreditScore.md) \| [`IIdentity`](../interfaces/IIdentity.md) \| [`I2FA`](../interfaces/I2FA.md)\>
▸ **getMetadata**(`uri`, `additionalHeaders?`): `Promise`<`undefined` \| [`IIdentity`](../interfaces/IIdentity.md) \| [`ICreditScore`](../interfaces/ICreditScore.md) \| [`I2FA`](../interfaces/I2FA.md)\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `uri` | `string` |
| `additionalHeaders?` | `Record`<`string`, `string`\> |

#### Returns

`Promise`<`undefined` \| [`ICreditScore`](../interfaces/ICreditScore.md) \| [`IIdentity`](../interfaces/IIdentity.md) \| [`I2FA`](../interfaces/I2FA.md)\>
`Promise`<`undefined` \| [`IIdentity`](../interfaces/IIdentity.md) \| [`ICreditScore`](../interfaces/ICreditScore.md) \| [`I2FA`](../interfaces/I2FA.md)\>

___

Expand Down
52 changes: 51 additions & 1 deletion docs/classes/MasaContracts.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / MasaContracts
- v0.8.0](../README.md) / [Exports](../modules.md) / MasaContracts

# Class: MasaContracts

Expand All @@ -16,6 +16,7 @@

### Methods

- [addLink](MasaContracts.md#addlink)
- [checkOrGiveAllowance](MasaContracts.md#checkorgiveallowance)
- [getPaymentAddress](MasaContracts.md#getpaymentaddress)
- [getPaymentInformation](MasaContracts.md#getpaymentinformation)
Expand All @@ -25,6 +26,7 @@
- [purchaseIdentity](MasaContracts.md#purchaseidentity)
- [purchaseIdentityAndName](MasaContracts.md#purchaseidentityandname)
- [purchaseName](MasaContracts.md#purchasename)
- [queryLink](MasaContracts.md#querylink)

## Constructors

Expand Down Expand Up @@ -52,6 +54,30 @@ ___

## Methods

### addLink

▸ **addLink**(`signer`, `tokenAddress`, `paymentMethod`, `readerIdentityId`, `ownerIdentityId`, `tokenId`, `signatureDate`, `expirationDate`, `signature`): `Promise`<`boolean`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `signer` | `Signer` |
| `tokenAddress` | `string` |
| `paymentMethod` | [`PaymentMethod`](../modules.md#paymentmethod) |
| `readerIdentityId` | `BigNumber` |
| `ownerIdentityId` | `BigNumber` |
| `tokenId` | `BigNumber` |
| `signatureDate` | `number` |
| `expirationDate` | `number` |
| `signature` | `string` |

#### Returns

`Promise`<`boolean`\>

___

### checkOrGiveAllowance

▸ `Private` **checkOrGiveAllowance**(`paymentAddress`, `signer`, `paymentMethod`, `price`): `Promise`<`undefined` \| `ContractReceipt`\>
Expand Down Expand Up @@ -212,3 +238,27 @@ ___
#### Returns

`Promise`<`ContractTransaction`\>

___

### queryLink

▸ **queryLink**(`signer`, `tokenAddress`, `paymentMethod`, `readerIdentityId`, `ownerIdentityId`, `tokenId`, `signatureDate`, `expirationDate`, `signature`): `Promise`<`string`\>

#### Parameters

| Name | Type |
| :------ | :------ |
| `signer` | `Signer` |
| `tokenAddress` | `string` |
| `paymentMethod` | [`PaymentMethod`](../modules.md#paymentmethod) |
| `readerIdentityId` | `BigNumber` |
| `ownerIdentityId` | `BigNumber` |
| `tokenId` | `BigNumber` |
| `signatureDate` | `number` |
| `expirationDate` | `number` |
| `signature` | `string` |

#### Returns

`Promise`<`string`\>
2 changes: 1 addition & 1 deletion docs/interfaces/Addresses.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / Addresses
- v0.8.0](../README.md) / [Exports](../modules.md) / Addresses

# Interface: Addresses

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/Attribute.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / Attribute
- v0.8.0](../README.md) / [Exports](../modules.md) / Attribute

# Interface: Attribute

Expand Down
6 changes: 3 additions & 3 deletions docs/interfaces/BaseResult.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / BaseResult
- v0.8.0](../README.md) / [Exports](../modules.md) / BaseResult

# Interface: BaseResult

## Hierarchy

- **`BaseResult`**

↳ [`CreateSoulNameResult`](CreateSoulNameResult.md)

↳ [`Create2FAResult`](Create2FAResult.md)

↳ [`CreateSoulNameResult`](CreateSoulNameResult.md)

## Table of contents

### Properties
Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/Create2FAResult.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / Create2FAResult
- v0.8.0](../README.md) / [Exports](../modules.md) / Create2FAResult

# Interface: Create2FAResult

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/CreateSoulNameResult.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / CreateSoulNameResult
- v0.8.0](../README.md) / [Exports](../modules.md) / CreateSoulNameResult

# Interface: CreateSoulNameResult

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/I2fa.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / I2FA
- v0.8.0](../README.md) / [Exports](../modules.md) / I2FA

# Interface: I2FA

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/ICreditScore.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / ICreditScore
- v0.8.0](../README.md) / [Exports](../modules.md) / ICreditScore

# Interface: ICreditScore

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/IIdentity.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / IIdentity
- v0.8.0](../README.md) / [Exports](../modules.md) / IIdentity

# Interface: IIdentity

Expand Down
8 changes: 4 additions & 4 deletions docs/interfaces/IIdentityContracts.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / IIdentityContracts
- v0.8.0](../README.md) / [Exports](../modules.md) / IIdentityContracts

# Interface: IIdentityContracts

Expand All @@ -10,7 +10,7 @@
- [SoulLinkerContract](IIdentityContracts.md#soullinkercontract)
- [SoulNameContract](IIdentityContracts.md#soulnamecontract)
- [SoulStoreContract](IIdentityContracts.md#soulstorecontract)
- [Soulbound2FA](IIdentityContracts.md#soulbound2fa)
- [Soulbound2FAContract](IIdentityContracts.md#soulbound2facontract)
- [SoulboundCreditScoreContract](IIdentityContracts.md#soulboundcreditscorecontract)
- [SoulboundIdentityContract](IIdentityContracts.md#soulboundidentitycontract)

Expand All @@ -34,9 +34,9 @@ ___

___

### Soulbound2FA
### Soulbound2FAContract

• **Soulbound2FA**: `Soulbound2FA`
• **Soulbound2FAContract**: `Soulbound2FA`

___

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/ISession.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / ISession
- v0.8.0](../README.md) / [Exports](../modules.md) / ISession

# Interface: ISession

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/ISoulName.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / ISoulName
- v0.8.0](../README.md) / [Exports](../modules.md) / ISoulName

# Interface: ISoulName

Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/LoadContractArgs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[# Masa SDK
- v0.7.12](../README.md) / [Exports](../modules.md) / LoadContractArgs
- v0.8.0](../README.md) / [Exports](../modules.md) / LoadContractArgs

# Interface: LoadContractArgs

Expand Down