Skip to content

Commit

Permalink
Merge pull request #329 from near/fix-238
Browse files Browse the repository at this point in the history
move IntoStorageKey alike feature to lib
  • Loading branch information
ailisp authored Jan 5, 2023
2 parents d1ca261 + 542ba5e commit 263c969
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
3 changes: 1 addition & 2 deletions examples/src/standard-nft/my-nft.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { NonFungibleToken } from "near-contract-standards/lib";
import {
assert,
bytes,
call,
initialize,
near,
NearBindgen,
NearPromise,
PromiseOrValue,
view,
IntoStorageKey
} from "near-sdk-js";
import {
NFTContractMetadata,
NonFungibleTokenMetadataProvider,
TokenMetadata,
} from "near-contract-standards/lib/non_fungible_token/metadata";
import {
IntoStorageKey,
Option,
} from "near-contract-standards/lib/non_fungible_token/utils";
import { AccountId } from "near-sdk-js";
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {
bytes,
serialize,
str,
IntoStorageKey,
} from "near-sdk-js";
import { TokenMetadata } from "./metadata";
import {
refund_storage_deposit,
refund_deposit,
refund_deposit_to_account,
assert_at_least_one_yocto,
IntoStorageKey,
Option,
assert_one_yocto,
} from "./utils";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ export function assert_one_yocto(): void {
}

export type Option<T> = T | null;

export interface IntoStorageKey {
into_storage_key(): string;
}
6 changes: 6 additions & 0 deletions packages/near-sdk-js/lib/utils.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/near-sdk-js/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,10 @@ export function encode(s: string): Uint8Array {
export function decode(a: Uint8Array): string {
return env.uint8array_to_utf8_string(a);
}

/**
* When implemented, allow object to be stored as collection key
*/
export interface IntoStorageKey {
into_storage_key(): string;
}

0 comments on commit 263c969

Please sign in to comment.